-
Notifications
You must be signed in to change notification settings - Fork 14
262 lines (222 loc) · 7.07 KB
/
dist.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
---
name: dist
on:
pull_request:
push:
branches:
- main
tags:
- '*'
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
# This job limits concurrency on the default branch
# - we want it to run so it can populate ccache, but we typically
# don't care about when it completes, so limit its concurrency
# to stop eating up valuable + slow Windows/macOS runners
setup_concurrency:
runs-on: ubuntu-latest
outputs:
max-parallel: ${{ steps.max-parallel.outputs.p }}
steps:
- name: Setup concurrency
shell: bash
id: max-parallel
run: |
if [[ "${{ github.ref_name }}" == "main" ]]; then
echo "PARALLEL=1"
echo "p={\"v\": 1}" >> $GITHUB_OUTPUT
else
echo "PARALLEL=10000"
echo "p={\"v\": 10000}" >> $GITHUB_OUTPUT
fi
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
#
# Build native wheels
#
build:
runs-on: ${{ matrix.os }}
needs: [setup_concurrency]
strategy:
max-parallel: ${{ fromJSON(needs.setup_concurrency.outputs.max-parallel).v }}
fail-fast: true
matrix:
os: ["ubuntu-22.04", "macos-12", "windows-2022"]
python_version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
steps:
- uses: actions/checkout@v4
with:
fetch-tags: true
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
- name: Set ccache variant
shell: bash
id: ccache
run: |
if [[ "${{ runner.os }}" == "Windows" ]]; then
echo "VARIANT=sccache" >> $GITHUB_OUTPUT
echo "RPYBUILD_CC_LAUNCHER=sccache" >> $GITHUB_ENV
else
echo "VARIANT=ccache" >> $GITHUB_OUTPUT
echo "RPYBUILD_CC_LAUNCHER=ccache" >> $GITHUB_ENV
fi
- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.os }}-${{ matrix.python_version }}
variant: ${{ steps.ccache.outputs.variant }}
- name: Set robotpy-build environment
shell: bash
run: |
echo "RPYBUILD_PARALLEL=1" >> $GITHUB_ENV
echo "RPYBUILD_STRIP_LIBPYTHON=1" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=11.7" >> $GITHUB_ENV
- name: Install deps
shell: bash
run: |
python -m pip --disable-pip-version-check install -r rdev_requirements.txt
- name: Build + test wheels
shell: bash
run: |
./rdev.sh ci run
- uses: actions/upload-artifact@v3
with:
name: "dist-${{ runner.os }}"
path: dist
#
# Build roboRIO/raspbian wheels
#
cross-build:
runs-on: ubuntu-latest
needs: [setup_concurrency]
strategy:
max-parallel: ${{ fromJSON(needs.setup_concurrency.outputs.max-parallel).v }}
matrix:
os:
- container: wpilib/roborio-cross-ubuntu:2024-22.04-py312
name: roborio
- container: wpilib/raspbian-cross-ubuntu:bullseye-22.04-py38
name: raspbian
- container: wpilib/raspbian-cross-ubuntu:bullseye-22.04-py39
name: raspbian
- container: wpilib/raspbian-cross-ubuntu:bullseye-22.04-py310
name: raspbian
- container: wpilib/raspbian-cross-ubuntu:bullseye-22.04-py311
name: raspbian
- container: wpilib/raspbian-cross-ubuntu:bullseye-22.04-py312
name: raspbian
- container: wpilib/aarch64-cross-ubuntu:bullseye-22.04-py38
name: raspbian
- container: wpilib/aarch64-cross-ubuntu:bullseye-22.04-py39
name: raspbian
- container: wpilib/aarch64-cross-ubuntu:bullseye-22.04-py310
name: raspbian
- container: wpilib/aarch64-cross-ubuntu:bullseye-22.04-py311
name: raspbian
- container: wpilib/aarch64-cross-ubuntu:bullseye-22.04-py312
name: raspbian
container:
image: "${{ matrix.os.container }}"
steps:
- uses: actions/checkout@v4
with:
fetch-tags: true
- name: Set ccache env
shell: bash
run: |
echo "RPYBUILD_CC_LAUNCHER=ccache" >> $GITHUB_ENV
- run: apt-get update
- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.os.container }}
variant: ccache
- name: Set robotpy-build environment
shell: bash
run: |
echo "RPYBUILD_PARALLEL=1" >> $GITHUB_ENV
echo "RPYBUILD_STRIP_LIBPYTHON=1" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=11.7" >> $GITHUB_ENV
- name: Install setuptools + wheel
run: |
/build/venv/bin/build-pip --disable-pip-version-check install -U "setuptools==63.4.3; python_version < '3.12'"
/build/venv/bin/build-pip --disable-pip-version-check install -U wheel==0.41.2
/build/venv/bin/cross-pip --disable-pip-version-check install -U "setuptools==63.4.3; python_version < '3.12'"
/build/venv/bin/cross-pip --disable-pip-version-check install -U wheel==0.41.2
# See https://github.com/pypa/setuptools_scm/issues/784
- name: Set git directory as safe to allow setuptools-scm to work
shell: bash
run: |
pwd
/usr/bin/git config --global --add safe.directory $(pwd)
- name: Install deps
shell: bash
run: |
/build/venv/bin/cross-pip --disable-pip-version-check install -r rdev_requirements.txt
- name: Build + test wheels
shell: bash
run: |
/build/venv/bin/cross-python -m devtools ci run
- uses: actions/upload-artifact@v3
with:
name: dist-${{ matrix.os.name }}
path: dist
#
# Publish wheels to wpilib artifactory, pypi
#
publish-rpyrepo:
runs-on: ubuntu-latest
needs: [check, build, cross-build]
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
steps:
- uses: actions/download-artifact@v3
with:
name: dist-roborio
path: dist/
- uses: actions/download-artifact@v3
with:
name: dist-raspbian
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
with:
verify-metadata: false
user: ${{ secrets.WPI_ARTIFACTORY_USERNAME }}
password: ${{ secrets.WPI_ARTIFACTORY_TOKEN }}
repository-url: https://wpilib.jfrog.io/artifactory/api/pypi/wpilib-python-release-2024-local
publish-pypi:
runs-on: ubuntu-latest
needs: [check, build, cross-build]
permissions:
id-token: write
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
steps:
- uses: actions/checkout@v4
with:
fetch-tags: true
- uses: actions/download-artifact@v3
with:
name: dist-Windows
path: dist/
- uses: actions/download-artifact@v3
with:
name: dist-macOS
path: dist/
- uses: actions/download-artifact@v3
with:
name: dist-Linux
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verify-metadata: false