Skip to content

Config Validation with Pydantic #2804

Config Validation with Pydantic

Config Validation with Pydantic #2804

Workflow file for this run

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@v6
- name: Skip - no source changes
run: echo "Skipping tests because no source code changes detected"
- name: Setup Pixi
uses: prefix-dev/[email protected]
with:
pixi-version: v0.59.0
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@v6
- uses: dorny/paths-filter@v3
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'
run: echo "Skipping tests because no source code changes detected"
- name: Setup Pixi
if: steps.filter.outputs.src == 'true' || github.event_name == 'schedule'
uses: prefix-dev/[email protected]
with:
pixi-version: v0.59.0
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'
run: |
echo "WEEK=$(date +'%Y%U')" >> $GITHUB_ENV # data and cutouts
- uses: actions/cache@v5
if: steps.filter.outputs.src == 'true' || github.event_name == 'schedule'
with:
path: |
data
cutouts
key: data-cutouts-${{ env.WEEK }}
- name: Run pylint check on scripts
if: steps.filter.outputs.src == 'true' || github.event_name == 'schedule'
# check for undefined variables to reuse functions across scripts
run: |
pixi run 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'
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@v6
with:
name: results-${{ matrix.os }}
path: |
logs
.snakemake/log
results
retention-days: 3
- name: Show remaining disk space
if: always()
run: df -h