1- name : " schemacode_ci "
1+ name : bst
22
33on :
44 push :
@@ -21,6 +21,13 @@ defaults:
2121 run :
2222 shell : bash
2323
24+ # Force tox and pytest to use color
25+ env :
26+ FORCE_COLOR : true
27+
28+ permissions :
29+ contents : read
30+
2431jobs :
2532 build :
2633 name : Build & verify package
3744 if : ${{ startsWith(github.ref, 'refs/tags/schema-') }}
3845 - name : " Build archive on tag"
3946 run : |
40- uv run --extra =tests pytest -k make_archive
47+ uv run --group =tests pytest -k make_archive
4148 working-directory : tools/schemacode
4249 env :
4350 BIDSSCHEMATOOLS_RELEASE : 1
@@ -47,128 +54,112 @@ jobs:
4754 path : tools/schemacode
4855 attest-build-provenance-github : ${{ github.event_name != 'pull_request' }}
4956
50- test :
57+ tox :
5158 runs-on : ${{ matrix.os }}
52- needs : [build]
5359 strategy :
5460 fail-fast : false
5561 matrix :
56- os : ["ubuntu-latest"]
57- python-version : ["3.9", "3.10", "3.11", "3.12", "3.13"]
62+ os : [ubuntu-latest]
63+ python-version : ['3.10', '3.11', '3.12', '3.13', '3.14']
64+ dependencies : [latest]
5865 include :
5966 - os : macos-latest
60- python-version : 3.13
67+ python-version : ' 3.14'
68+ dependencies : latest
6169 - os : windows-latest
62- python-version : 3.13
63- name : ${{ matrix.os }} with Python ${{ matrix.python-version }}
70+ python-version : ' 3.14'
71+ dependencies : latest
72+ - os : ubuntu-latest
73+ python-version : ' 3.10'
74+ dependencies : min
6475 steps :
6576 - uses : actions/checkout@v6
77+ with :
78+ submodules : recursive
6679
6780 - name : Set up Python ${{ matrix.python-version }} (uv)
6881 uses : astral-sh/setup-uv@v7
6982 with :
7083 python-version : ${{ matrix.python-version }}
7184 activate-environment : true
7285
73- - name : " Display Python version"
86+ - name : Display Python version
7487 run : python -c "import sys; print(sys.version)"
7588
76- - name : " Fetch packages"
77- uses : actions/download-artifact@v7
78- with :
79- name : Packages
80- path : dist
89+ - name : Install tox
90+ run : uv tool install -v tox --with=tox-uv --with=tox-gh-actions
8191
82- - name : " Install package "
83- run : |
84- uv pip install $( ls dist/*.whl )[all]
92+ - name : Show tox config
93+ run : tox c
94+ working-directory : tools/schemacode
8595
86- - name : " Run tests"
87- run : |
88- python -m pytest -vs --doctest-modules -m "not validate_schema" \
89- --cov-append --cov-report=xml --cov-report=term --cov=src/bidsschematools
96+ - name : Setup test suite
97+ run : tox run -vv --notest
9098 working-directory : tools/schemacode
9199
92- - name : " Validate generated types"
93- run : |
94- uvx --with=. mypy tests
100+ - name : Run test suite
101+ run : tox -v --skip-pkg-install --exit-and-dump-after 1200
95102 working-directory : tools/schemacode
96103
97- - name : Upload artifacts
98- uses : actions/upload-artifact@v6
104+ - uses : codecov/codecov-action@v5
105+ if : ${{ always() }}
99106 with :
100- name : unit_${{ matrix.os }}_${{ matrix.python-version }}
101- path : tools/schemacode/coverage.xml
102- if : success()
107+ files : tools/schemacode/cov.xml
108+ token : ${{ secrets.CODECOV_TOKEN }}
109+
110+ - name : Upload pytest test results
111+ uses : actions/upload-artifact@v7
112+ with :
113+ name : pytest-results-${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.dependencies }}-${{ matrix.architecture }}
114+ path : tools/schemacode/test-results.xml
115+ if : ${{ always() }}
116+
117+ checks :
118+ runs-on : ' ubuntu-slim'
119+ continue-on-error : true
120+ strategy :
121+ matrix :
122+ check : ['typecheck']
123+
124+ steps :
125+ - uses : actions/checkout@v6
126+ - name : Setup uv and Python
127+ uses : astral-sh/setup-uv@v7
128+ with :
129+ python-version : 3
130+ activate-environment : true
131+ - name : Display Python version
132+ run : python -c "import sys; print(sys.version)"
133+ - name : Install tox
134+ run : uv tool install -v tox --with=tox-uv-bare --with=tox-gh-actions
135+ - name : Show tox config (this call)
136+ run : tox c -e ${{ matrix.check }}
137+ working-directory : tools/schemacode
138+ - name : Setup check environment
139+ run : tox -vv --notest -e ${{ matrix.check }}
140+ working-directory : tools/schemacode
141+ - name : Run check
142+ run : tox -e ${{ matrix.check }}
143+ working-directory : tools/schemacode
103144
104145 publish :
105- name : Publish Python Package
106- if : github.event_name == 'push'
107146 runs-on : ubuntu-latest
108- needs : [test]
147+ environment : " Package deployment"
148+ needs : [build, tox]
109149 permissions :
110150 attestations : write
111151 id-token : write
112-
152+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
113153 steps :
114- - name : Download packages built by build-and-inspect-python-package
115- uses : actions/download-artifact@v7
154+ - uses : actions/download-artifact@v7
116155 with :
117- name : Packages
118- path : dist
156+ name : dist
157+ path : dist/
119158 - name : " Test PyPI upload"
120159 uses : pypa/gh-action-pypi-publish@release/v1
121160 with :
122- user : __token__
123- password : ${{ secrets.TEST_PYPI_API_TOKEN }}
124161 repository-url : https://test.pypi.org/legacy/
125162 skip-existing : true
126163 - name : " Upload to PyPI (on tags)"
127164 if : startsWith(github.ref, 'refs/tags/schema-')
128165 uses : pypa/gh-action-pypi-publish@release/v1
129-
130- validate_schema :
131- runs-on : ubuntu-latest
132- name : Validate schema
133- steps :
134- - uses : actions/checkout@v6
135-
136- - name : Set Up Python environment
137- uses : actions/setup-python@v6
138- with :
139- python-version : " 3.11"
140-
141- - name : Install the schemacode package
142- run : |
143- python -m pip install --progress-bar off --upgrade pip setuptools wheel
144- python -m pip install -e ./tools/schemacode[all]
145-
146- - name : Run schema validation tests
147- run : |
148- python -m pytest -vs --doctest-modules -m "validate_schema" \
149- --cov-append --cov-report=xml --cov-report=term --cov=src/bidsschematools
150- working-directory : tools/schemacode
151-
152- - name : Upload artifacts
153- uses : actions/upload-artifact@v6
154- with :
155- name : schema_validation
156- path : tools/schemacode/coverage.xml
157- if : success()
158-
159- upload_to_codecov :
160- runs-on : " ubuntu-latest"
161- name : Upload coverage
162- needs : [test, validate_schema]
163- steps :
164- - name : Checkout
165- uses : actions/checkout@v6
166-
167- - name : Download artifacts
168- uses : actions/download-artifact@v7
169-
170- - name : Upload to CodeCov
171- uses : codecov/codecov-action@v5
172- with :
173- token : ${{ secrets.CODECOV_TOKEN }} # not required but might help API rate limits
174- fail_ci_if_error : true
0 commit comments