Integration tests with pangeo-forge-runner
#234
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Integration tests | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
types: [ opened, reopened, synchronize, labeled ] | |
env: | |
PYTEST_ADDOPTS: "--color=yes" | |
jobs: | |
prepare-env: | |
# run on: | |
# - all pushes to specified branch(es) | |
# - a PR was just labeled 'test-integration' | |
# - a PR with 'test-integration' label was opened, reopened, or synchronized | |
if: | | |
github.event_name == 'push' || | |
github.event.label.name == 'test-integration' || | |
contains( github.event.pull_request.labels.*.name, 'test-integration') | |
uses: ./.github/workflows/prepare-env.yaml | |
integration-tests: | |
needs: prepare-env | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11"] | |
runner-version: [ | |
"pangeo-forge-runner==0.8.0", | |
"git+https://github.com/pangeo-forge/pangeo-forge-runner.git@injections#egg=pangeo_forge_runner", | |
] | |
dependencies: ["releases-only", "upstream-dev"] | |
steps: | |
- uses: actions/checkout@v3 | |
# generic steps to load env from cache | |
- name: π― Set cache number | |
id: cache-number | |
# cache will last 3 days by default | |
run: echo CACHE_NUMBER=`expr $(date +'%j') / 3` >> $GITHUB_ENV | |
- name: π― Set environment file | |
id: env-file | |
run: echo "env_file=ci/py${{ matrix.python-version }}.yml" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: π Loaded Cached environment | |
with: | |
path: /usr/share/miniconda3/envs/pangeo-forge-recipes | |
key: ${{ runner.os }}-conda-${{ matrix.python-version }}-${{ hashFiles( env.env_file ) }}-${{ matrix.dependencies }}-${{ env.CACHE_NUMBER }} | |
id: conda-cache | |
- name: π€Ώ Bail out if no cache hit | |
if: steps.conda-cache.outputs.cache-hit != 'true' | |
run: false | |
- name: π― Set path to include conda python | |
run: echo "/usr/share/miniconda3/envs/pangeo-forge-recipes/bin" >> $GITHUB_PATH | |
# custom testing steps unique to this workflow | |
- name: π Install pangeo-forge-recipes & pangeo-forge-runner | |
shell: bash -l {0} | |
run: | | |
python -m pip install --no-deps -e . | |
python -m pip install ${{ matrix.runner-version }} | |
- name: πββοΈ Run Tests | |
shell: bash -l {0} | |
run: | | |
pytest --timeout=600 tests-integration/ -v |