CI #1024
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@v6 | |
| 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@v3 | |
| 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: Cache Pooch data | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| # Linux cache location | |
| ~/.cache/openfe_analysis | |
| # macOS cache location | |
| ~/Library/Caches/openfe_analysis | |
| key: pooch-${{ matrix.os }}-v2 | |
| - name: "Download Zenodo data" | |
| run: | | |
| python - <<'EOF' | |
| import pooch | |
| from openfe_analysis.tests.conftest import ZENODO_DOI, ZENODO_FILES | |
| zenodo = pooch.create( | |
| path=pooch.os_cache('openfe_analysis'), | |
| base_url=ZENODO_DOI, | |
| registry=ZENODO_FILES, | |
| ) | |
| for fname in ZENODO_FILES: | |
| zenodo.fetch(fname, processor=pooch.Untar()) | |
| EOF | |
| - 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 != 'schedule' }} | |
| uses: codecov/codecov-action@v6 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| file: coverage.xml | |
| fail_ci_if_error: false | |
| verbose: true |