Skip to content

Commit 1f7836d

Browse files
authored
Merge pull request #1262 from effigies/mnt/tox
MNT: Resurrect tox config to cover dev workflows and CI checks
2 parents 0e03b94 + a0dc67e commit 1f7836d

19 files changed

+350
-454
lines changed

.github/workflows/misc.yml

Lines changed: 0 additions & 67 deletions
This file was deleted.

.github/workflows/pre-release.yml

Lines changed: 0 additions & 102 deletions
This file was deleted.

.github/workflows/stable.yml renamed to .github/workflows/test.yml

Lines changed: 50 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Stable tests
1+
name: Build and test
22

33
# This file tests the claimed support range of NiBabel including
44
#
@@ -35,7 +35,7 @@ jobs:
3535
build:
3636
runs-on: ubuntu-latest
3737
steps:
38-
- uses: actions/checkout@v3
38+
- uses: actions/checkout@v4
3939
with:
4040
fetch-depth: 0
4141
- uses: actions/setup-python@v4
@@ -94,70 +94,45 @@ jobs:
9494
if: matrix.package == 'archive'
9595
run: pip install archive/nibabel-archive.tgz
9696
- run: python -c 'import nibabel; print(nibabel.__version__)'
97-
- name: Install test extras
97+
- name: Install minimum test dependencies
9898
run: pip install nibabel[test]
9999
- name: Run tests
100-
run: pytest --doctest-modules --doctest-plus -v --pyargs nibabel
100+
run: pytest --doctest-modules --doctest-plus -v --pyargs nibabel -n auto
101101

102-
stable:
102+
test:
103103
# Check each OS, all supported Python, minimum versions and latest releases
104104
runs-on: ${{ matrix.os }}
105+
continue-on-error: ${{ matrix.dependencies == 'pre' }}
105106
strategy:
107+
fail-fast: false
106108
matrix:
107109
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
108-
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
110+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
109111
architecture: ['x64', 'x86']
110-
install: ['pip']
111-
check: ['test']
112-
pip-flags: ['']
113-
depends: ['REQUIREMENTS']
114-
optional-depends: ['DEFAULT_OPT_DEPENDS']
112+
dependencies: ['full', 'pre']
115113
include:
116114
# Basic dependencies only
117115
- os: ubuntu-latest
118116
python-version: 3.8
119-
install: pip
120-
check: test
121-
pip-flags: ''
122-
depends: REQUIREMENTS
123-
optional-depends: ''
117+
dependencies: 'none'
124118
# Absolute minimum dependencies
125119
- os: ubuntu-latest
126120
python-version: 3.8
127-
install: pip
128-
check: test
129-
pip-flags: ''
130-
depends: MIN_REQUIREMENTS
131-
optional-depends: ''
132-
# Absolute minimum dependencies plus old MPL, Pydicom, Pillow
133-
- os: ubuntu-latest
134-
python-version: 3.8
135-
install: pip
136-
check: test
137-
pip-flags: ''
138-
depends: MIN_REQUIREMENTS
139-
optional-depends: MIN_OPT_DEPENDS
140-
# Clean install imports only with package-declared dependencies
141-
- os: ubuntu-latest
142-
python-version: 3.8
143-
install: pip
144-
check: skiptests
145-
pip-flags: ''
146-
depends: ''
121+
dependencies: 'min'
147122
exclude:
148123
- os: ubuntu-latest
149124
architecture: x86
150125
- os: macos-latest
151126
architecture: x86
127+
- python-version: '3.12'
128+
architecture: x86
129+
152130
env:
153-
DEPENDS: ${{ matrix.depends }}
154-
OPTIONAL_DEPENDS: ${{ matrix.optional-depends }}
155-
INSTALL_TYPE: ${{ matrix.install }}
156-
CHECK_TYPE: ${{ matrix.check }}
157-
EXTRA_PIP_FLAGS: ${{ matrix.pip-flags }}
131+
DEPENDS: ${{ matrix.dependencies }}
132+
ARCH: ${{ !contains(fromJSON('["none", "min"]'), matrix.dependencies) && matrix.architecture }}
158133

159134
steps:
160-
- uses: actions/checkout@v3
135+
- uses: actions/checkout@v4
161136
with:
162137
submodules: recursive
163138
fetch-depth: 0
@@ -166,36 +141,54 @@ jobs:
166141
with:
167142
python-version: ${{ matrix.python-version }}
168143
architecture: ${{ matrix.architecture }}
144+
allow-prereleases: true
169145
- name: Display Python version
170146
run: python -c "import sys; print(sys.version)"
171-
- name: Create virtual environment
172-
run: tools/ci/create_venv.sh
173-
- name: Build archive
147+
- name: Install tox
174148
run: |
175-
source tools/ci/build_archive.sh
176-
echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV
177-
- name: Install dependencies
178-
run: tools/ci/install_dependencies.sh
179-
- name: Install NiBabel
180-
run: tools/ci/install.sh
181-
- name: Run tests
182-
if: ${{ matrix.check != 'skiptests' }}
183-
run: tools/ci/check.sh
149+
python -m pip install --upgrade pip
150+
python -m pip install tox tox-gh-actions
151+
- name: Show tox config
152+
run: tox c
153+
- name: Run tox
154+
run: tox -v --exit-and-dump-after 1200
184155
- uses: codecov/codecov-action@v3
185156
if: ${{ always() }}
186157
with:
187158
files: cov.xml
188159
- name: Upload pytest test results
189-
if: ${{ always() && matrix.check == 'test' }}
190160
uses: actions/upload-artifact@v3
191161
with:
192162
name: pytest-results-${{ matrix.os }}-${{ matrix.python-version }}
193-
path: for_testing/test-results.xml
163+
path: test-results.xml
164+
if: ${{ always() }}
165+
166+
checks:
167+
runs-on: 'ubuntu-latest'
168+
continue-on-error: true
169+
strategy:
170+
matrix:
171+
check: ['style', 'doctest', 'typecheck']
172+
173+
steps:
174+
- uses: actions/checkout@v4
175+
- name: Set up Python ${{ matrix.python-version }}
176+
uses: actions/setup-python@v4
177+
with:
178+
python-version: 3
179+
- name: Display Python version
180+
run: python -c "import sys; print(sys.version)"
181+
- name: Show tox config
182+
run: pipx run tox c
183+
- name: Show tox config (this call)
184+
run: pipx run tox c -e ${{ matrix.check }}
185+
- name: Run check
186+
run: pipx run tox -e ${{ matrix.check }}
194187

195188
publish:
196189
runs-on: ubuntu-latest
197190
environment: "Package deployment"
198-
needs: [stable, test-package]
191+
needs: [test, test-package]
199192
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
200193
steps:
201194
- uses: actions/download-artifact@v3

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ dist/
4848
*.egg-info/
4949
.shelf
5050
.tox/
51-
.coverage
51+
.coverage*
52+
cov.xml
53+
test-results.xml
5254
.ropeproject/
5355
htmlcov/
5456
.*_cache/

0 commit comments

Comments
 (0)