Skip to content

Commit bd76bec

Browse files
author
Sylvain MARIE
committed
Fixed GHA build and nox scripts following recipe from makefun. Fixed #352
1 parent 5a30ce2 commit bd76bec

File tree

5 files changed

+281
-935
lines changed

5 files changed

+281
-935
lines changed

.github/workflows/base.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636

3737
- name: List 'tests' nox sessions and required python versions
3838
id: set-matrix
39-
run: echo "::set-output name=matrix::$(nox -s gha_list -- -s tests -v)"
39+
run: echo "matrix=$(nox --json -l -s tests -v)" >> $GITHUB_OUTPUT
4040

4141
outputs:
4242
matrix: ${{ steps.set-matrix.outputs.matrix }} # save nox sessions list to outputs
@@ -60,14 +60,28 @@ jobs:
6060
uses: actions/[email protected]
6161

6262
- name: Install python ${{ matrix.nox_session.python }} for tests
63-
uses: MatteoH2O1999/[email protected] # actions/[email protected]
63+
# If one version fails, uncomment this one and the next step. For example here 3.13.
64+
if: ${{ ! contains(fromJson('["3.13"]'), matrix.nox_session.python ) }}
65+
uses: MatteoH2O1999/[email protected] # actions/[email protected]
6466
id: set-py
6567
with:
6668
python-version: ${{ matrix.nox_session.python }}
6769
architecture: x64
6870
allow-build: info
6971
cache-build: true
7072

73+
- name: Install python ${{ matrix.nox_session.python }} for tests (3.13)
74+
if: contains(fromJson('["3.13"]'), matrix.nox_session.python )
75+
uses: actions/setup-python@v5
76+
id: set-py-latest
77+
with:
78+
# Include all versions including pre releases
79+
# See https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#specifying-a-python-version
80+
python-version: ${{ format('~{0}.0-alpha.0', matrix.nox_session.python) }}
81+
architecture: x64
82+
allow-build: info
83+
cache-build: true
84+
7185
- name: Install python 3.12 for nox
7286
uses: actions/[email protected]
7387
with:
@@ -87,7 +101,7 @@ jobs:
87101

88102
# Share ./docs/reports so that they can be deployed with doc in next job
89103
- name: Share reports with other jobs
90-
# if: matrix.nox_session == '...': not needed, if empty won't be shared
104+
if: runner.os == 'Linux'
91105
uses: actions/[email protected]
92106
with:
93107
name: reports_dir
@@ -170,6 +184,9 @@ jobs:
170184
uses: codecov/[email protected]
171185
with:
172186
files: ./docs/reports/coverage/coverage.xml
187+
- name: \[not on TAG\] Build wheel and sdist
188+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads')
189+
run: nox -s build
173190

174191
# -------------- only on Ubuntu + TAG PUSH (no pull request) -----------
175192

@@ -181,7 +198,7 @@ jobs:
181198
# 8) Publish the wheel on PyPi
182199
- name: \[TAG only\] Deploy on PyPi
183200
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
184-
uses: pypa/gh-action-pypi-publish@v1.8.11
201+
uses: pypa/gh-action-pypi-publish@release/v1
185202
with:
186203
user: __token__
187204
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)