Skip to content

Commit a9e547b

Browse files
committed
Update CI to support building for multiple target platforms
Signed-off-by: Sahas Subramanian <[email protected]>
1 parent c2c39d2 commit a9e547b

File tree

1 file changed

+74
-46
lines changed

1 file changed

+74
-46
lines changed

.github/workflows/ci.yaml

Lines changed: 74 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ on:
1515
- 'dependabot/**'
1616
workflow_dispatch:
1717

18+
permissions:
19+
contents: read
20+
1821
env:
1922
# Please make sure this version is included in the `matrix`, as the
2023
# `matrix` section can't use `env`, so it must be entered manually
@@ -28,30 +31,30 @@ jobs:
2831
strategy:
2932
fail-fast: false
3033
matrix:
31-
arch:
32-
- amd64
33-
- arm
34-
os:
35-
- ubuntu-24.04
34+
platform:
35+
- target: ubuntu-24.04
36+
- target: ubuntu-24.04-arm
37+
- target: windows-latest
38+
- target: macos-15-intel
39+
- target: macos-15
3640
python:
3741
- "3.11"
3842
- "3.12"
43+
- "3.13"
44+
- "3.14"
3945
nox-session:
4046
# To speed things up a bit we use the special ci_checks_max session
4147
# that uses the same venv to run multiple linting sessions
4248
- "ci_checks_max"
4349
- "pytest_min"
44-
runs-on: ${{ matrix.os }}${{ matrix.arch != 'amd64' && format('-{0}', matrix.arch) || '' }}
50+
runs-on: ${{ matrix.platform.target }}
4551

4652
steps:
4753
- name: Run nox
4854
uses: frequenz-floss/[email protected]
4955
with:
5056
python-version: ${{ matrix.python }}
5157
nox-session: ${{ matrix.nox-session }}
52-
# TODO(cookiecutter): Uncomment this for projects with private dependencies
53-
# git-username: ${{ secrets.GIT_USER }}
54-
# git-password: ${{ secrets.GIT_PASS }}
5558

5659
# This job runs if all the `nox` matrix jobs ran and succeeded.
5760
# It is only used to have a single job that we can require in branch
@@ -72,21 +75,27 @@ jobs:
7275

7376
build:
7477
name: Build distribution packages
75-
# Since this is a pure Python package, we only need to build it once. If it
76-
# had any architecture specific code, we would need to build it for each
77-
# architecture.
78-
runs-on: ubuntu-24.04
79-
78+
strategy:
79+
fail-fast: false
80+
matrix:
81+
platform:
82+
- target: ubuntu-24.04
83+
- target: ubuntu-24.04-arm
84+
- target: windows-latest
85+
- target: macos-15-intel
86+
- target: macos-15
87+
python:
88+
- "3.11"
89+
- "3.12"
90+
- "3.13"
91+
- "3.14"
92+
runs-on: ${{ matrix.platform.target }}
8093
steps:
8194
- name: Setup Git
8295
uses: frequenz-floss/[email protected]
83-
# TODO(cookiecutter): Uncomment this for projects with private dependencies
84-
# with:
85-
# username: ${{ secrets.GIT_USER }}
86-
# password: ${{ secrets.GIT_PASS }}
8796

8897
- name: Fetch sources
89-
uses: actions/checkout@v4
98+
uses: actions/checkout@v5
9099
with:
91100
submodules: true
92101

@@ -102,7 +111,7 @@ jobs:
102111
- name: Upload distribution files
103112
uses: actions/upload-artifact@v5
104113
with:
105-
name: dist-packages
114+
name: dist-packages-${{ matrix.platform.target }}-${{ matrix.python }}
106115
path: dist/
107116
if-no-files-found: error
108117

@@ -112,31 +121,30 @@ jobs:
112121
strategy:
113122
fail-fast: false
114123
matrix:
115-
arch:
116-
- amd64
117-
- arm
118-
os:
119-
- ubuntu-24.04
124+
platform:
125+
- target: ubuntu-24.04
126+
- target: ubuntu-24.04-arm
127+
- target: windows-latest
128+
- target: macos-15-intel
129+
- target: macos-15
120130
python:
121131
- "3.11"
122132
- "3.12"
123-
runs-on: ${{ matrix.os }}${{ matrix.arch != 'amd64' && format('-{0}', matrix.arch) || '' }}
133+
- "3.13"
134+
- "3.14"
135+
runs-on: ${{ matrix.target }}
124136

125137
steps:
126138
- name: Setup Git
127139
uses: frequenz-floss/[email protected]
128-
# TODO(cookiecutter): Uncomment this for projects with private dependencies
129-
# with:
130-
# username: ${{ secrets.GIT_USER }}
131-
# password: ${{ secrets.GIT_PASS }}
132140

133141
- name: Print environment (debug)
134142
run: env
135143

136144
- name: Download package
137-
uses: actions/download-artifact@v4
145+
uses: actions/download-artifact@v6
138146
with:
139-
name: dist-packages
147+
name: dist-packages-${{ matrix.platform.target }}-${{ matrix.python }}
140148
path: dist
141149

142150
# This is necessary for the `pip` caching in the setup-python action to work
@@ -186,13 +194,9 @@ jobs:
186194
steps:
187195
- name: Setup Git
188196
uses: frequenz-floss/[email protected]
189-
# TODO(cookiecutter): Uncomment this for projects with private dependencies
190-
# with:
191-
# username: ${{ secrets.GIT_USER }}
192-
# password: ${{ secrets.GIT_PASS }}
193197

194198
- name: Fetch sources
195-
uses: actions/checkout@v4
199+
uses: actions/checkout@v5
196200
with:
197201
submodules: true
198202

@@ -226,13 +230,9 @@ jobs:
226230
steps:
227231
- name: Setup Git
228232
uses: frequenz-floss/[email protected]
229-
# TODO(cookiecutter): Uncomment this for projects with private dependencies
230-
# with:
231-
# username: ${{ secrets.GIT_USER }}
232-
# password: ${{ secrets.GIT_PASS }}
233233

234234
- name: Fetch sources
235-
uses: actions/checkout@v4
235+
uses: actions/checkout@v5
236236
with:
237237
submodules: true
238238

@@ -295,12 +295,26 @@ jobs:
295295
# discussions to create the release announcement in the discussion forums
296296
contents: write
297297
discussions: write
298+
strategy:
299+
fail-fast: false
300+
matrix:
301+
platform:
302+
- target: ubuntu-24.04
303+
- target: ubuntu-24.04-arm
304+
- target: windows-latest
305+
- target: macos-15-intel
306+
- target: macos-15
307+
python:
308+
- "3.11"
309+
- "3.12"
310+
- "3.13"
311+
- "3.14"
298312
runs-on: ubuntu-24.04
299313
steps:
300314
- name: Download distribution files
301-
uses: actions/download-artifact@v4
315+
uses: actions/download-artifact@v6
302316
with:
303-
name: dist-packages
317+
name: dist-packages-${{ matrix.platform.target }}-${{ matrix.python }}
304318
path: dist
305319

306320
- name: Download RELEASE_NOTES.md
@@ -337,16 +351,30 @@ jobs:
337351
publish-to-pypi:
338352
name: Publish packages to PyPI
339353
needs: ["create-github-release"]
354+
strategy:
355+
fail-fast: false
356+
matrix:
357+
platform:
358+
- target: ubuntu-24.04
359+
- target: ubuntu-24.04-arm
360+
- target: windows-latest
361+
- target: macos-15-intel
362+
- target: macos-15
363+
python:
364+
- "3.11"
365+
- "3.12"
366+
- "3.13"
367+
- "3.14"
340368
runs-on: ubuntu-24.04
341369
permissions:
342370
# For trusted publishing. See:
343371
# https://blog.pypi.org/posts/2023-04-20-introducing-trusted-publishers/
344372
id-token: write
345373
steps:
346374
- name: Download distribution files
347-
uses: actions/download-artifact@v4
375+
uses: actions/download-artifact@v6
348376
with:
349-
name: dist-packages
377+
name: dist-packages-${{ matrix.platform.target }}-${{ matrix.python }}
350378
path: dist
351379

352380
- name: Publish the Python distribution to PyPI

0 commit comments

Comments
 (0)