Fix #481 Fix units #1209
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] | |
| workflow_dispatch: | |
| inputs: | |
| test_suite: | |
| description: 'Which test suite to run' | |
| required: true | |
| default: 'unit' | |
| type: choice | |
| options: | |
| - unit | |
| - integration | |
| - all | |
| jobs: | |
| pre-commit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7.0.0 | |
| with: | |
| submodules: recursive | |
| - uses: prefix-dev/setup-pixi@v0.10.0 | |
| with: | |
| pixi-version: latest | |
| - name: Run pre-commit | |
| run: pixi run -e dev pre-commit run --all-files | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v7.0.0 | |
| with: | |
| submodules: recursive | |
| - name: Setup pixi | |
| uses: prefix-dev/setup-pixi@v0.10.0 | |
| with: | |
| pixi-version: latest | |
| environments: test | |
| - name: Refresh CMIP7 vocabularies to latest upstream | |
| run: | | |
| git -C src/access_moppy/vocabularies/cmip7-cmor-tables fetch origin main | |
| git -C src/access_moppy/vocabularies/cmip7-cmor-tables checkout --detach FETCH_HEAD | |
| - name: Create default config file | |
| run: | | |
| mkdir -p ~/.moppy | |
| cat <<EOF > ~/.moppy/user.yml | |
| creator_name: "CI Bot" | |
| organisation: "ACCESS-NRI" | |
| creator_email: "ci@example.com" | |
| creator_url: "https://example.com" | |
| EOF | |
| - name: List installed packages | |
| run: pixi list -e test | |
| - name: Run smoke and unit tests (automatic) | |
| if: github.event_name != 'workflow_dispatch' | |
| run: pixi run -e test pytest tests/test_smoke.py tests/unit --cov=access_moppy --cov-config=.coveragerc --cov-report=xml | |
| - name: Run unit tests only (manual) | |
| if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_suite == 'unit' | |
| run: pixi run -e test pytest tests/test_smoke.py tests/unit --cov=access_moppy --cov-config=.coveragerc --cov-report=xml | |
| - name: Run integration tests only (manual) | |
| if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_suite == 'integration' | |
| run: pixi run -e test pytest tests/integration --cov=access_moppy --cov-config=.coveragerc --cov-report=xml | |
| - name: Run all tests (manual) | |
| if: github.event_name == 'workflow_dispatch' && github.event.inputs.test_suite == 'all' | |
| run: pixi run -e test pytest tests --cov=access_moppy --cov-config=.coveragerc --cov-report=xml | |
| - name: Upload code coverage | |
| uses: codecov/codecov-action@v7 | |
| with: | |
| token: ${{ secrets.codecov_token }} | |
| files: ./coverage.xml | |
| flags: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.test_suite || 'unit' }} |