Run tests #226
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: Run tests | |
| on: | |
| push: | |
| branches: ['*'] | |
| pull_request: | |
| branches: ['*'] | |
| schedule: | |
| - cron: '0 11 * * *' # Every day at 11:00 UTC | |
| workflow_dispatch: | |
| # cancel previous runs if new one is triggered | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| # NOTE: when adding a new version, update the 'if' condition in | |
| # the 'Run API tests' step | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| # only trigger on upstream repo | |
| if: github.repository_owner == 'nipoppy' && github.event.repository.name == 'nipoppy' | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| submodules: recursive | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| allow-prereleases: true | |
| - name: Install package | |
| run: | | |
| pip install -U pip | |
| pip install .[tests,gui] | |
| - name: Run non-API tests | |
| run: | | |
| python -m pytest -m "not api and no_xdist" -n 0 --cov=nipoppy --cov-report=xml | |
| python -m pytest -m "not api and not no_xdist" --cov=nipoppy --cov-report=xml --cov-append | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: ./coverage.xml | |
| name: codecov-umbrella | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Run API tests | |
| if: (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && matrix.python-version == '3.14' | |
| run: | | |
| python -m pytest -m api | |
| env: | |
| ZENODO_TOKEN: ${{ secrets.ZENODO_TOKEN }} | |
| ZENODO_ID: ${{ vars.ZENODO_ID }} |