[WIP] Move some tests to use skipped smaller data #484
This file contains hidden or 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: "CI" | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| schedule: | |
| # At 07:00 UTC on Monday and Thursday. | |
| - cron: "0 7 * * *" | |
| workflow_dispatch: | |
| # Normalize cache path for pooch across all OSes | |
| env: | |
| POOCH_CACHE_DIR: $HOME/.pooch | |
| defaults: | |
| run: | |
| shell: bash -leo pipefail {0} | |
| jobs: | |
| prefetch: | |
| name: "Pre-fetch Zenodo Data" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: "Setup Micromamba" | |
| uses: mamba-org/setup-micromamba@v2 | |
| with: | |
| environment-file: environment.yml | |
| environment-name: openfe_analysis_env | |
| cache-environment: true | |
| cache-downloads: true | |
| cache-environment-key: environment-${{ steps.date.outputs.date }} | |
| cache-downloads-key: downloads-${{ steps.date.outputs.date }} | |
| create-args: >- | |
| python=${{ matrix.python-version }} | |
| init-shell: bash | |
| - name: Pre-fetch Zenodo test data | |
| if: steps.pooch-cache.outputs.cache-hit != 'true' | |
| run: | | |
| mkdir -p "$POOCH_CACHE_DIR/openfe_analysis" | |
| micromamba run -n openfe_analysis_env python - <<'EOF' | |
| import pooch | |
| from pathlib import Path | |
| cache = Path(pooch.os_cache("openfe_analysis")) | |
| cache.mkdir(parents=True, exist_ok=True) | |
| zenodo = pooch.create( | |
| path=cache, | |
| base_url="doi:10.5281/zenodo.17916322", | |
| registry={ | |
| "openfe_analysis_simulation_output.tar.gz": "md5:09752f2c4e5b7744d8afdee66dbd1414", | |
| "openfe_analysis_skipped.tar.gz": "md5:3840d044299caacc4ccd50e6b22c0880", | |
| }, | |
| ) | |
| zenodo.fetch("openfe_analysis_simulation_output.tar.gz", processor=pooch.Untar(), timeout=30) | |
| zenodo.fetch("openfe_analysis_skipped.tar.gz", processor=pooch.Untar(), timeout=30) | |
| EOF | |
| - name: Upload Zenodo data as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: zenodo-data | |
| path: | | |
| $POOCH_CACHE_DIR/openfe_analysis/openfe_analysis_simulation_output | |
| $POOCH_CACHE_DIR/openfe_analysis/openfe_analysis_skipped | |
| tests: | |
| runs-on: ${{ matrix.os}} | |
| name: "💻-${{matrix.os }} 🐍-${{ matrix.python-version }}" | |
| needs: prefetch | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: ["ubuntu-latest", "macos-latest"] | |
| python-version: | |
| - "3.11" | |
| - "3.12" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get current date | |
| id: date | |
| run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}" | |
| - name: Download Zenodo data artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: zenodo-data | |
| path: $POOCH_CACHE_DIR/openfe_analysis | |
| - name: "Setup Micromamba" | |
| uses: mamba-org/setup-micromamba@v2 | |
| with: | |
| environment-file: environment.yml | |
| environment-name: openfe_analysis_env | |
| cache-environment: true | |
| cache-downloads: true | |
| cache-environment-key: environment-${{ steps.date.outputs.date }} | |
| cache-downloads-key: downloads-${{ steps.date.outputs.date }} | |
| create-args: >- | |
| python=${{ matrix.python-version }} | |
| init-shell: bash | |
| - name: "Install" | |
| run: | | |
| python -m pip install --no-deps . | |
| - name: "Test imports" | |
| run: | | |
| python -Ic "import openfe_analysis; print(openfe_analysis.__version__)" | |
| - name: "Run tests" | |
| run: | | |
| pytest -n auto -v --cov=openfe_analysis --cov-report=xml --durations=10 | |
| - name: codecov | |
| if: ${{ github.repository == 'OpenFreeEnergy/openfe_analysis' | |
| && github.event_name == 'pull_request' }} | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| file: coverage.xml | |
| fail_ci_if_error: false | |
| verbose: true |