[MAINT] Improve test of cleaning in maskers (#5059) #86
This file contains 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
--- | |
# | |
# Most of this workflow is skipped if "[skip test]" is in the commit message. | |
name: test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- '*' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
# Force to use color | |
env: | |
FORCE_COLOR: true | |
jobs: | |
check_skip_flags: | |
name: Check skip flags | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Check head git commit message | |
run: | | |
headCommitMsg=$(git show -s --format=%s) | |
if [[ $headCommitMsg == *"[skip test]"* ]]; then | |
echo "skipping tests" | |
exit 1 | |
fi | |
test_and_coverage: | |
needs: check_skip_flags | |
if: github.repository == 'nilearn/nilearn' | |
name: 'Test with ${{ matrix.py }} on ${{ matrix.os }}: ${{ matrix.description }}' | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
description: [latest dependencies] | |
py: ['3.13', '3.12', '3.11', '3.10', '3.9'] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
env: [plotting] | |
include: | |
- description: pre-release dependencies | |
py: '3.13' | |
os: ubuntu-latest | |
env: pre | |
# Using macos on the following as tests run faster on macos. | |
# As 'no plotting' run fewer tests, this allows to fail event faster if using macos. | |
- description: oldest dependencies - no plotting | |
py: '3.9' | |
os: macos-latest | |
env: min | |
- description: oldest dependencies - no plotly | |
py: '3.9' | |
os: macos-latest | |
env: plot_min | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install the latest version of uv | |
uses: astral-sh/setup-uv@v5 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.py }} | |
allow-prereleases: true | |
- name: Install tox | |
run: uv tool install tox --with=tox-uv --with=tox-gh-actions | |
- name: Show tox config | |
run: tox c | |
- name: Run test suite | |
run: tox run --list-dependencies -e ${{ matrix.env }} -- nilearn | |
- name: Upload test report | |
if: success() || failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }}_${{ matrix.py }}_${{ matrix.description }}_report.html | |
path: report.html | |
- name: Upload coverage to CodeCov | |
uses: codecov/codecov-action@v5 | |
with: | |
flags: ${{ matrix.os }}_${{ matrix.py }}_${{ matrix.env }} | |
token: ${{ secrets.CODECOV_TOKEN }} | |
if: success() |