Fixing flaky tests #498
Workflow file for this run
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: | |
| defaults: | |
| run: | |
| shell: bash -leo pipefail {0} | |
| jobs: | |
| tests: | |
| runs-on: ${{ matrix.os}} | |
| name: "💻-${{matrix.os }} 🐍-${{ matrix.python-version }}" | |
| 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: "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: "Download Zenodo data" | |
| run: | | |
| python - <<'EOF' | |
| import pooch | |
| from pathlib import Path | |
| cache = Path(pooch.os_cache("openfe_analysis")) | |
| cache.mkdir(parents=True, exist_ok=True) | |
| # Files to download: Zenodo API 'content' URLs + MD5 hashes | |
| files = { | |
| "openfe_analysis_simulation_output.tar.gz": ( | |
| "https://zenodo.org/api/records/17916322/files/openfe_analysis_simulation_output.tar.gz/content", | |
| "09752f2c4e5b7744d8afdee66dbd1414" | |
| ), | |
| "openfe_analysis_skipped.tar.gz": ( | |
| "https://zenodo.org/api/records/17916322/files/openfe_analysis_skipped.tar.gz/content", | |
| "3840d044299caacc4ccd50e6b22c0880" | |
| ), | |
| } | |
| # Download and untar each file | |
| for fname, (url, md5) in files.items(): | |
| pooch.retrieve( | |
| url=url, | |
| fname=fname, | |
| path=cache, | |
| known_hash=f"md5:{md5}", | |
| processor=pooch.Untar() | |
| ) | |
| EOF | |
| - 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 |