Skip to content

Commit 96abe5a

Browse files
authored
Merge pull request #1282 from effigies/ci/oidc-and-color
CI: FORCE_COLOR for readable tox/pytest outputs, use OIDC PyPI uploads
2 parents 07289b7 + 432407f commit 96abe5a

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ defaults:
2626
run:
2727
shell: bash
2828

29+
# Force tox and pytest to use color
30+
env:
31+
FORCE_COLOR: true
32+
2933
concurrency:
3034
group: ${{ github.workflow }}-${{ github.ref }}
3135
cancel-in-progress: true
@@ -195,13 +199,13 @@ jobs:
195199
runs-on: ubuntu-latest
196200
environment: "Package deployment"
197201
needs: [test, test-package]
202+
permissions:
203+
# Required for trusted publishing
204+
id-token: write
198205
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
199206
steps:
200207
- uses: actions/download-artifact@v3
201208
with:
202209
name: dist
203210
path: dist/
204211
- uses: pypa/gh-action-pypi-publish@release/v1
205-
with:
206-
user: __token__
207-
password: ${{ secrets.PYPI_API_TOKEN }}

nibabel/nifti1.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,9 +1637,7 @@ def set_slice_times(self, slice_times):
16371637
labels.remove('unknown')
16381638

16391639
matching_labels = [
1640-
label
1641-
for label in labels
1642-
if np.all(st_order == self._slice_time_order(label, n_timed))
1640+
label for label in labels if np.all(st_order == self._slice_time_order(label, n_timed))
16431641
]
16441642

16451643
if not matching_labels:

tox.ini

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ pass_env =
6363
USERNAME
6464
# Environment variables we check for
6565
NIPY_EXTRA_TESTS
66+
# Pass user color preferences through
67+
PY_COLORS
68+
FORCE_COLOR
69+
NO_COLOR
70+
CLICOLOR
71+
CLICOLOR_FORCE
6672
extras = test
6773
deps =
6874
# General minimum dependencies: pin based on API usage
@@ -139,8 +145,8 @@ deps =
139145
isort[colors]
140146
skip_install = true
141147
commands =
142-
blue --diff --color nibabel
143-
isort --diff --color nibabel
148+
blue --check --diff --color nibabel
149+
isort --check --diff --color nibabel
144150
flake8 nibabel
145151

146152
[testenv:style-fix]

0 commit comments

Comments
 (0)