Merge pull request #42 from scientificcomputing/pre-commit-ci-update-… #132
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: | |
| push: | |
| branches: [main] | |
| jobs: | |
| prepare-data: | |
| uses: ./.github/workflows/setup-data.yml | |
| build: | |
| needs: prepare-data | |
| env: | |
| MRITK_TEST_DATA_FOLDER_ROOT: ./test_data | |
| MRITK_TEST_DATA_FOLDER: ./test_data/mritk-test-data | |
| name: Test on ${{ matrix.os }} with Python ${{ matrix.python-version }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Download Shared Data | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: shared-test-data | |
| path: ${{ env.MRITK_TEST_DATA_FOLDER_ROOT }} # Where you want the data to appear in this runner | |
| - name: List downloaded files | |
| run: | | |
| echo "Files in ${{ env.MRITK_TEST_DATA_FOLDER_ROOT }}:" | |
| ls -R ${{ env.MRITK_TEST_DATA_FOLDER_ROOT }} | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| allow-prereleases: true | |
| - name: Install mritk | |
| run: | | |
| python -m pip install -e ".[test]" | |
| - name: Test with pytest | |
| run: | | |
| python -m pytest --cov=mritk --cov-report html --cov-report xml --cov-report term-missing -v | |
| - name: Coverage report | |
| if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' | |
| run: | | |
| python3 -m coverage report | sed 's/^/ /' >> $GITHUB_STEP_SUMMARY | |
| python3 -m coverage json | |
| export TOTAL=$(python3 -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])") | |
| echo "total=$TOTAL" >> $GITHUB_ENV | |
| - name: Upload HTML report. | |
| if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: html-report | |
| path: htmlcov |