-
Notifications
You must be signed in to change notification settings - Fork 141
315 lines (308 loc) · 12.4 KB
/
Copy pathrelease.yml
File metadata and controls
315 lines (308 loc) · 12.4 KB
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
name: Release PyPI Wheel
on:
push:
branches:
- main
tags:
- v*
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
release-macos:
name: release-macos (py${{ matrix.python-version }})
runs-on: macos-14
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
python-version: >-
${{ fromJSON(
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
&& '["3.12", "3.13", "3.14"]'
|| '["3.12"]'
) }}
env:
HOMEBREW_NO_AUTO_UPDATE: "1"
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/setup-go@v7
with:
go-version: "1.27"
- uses: actions/setup-java@v6
with:
distribution: temurin
java-version: "25"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install latest CMake
run: |
python -m pip install --upgrade cmake
CMAKE_BIN_DIR="$(python -c "import cmake; print(cmake.CMAKE_BIN_DIR)")"
CMAKE_BIN="$CMAKE_BIN_DIR/cmake"
echo "$CMAKE_BIN_DIR" >> "$GITHUB_PATH"
sudo ln -sfn "$CMAKE_BIN" /usr/local/bin/cmake
PATH="$CMAKE_BIN_DIR:$PATH" cmake --version
- name: Install macOS dependencies
run: |
brew install ninja swig qtbase
sudo ln -sfn "$(brew --prefix ninja)/bin/ninja" /usr/local/bin/ninja
echo "BAZEL_RULES_QT_DIR=$(brew --prefix qtbase)" >> "$GITHUB_ENV"
- name: Install bazelisk
run: |
go install github.com/bazelbuild/bazelisk@latest
echo "$HOME/go/bin" >> "$GITHUB_PATH"
- name: Build
run: |
rm -rf dist wheelhouse
make RELEASE_PYTHON=${{ matrix.python-version }} pypi-wheel
python -m pip install wheelhouse/*.whl --force-reinstall
- name: Test
run: |
make release-test
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: wheel-macos-${{ matrix.python-version }}
path: wheelhouse/
if-no-files-found: error
release-linux:
name: release-linux (${{ matrix.arch }}, py${{ matrix.python-version }})
runs-on: ${{ matrix.runner }}
container: ${{ matrix.container }}
timeout-minutes: 120
env:
BAZEL_RULES_QT_DIR: /opt/envpool-qt6
WHEEL_LICENSE_DIR: /opt/envpool-qt6/licenses/qt6
MUJOCO_GL: egl
EGL_PLATFORM: surfaceless
LIBGL_ALWAYS_SOFTWARE: "1"
MESA_LOADER_DRIVER_OVERRIDE: llvmpipe
GALLIUM_DRIVER: llvmpipe
strategy:
fail-fast: false
matrix:
include: >-
${{ fromJSON(
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
&& '[{"arch":"x86_64","runner":"ubuntu-24.04","container":"quay.io/pypa/manylinux_2_28_x86_64","auditwheel-plat":"manylinux_2_28_x86_64","python-version":"3.12"},{"arch":"x86_64","runner":"ubuntu-24.04","container":"quay.io/pypa/manylinux_2_28_x86_64","auditwheel-plat":"manylinux_2_28_x86_64","python-version":"3.13"},{"arch":"x86_64","runner":"ubuntu-24.04","container":"quay.io/pypa/manylinux_2_28_x86_64","auditwheel-plat":"manylinux_2_28_x86_64","python-version":"3.14"},{"arch":"aarch64","runner":"ubuntu-24.04-arm","container":"quay.io/pypa/manylinux_2_28_aarch64","auditwheel-plat":"manylinux_2_28_aarch64","python-version":"3.12"},{"arch":"aarch64","runner":"ubuntu-24.04-arm","container":"quay.io/pypa/manylinux_2_28_aarch64","auditwheel-plat":"manylinux_2_28_aarch64","python-version":"3.13"},{"arch":"aarch64","runner":"ubuntu-24.04-arm","container":"quay.io/pypa/manylinux_2_28_aarch64","auditwheel-plat":"manylinux_2_28_aarch64","python-version":"3.14"}]'
|| '[{"arch":"x86_64","runner":"ubuntu-24.04","container":"quay.io/pypa/manylinux_2_28_x86_64","auditwheel-plat":"manylinux_2_28_x86_64","python-version":"3.12"},{"arch":"aarch64","runner":"ubuntu-24.04-arm","container":"quay.io/pypa/manylinux_2_28_aarch64","auditwheel-plat":"manylinux_2_28_aarch64","python-version":"3.12"}]'
) }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version: "1.27"
- uses: actions/setup-java@v6
with:
distribution: temurin
java-version: "25"
- name: Install build dependencies
run: |
dnf install -y git curl wget zsh gcc gcc-c++ make tmux mesa-libEGL-devel mesa-libGL-devel libglvnd-devel mesa-dri-drivers
dnf clean all
go install github.com/bazelbuild/bazelisk@latest
ln -sf /root/go/bin/bazelisk /usr/local/bin/bazelisk
ln -sf /root/go/bin/bazelisk /usr/local/bin/bazel
- name: Set up Python ${{ matrix.python-version }}
shell: bash
run: |
case "${{ matrix.python-version }}" in
3.12) PYBIN=/opt/python/cp312-cp312/bin ;;
3.13) PYBIN=/opt/python/cp313-cp313/bin ;;
3.14) PYBIN=/opt/python/cp314-cp314/bin ;;
*) echo "unsupported python version: ${{ matrix.python-version }}" >&2; exit 1 ;;
esac
echo "$PYBIN" >> "$GITHUB_PATH"
"$PYBIN/python3" --version
- name: Install CMake and Ninja
shell: bash
run: |
python -m pip install --upgrade cmake ninja
CMAKE_BIN_DIR="$(python -c "import cmake; print(cmake.CMAKE_BIN_DIR)")"
CMAKE_BIN="$CMAKE_BIN_DIR/cmake"
echo "$CMAKE_BIN_DIR" >> "$GITHUB_PATH"
ln -sfn "$CMAKE_BIN" /usr/local/bin/cmake
PATH="$CMAKE_BIN_DIR:$PATH" cmake --version
ninja --version
- name: Cache Qt 6
id: qt-cache
uses: actions/cache@v6
with:
path: /opt/envpool-qt6
key: qt-manylinux_2_28-${{ matrix.arch }}-${{ hashFiles('third_party/qt/build_release.sh') }}
- name: Build Qt 6 from source
if: steps.qt-cache.outputs.cache-hit != 'true'
run: bash third_party/qt/build_release.sh "$BAZEL_RULES_QT_DIR"
- name: Prefer system libstdc++ for Mesa
shell: bash
run: |
echo "LD_PRELOAD=$(g++ -print-file-name=libstdc++.so.6)" >> "$GITHUB_ENV"
- name: Build
run: |
rm -rf dist wheelhouse
make PYPI_WHEEL_PLAT=${{ matrix.auditwheel-plat }} pypi-wheel
python -m pip install wheelhouse/*.whl --force-reinstall
- name: Test with only the bundled Qt runtime
shell: bash
run: |
mv "$BAZEL_RULES_QT_DIR" "${BAZEL_RULES_QT_DIR}-sdk-unused"
trap 'mv "${BAZEL_RULES_QT_DIR}-sdk-unused" "$BAZEL_RULES_QT_DIR"' EXIT
make PROCGEN_QT_RUNTIME=bundled release-test
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: wheel-linux-${{ matrix.arch }}-${{ matrix.python-version }}
path: wheelhouse/
if-no-files-found: error
release-windows:
name: release-windows (py${{ matrix.python-version }})
runs-on: windows-2022
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
python-version: >-
${{ fromJSON(
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
&& '["3.12", "3.13", "3.14"]'
|| '["3.12"]'
) }}
env:
BAZEL_SH: C:/Program Files/Git/usr/bin/bash.exe
MESA_GL_VERSION_OVERRIDE: 4.5COMPAT
MSYS2_ARG_CONV_EXCL: "*"
MSYS_NO_PATHCONV: "1"
USE_BAZEL_VERSION: "9.2.0"
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/setup-go@v7
with:
go-version: "1.27"
- uses: ilammy/msvc-dev-cmd@v1
- uses: actions/setup-java@v6
with:
distribution: temurin
java-version: "25"
- name: Shorten temp path
shell: pwsh
run: |
New-Item -ItemType Directory -Path C:\tmp -Force | Out-Null
Add-Content -Path $env:GITHUB_ENV -Value "TMP=C:\tmp"
Add-Content -Path $env:GITHUB_ENV -Value "TEMP=C:\tmp"
Add-Content -Path $env:GITHUB_ENV -Value "TMPDIR=C:\tmp"
- name: Install Windows dependencies
shell: pwsh
run: |
choco install -y cmake make ninja strawberryperl swig llvm
if (-not (Test-Path "C:\Program Files\LLVM\bin\llvm-strip.exe")) {
throw "llvm-strip.exe was not installed"
}
Add-Content -Path $env:GITHUB_PATH -Value "C:\Program Files\LLVM\bin"
- name: Create Mesa directory
shell: pwsh
run: |
New-Item -ItemType Directory -Path (Join-Path $env:GITHUB_WORKSPACE ".mesa") -Force | Out-Null
- name: Install Mesa software OpenGL
uses: f3d-app/install-mesa-windows-action@v3
with:
path: ${{ github.workspace }}\.mesa
- name: Export Mesa location
shell: pwsh
run: |
Add-Content -Path $env:GITHUB_ENV -Value "ENVPOOL_DLL_DIR=$env:GITHUB_WORKSPACE\.mesa"
Add-Content -Path $env:GITHUB_PATH -Value "$env:GITHUB_WORKSPACE\.mesa"
- name: Install Qt 6
uses: jurplel/install-qt-action@v4
with:
version: "6.11.1"
# Qt 6.11 repository layout support; not yet in an aqt release.
aqtsource: git+https://github.com/miurahr/aqtinstall.git@8c3695d4a4e1ceabf6a74dc6c79681656dc6b74b
py7zrversion: "==1.1.0"
arch: "win64_msvc2022_64"
set-env: "true"
- name: Export Qt location
shell: pwsh
run: |
Add-Content -Path $env:GITHUB_ENV -Value "BAZEL_RULES_QT_DIR=$env:QT_ROOT_DIR"
Add-Content -Path $env:GITHUB_PATH -Value (Join-Path $env:QT_ROOT_DIR "bin")
Add-Content -Path $env:GITHUB_PATH -Value "C:\Program Files\Git\usr\bin"
- name: Collect Qt licenses and notices
shell: bash
run: |
qt_prefix=$(cygpath -u "$QT_ROOT_DIR")
bash third_party/qt/build_release.sh --licenses-only "$qt_prefix"
echo "WHEEL_LICENSE_DIR=$(cygpath -m "$qt_prefix/licenses/qt6")" >> "$GITHUB_ENV"
- name: Install bazelisk
shell: pwsh
run: |
go install github.com/bazelbuild/bazelisk@latest
Add-Content -Path $env:GITHUB_PATH -Value (Join-Path $HOME "go/bin")
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install latest CMake
shell: pwsh
run: |
python -m pip install --upgrade cmake
$cmakeBinDir = python -c "import cmake; print(cmake.CMAKE_BIN_DIR)"
Add-Content -Path $env:GITHUB_PATH -Value $cmakeBinDir
& (Join-Path $cmakeBinDir "cmake.exe") --version
- name: Build
shell: bash
run: |
rm -rf dist wheelhouse
make RELEASE_PYTHON=${{ matrix.python-version }} pypi-wheel
python -m pip install wheelhouse/*.whl --force-reinstall
- name: Test
shell: bash
run: |
make release-test
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: wheel-windows-${{ matrix.python-version }}
path: wheelhouse/
if-no-files-found: error
publish:
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: [release-linux, release-macos, release-windows]
permissions:
actions: read
contents: write
steps:
- uses: actions/download-artifact@v8
with:
pattern: wheel-*
path: artifact
merge-multiple: true
- name: Move files so the next action can find them
run: |
mkdir dist && mv artifact/* dist/
ls dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true
- name: Create GitHub release and upload wheels
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1 || \
gh release create "${GITHUB_REF_NAME}" \
--title "${GITHUB_REF_NAME}" \
--generate-notes \
--verify-tag
gh release upload "${GITHUB_REF_NAME}" dist/*.whl --clobber