Skip to content

Commit 36c2eae

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

File tree

1 file changed

+38
-40
lines changed

1 file changed

+38
-40
lines changed

.github/workflows/ci.yaml

Lines changed: 38 additions & 40 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:
34+
target:
3535
- ubuntu-24.04
36+
- ubuntu-24.04-arm
37+
- windows-latest
38+
- macos-15-intel
39+
- 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.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,18 +75,24 @@ 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+
target:
82+
- ubuntu-24.04
83+
- ubuntu-24.04-arm
84+
- windows-latest
85+
- macos-15-intel
86+
- macos-15
87+
python:
88+
- "3.11"
89+
- "3.12"
90+
- "3.13"
91+
- "3.14"
92+
runs-on: ${{ matrix.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
8998
uses: actions/checkout@v5
@@ -93,7 +102,7 @@ jobs:
93102
- name: Setup Python
94103
uses: frequenz-floss/[email protected]
95104
with:
96-
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
105+
python-version: ${{ matrix.python }}
97106
dependencies: build
98107

99108
- name: Build the source and binary distribution
@@ -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.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
137145
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,10 +194,6 @@ 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
195199
uses: actions/checkout@v5
@@ -226,10 +230,6 @@ 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
235235
uses: actions/checkout@v5
@@ -300,7 +300,6 @@ jobs:
300300
- name: Download distribution files
301301
uses: actions/download-artifact@v6
302302
with:
303-
name: dist-packages
304303
path: dist
305304

306305
- name: Download RELEASE_NOTES.md
@@ -346,7 +345,6 @@ jobs:
346345
- name: Download distribution files
347346
uses: actions/download-artifact@v6
348347
with:
349-
name: dist-packages
350348
path: dist
351349

352350
- name: Publish the Python distribution to PyPI

0 commit comments

Comments
 (0)