Skip to content

Commit 939cd7a

Browse files
committed
Cross compile
1 parent 3eee179 commit 939cd7a

File tree

1 file changed

+105
-102
lines changed

1 file changed

+105
-102
lines changed

.github/workflows/dist.yml

Lines changed: 105 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,12 @@ jobs:
8383
- uses: actions/checkout@v4
8484
with:
8585
fetch-depth: 0
86-
- uses: actions/setup-python@v5
86+
87+
- name: Install python
88+
if: matrix.os != 'ubuntu-22.04-arm'
89+
uses: actions/setup-python@v5
8790
with:
8891
python-version: '3.13'
89-
if: matrix.os != 'ubuntu-22.04-arm'
9092

9193
- name: Install deps
9294
shell: bash
@@ -121,12 +123,27 @@ jobs:
121123
- '3.11'
122124
- '3.12'
123125
- '3.13'
126+
include:
127+
- os: ubuntu-22.04-arm
128+
python_version: '3.11'
129+
container: python:3.11-bookworm
130+
- os: ubuntu-22.04-arm
131+
python_version: '3.12'
132+
container: python:3.12-bookworm
133+
- os: ubuntu-22.04-arm
134+
python_version: '3.13'
135+
container: python:3.13-bookworm
136+
137+
container: ${{ matrix.container }}
124138

125139
steps:
126140
- uses: actions/checkout@v4
127141
with:
128142
fetch-depth: 0
129-
- uses: actions/setup-python@v5
143+
144+
- name: Install python
145+
if: matrix.os != 'ubuntu-22.04-arm'
146+
uses: actions/setup-python@v5
130147
with:
131148
python-version: ${{ matrix.python_version }}
132149

@@ -135,6 +152,14 @@ jobs:
135152
name: "pypi-other-${{ runner.os }}-${{ runner.arch }}"
136153
path: dist-other
137154

155+
#
156+
# Platform specific setup
157+
#
158+
159+
- name: Install libgl
160+
run: apt-get update && apt-get install -y libgl1
161+
if: matrix.os == 'ubuntu-22.04-arm'
162+
138163
- name: Setup MSVC
139164
uses: bus1/cabuild/action/msdevshell@e22aba57d6e74891d059d66501b6b5aed8123c4d # v1
140165
with:
@@ -178,140 +203,118 @@ jobs:
178203
name: "pypi-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python_version }}"
179204
path: dist
180205

181-
build-arm:
182-
runs-on: ubuntu-22.04-arm
183-
needs: [setup_concurrency, build-other]
206+
#
207+
# Build roboRIO/raspbian wheels
208+
#
209+
210+
cross-other:
211+
runs-on: ubuntu-latest
212+
needs: [setup_concurrency]
184213
strategy:
185214
max-parallel: ${{ fromJSON(needs.setup_concurrency.outputs.max-parallel).v }}
186-
fail-fast: true
187215
matrix:
188-
python_version:
189-
- '3.11'
190-
- '3.12'
191-
- '3.13'
192-
container: python:${{ matrix.python_version }}-bookworm
216+
os:
217+
- container: wpilib/roborio-cross-ubuntu:2025-22.04-py313
218+
name: roborio
219+
- container: wpilib/raspbian-cross-ubuntu:2025-bookworm-22.04-py313
220+
name: raspbian
193221

194-
steps:
195-
- run: apt-get update && apt-get install -y libgl1
222+
container:
223+
image: "${{ matrix.os.container }}"
196224

225+
steps:
197226
- uses: actions/checkout@v4
198227
with:
199228
fetch-depth: 0
200-
201-
- uses: actions/download-artifact@v4
202-
with:
203-
name: "pypi-other-${{ runner.os }}-${{ runner.arch }}"
204-
path: dist-other
205-
206-
#
207-
# Setup build caching
208-
#
209-
210-
- name: Setup sccache
211-
uses: mozilla-actions/[email protected]
212-
213-
# See https://github.com/pypa/setuptools_scm/issues/784
214-
- name: Set git directory as safe to allow setuptools-scm to work
215-
shell: bash
216-
run: |
217-
/usr/bin/git config --global --add safe.directory $PWD
218229

219230
- name: Install deps
220231
shell: bash
221232
run: |
222-
python -m pip --disable-pip-version-check install -r rdev_requirements.txt
223-
224-
- name: Install numpy (needed for stubgen)
225-
shell: bash
226-
run: |
227-
python -m pip --disable-pip-version-check install numpy
233+
/build/venv/bin/cross-pip --disable-pip-version-check install -r rdev_requirements.txt
228234
229235
- name: Build + test wheels
230236
shell: bash
231237
run: |
232-
./rdev.sh ci build-meson-wheels
233-
env:
234-
SCCACHE_WEBDAV_USERNAME: ${{ secrets.WPI_ARTIFACTORY_USERNAME }}
235-
SCCACHE_WEBDAV_PASSWORD: ${{ secrets.WPI_ARTIFACTORY_TOKEN }}
238+
/build/venv/bin/cross-python -m devtools ci build-other-wheels
236239
237240
- uses: actions/upload-artifact@v4
238241
with:
239-
name: "pypi-${{ runner.os }}-${{ runner.arch }}-${{ matrix.python_version }}"
242+
name: cross-other-${{ matrix.os.name }}
240243
path: dist
241244

242-
#
243-
# Build roboRIO/raspbian wheels
244-
#
245-
246-
# cross-build:
247-
# runs-on: ubuntu-latest
248-
# needs: [setup_concurrency]
249-
# strategy:
250-
# max-parallel: ${{ fromJSON(needs.setup_concurrency.outputs.max-parallel).v }}
251-
# matrix:
252-
# os:
253-
# - container: wpilib/roborio-cross-ubuntu:2025-22.04-py313
254-
# name: roborio
255-
256-
# - container: wpilib/raspbian-cross-ubuntu:2025-bookworm-22.04-py311
257-
# name: raspbian-py311
258-
# - container: wpilib/raspbian-cross-ubuntu:2025-bookworm-22.04-py312
259-
# name: raspbian-py312
260-
# - container: wpilib/raspbian-cross-ubuntu:2025-bookworm-22.04-py313
261-
# name: raspbian-py313
262-
263-
# container:
264-
# image: "${{ matrix.os.container }}"
245+
cross-meson:
246+
runs-on: ubuntu-latest
247+
needs: [setup_concurrency, cross-other]
248+
strategy:
249+
max-parallel: ${{ fromJSON(needs.setup_concurrency.outputs.max-parallel).v }}
250+
matrix:
251+
os:
252+
- container: wpilib/roborio-cross-ubuntu:2025-22.04-py313
253+
name: roborio
254+
base: roborio
255+
256+
- container: wpilib/raspbian-cross-ubuntu:2025-bookworm-22.04-py311
257+
name: raspbian-py311
258+
base: raspbian
259+
- container: wpilib/raspbian-cross-ubuntu:2025-bookworm-22.04-py312
260+
name: raspbian-py312
261+
base: raspbian
262+
- container: wpilib/raspbian-cross-ubuntu:2025-bookworm-22.04-py313
263+
name: raspbian-py313
264+
base: raspbian
265+
266+
container:
267+
image: "${{ matrix.os.container }}"
265268

266-
# steps:
267-
# - uses: actions/checkout@v4
268-
# with:
269-
# fetch-depth: 0
269+
steps:
270+
- uses: actions/checkout@v4
271+
with:
272+
fetch-depth: 0
270273

271-
# - run: apt-get update
272-
# - name: Setup ccache
273-
# uses: hendrikmuhs/[email protected]
274-
# with:
275-
# key: ${{ matrix.os.container }}
276-
# variant: ccache
274+
- uses: actions/download-artifact@v4
275+
with:
276+
name: "cross-other-${{ matrix.os.base }}"
277+
path: dist-other
278+
279+
- name: Setup cross environment for meson
280+
uses: robotpy/build-actions/setup-cross-meson@semiwrap
277281

278-
# # See https://github.com/pypa/setuptools_scm/issues/784
279-
# - name: Set git directory as safe to allow setuptools-scm to work
280-
# shell: bash
281-
# run: |
282-
# pwd
283-
# /usr/bin/git config --global --add safe.directory $(pwd)
282+
- run: apt-get update
283+
- name: Setup ccache
284+
uses: hendrikmuhs/[email protected]
285+
with:
286+
key: ${{ matrix.os.container }}
287+
variant: ccache
284288

285-
# # See https://github.com/pallets/markupsafe/issues/475
286-
# - name: Install MarkupSafe
287-
# shell: bash
288-
# run: |
289-
# /build/venv/bin/cross-pip install --no-build-isolation "markupsafe; python_version < '3.12'"
289+
# See https://github.com/pallets/markupsafe/issues/475
290+
- name: Install MarkupSafe
291+
shell: bash
292+
run: |
293+
/build/venv/bin/cross-pip --disable-pip-version-check install --no-build-isolation "markupsafe; python_version < '3.12'"
290294
291-
# - name: Install deps
292-
# shell: bash
293-
# run: |
294-
# /build/venv/bin/cross-pip --disable-pip-version-check install -r rdev_requirements.txt
295+
- name: Install deps
296+
shell: bash
297+
run: |
298+
/build/venv/bin/cross-pip --disable-pip-version-check install -r rdev_requirements.txt
295299
296-
# - name: Build wheels
297-
# shell: bash
298-
# run: |
299-
# /build/venv/bin/cross-python -m devtools ci build-other-wheels --no-test
300-
# /build/venv/bin/cross-python -m devtools ci build-meson-wheels --no-test
300+
- name: Build wheels
301+
shell: bash
302+
run: |
303+
/build/venv/bin/cross-python -m devtools ci build-meson-wheels --no-test
301304
302305
303-
# - uses: actions/upload-artifact@v4
304-
# with:
305-
# name: cross-${{ matrix.os.name }}
306-
# path: dist
306+
- uses: actions/upload-artifact@v4
307+
with:
308+
name: cross-${{ matrix.os.name }}
309+
path: dist
307310

308311
# #
309312
# # Publish wheels to wpilib artifactory, pypi
310313
# #
311314

312315
# publish-rpyrepo:
313316
# runs-on: ubuntu-latest
314-
# needs: [check, build, build-arm, cross-build]
317+
# needs: [check, build, build-arm, cross-meson]
315318
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
316319

317320
# steps:
@@ -331,7 +334,7 @@ jobs:
331334

332335
# publish-pypi:
333336
# runs-on: ubuntu-latest
334-
# needs: [check, build-meson, build-arm, cross-build]
337+
# needs: [check, build-meson, build-arm, cross-meson]
335338
# permissions:
336339
# id-token: write
337340
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')

0 commit comments

Comments
 (0)