name: Test on: push: branches: - master pull_request: branches: - master schedule: - cron: "0 5 * * 1-6" - cron: "0 5 * * 0" workflow_dispatch: # Cancel any in-progress runs when a new run is triggered concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: unit-tests: name: Unit runs-on: ubuntu-latest defaults: run: shell: bash -l {0} steps: - uses: actions/checkout@v7 - name: Setup Pixi uses: prefix-dev/setup-pixi@v0.10.0 with: pixi-version: v0.68.1 cache: true cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }} - name: Run unit tests run: | pixi run unit-tests integration-tests: name: Integration runs-on: ${{ matrix.os }}-latest strategy: fail-fast: false matrix: # Run windows only on scheduled runs on Sundays, otherwise ignore os: ${{ github.event.schedule == '0 5 * * 0' && fromJson('["ubuntu", "macos", "windows"]') || fromJson('["ubuntu", "macos"]') }} defaults: run: shell: bash -l {0} steps: - uses: actions/checkout@v7 - uses: dorny/paths-filter@v4 id: filter with: filters: | src: - 'scripts/**' - 'rules/**' - 'data/**' - 'Snakefile' - 'config/**' - 'pixi.toml' - 'pixi.lock' - '.github/workflows/test.yaml' - name: Free up disk space run: | echo "Initial disk space" df -h echo "Free up disk space" sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL sudo docker image prune --all --force sudo docker builder prune -a --force echo "Final disk space" df -h - name: Skip - no source changes if: steps.filter.outputs.src != 'true' && github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' run: echo "Skipping tests because no source code changes detected" - name: Setup Pixi if: steps.filter.outputs.src == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' uses: prefix-dev/setup-pixi@v0.10.0 with: pixi-version: v0.68.1 cache: true cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }} - name: Setup cache keys if: steps.filter.outputs.src == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' run: | echo "WEEK=$(date +'%Y%U')" >> $GITHUB_ENV # data echo "MONTH=$(date +'%Y%m')" >> $GITHUB_ENV # cutouts echo "VERSIONS_HASH=${{ hashFiles('data/versions.csv') }}" >> $GITHUB_ENV - uses: actions/cache@v6 if: steps.filter.outputs.src == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' with: path: data key: data-${{ env.WEEK }}-${{ env.VERSIONS_HASH }} - uses: actions/cache@v6 if: steps.filter.outputs.src == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' with: path: cutouts key: cutouts-${{ env.MONTH }} - name: Restore git-tracked files in data/ if: steps.filter.outputs.src == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' run: git checkout HEAD -- data/ - name: Run pylint check on scripts if: steps.filter.outputs.src == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' # check for undefined variables to reuse functions across scripts run: | pixi run -e dev pylint --disable=all --enable=E0601,E0606 --output-format=parseable scripts/add_* scripts/prepare_* scripts/solve_* - name: Run snakemake test workflows if: steps.filter.outputs.src == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' env: SNAKEMAKE_STORAGE_CACHED_HTTP_CACHE: "" SNAKEMAKE_STORAGE_CACHED_HTTP_SKIP_REMOTE_CHECKS: "1" run: | pixi run integration-tests - name: Upload artifacts if: always() uses: actions/upload-artifact@v7 with: name: results-${{ matrix.os }} path: | logs .snakemake/log results retention-days: 3 - name: Show remaining disk space if: always() run: df -h