-
Notifications
You must be signed in to change notification settings - Fork 2.3k
355 lines (313 loc) · 11.3 KB
/
release.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
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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
name: Publishing Release
on:
schedule:
- cron: '0 20 * * *' # GMT 20 == GMT+8 04
workflow_dispatch:
# Manually trigger the release workflow, a version must be provided
inputs:
version:
description: 'The version to release (e.g. v0.8.0), or leave it empty for nightly build'
type: string
required: false
env:
PROD_PWD: ${{ secrets.PYPI_PWD_PROD }}
NIGHT_PWD: ${{ secrets.TAICHI_PYPI_PWD }}
NIGHT_USERNAME: ${{ secrets.TAICHI_PYPI_USERNAME }}
METADATA_USERNAME: ${{ secrets.METADATA_USERNAME }}
METADATA_PASSWORD: ${{ secrets.METADATA_PASSWORD }}
METADATA_URL: ${{ secrets.METADATA_URL }}
RELEASE_VERSION: ${{ github.event.inputs.version }}
NIGHTLY: ${{ !github.event.inputs.version && '--nightly' || '' }}
CI_IMAGE_VERSION: '202311231829'
TI_CI: "1"
TI_SKIP_VERSION_CHECK: 'ON'
# TI_USE_GIT_CACHE: ${{ vars.TI_USE_GIT_CACHE }}
TI_USE_GIT_CACHE: '1' # variables are also not populated on forked PRs
jobs:
add_version_to_database:
name: Add version to database
# Skip running release workflow on forks
if: github.repository_owner == 'taichi-dev'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Save new version
run: |
if [ -z "$RELEASE_VERSION" ]; then
echo "Not a production release"
exit 0
fi
python3 -m pip install requests==2.26
python3 misc/save_new_version.py
# This job set environment matrix with respect to production release and nightly release.
matrix_prep:
runs-on: ubuntu-latest
needs: add_version_to_database
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
matrix_osx: ${{ steps.set-matrix.outputs.matrix_osx }}
steps:
- id: set-matrix
run: |
if [ -n "$RELEASE_VERSION" ]; then
# For production release, we run on five python versions.
echo 'matrix={"include":[{"name":"taichi","python":"3.7"},{"name":"taichi","python":"3.8"},{"name":"taichi","python":"3.9"},{"name":"taichi","python":"3.10"},{"name":"taichi","python":"3.11"},{"name":"taichi","python":"3.12"}]}"' >> $GITHUB_OUTPUT
# M1 only supports 3.8, 3.9, and 3.10(conda), so change matrix.
echo 'matrix_osx={"include":[{"name":"taichi","python":"3.8"},{"name":"taichi","python":"3.9"},{"name":"taichi","python":"3.10"},{"name":"taichi","python":"3.11"},{"name":"taichi","python":"3.12"}]}"' >> $GITHUB_OUTPUT
else
# For nightly release, we run on three python versions.
echo 'matrix={"include":[{"name":"taichi-nightly","python":"3.7"},{"name":"taichi-nightly","python":"3.8"},{"name":"taichi-nightly","python":"3.9"},{"name":"taichi-nightly","python":"3.10"},{"name":"taichi-nightly","python":"3.11"},{"name":"taichi","python":"3.12"}]}"' >> $GITHUB_OUTPUT
# M1 only supports 3.8 and 3.10(conda), so change matrix.
echo 'matrix_osx={"include":[{"name":"taichi-nightly","python":"3.8"},{"name":"taichi-nightly","python":"3.9"},{"name":"taichi-nightly","python":"3.10"},{"name":"taichi-nightly","python":"3.11"},{"name":"taichi","python":"3.12"}]}"' >> $GITHUB_OUTPUT
fi
build_and_test_linux:
name: Build and Upload (linux only)
needs: matrix_prep
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix_prep.outputs.matrix) }}
runs-on: [self-hosted, cuda, vulkan, cn, release, sm70]
env:
PY: ${{ matrix.python }}
PROJECT_NAME: ${{ matrix.name }}
TAICHI_CMAKE_ARGS: >-
-DTI_WITH_OPENGL:BOOL=ON
-DTI_WITH_VULKAN:BOOL=ON
-DTI_BUILD_TESTS:BOOL=ON
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
fetch-depth: '0'
- name: Prepare Environment
run: |
. .github/workflows/scripts/common-utils.sh
prepare-build-cache
echo CI_DOCKER_RUN_EXTRA_ARGS="-v $(pwd):/home/dev/taichi" >> $GITHUB_ENV
- name: Build
run: |
. .github/workflows/scripts/common-utils.sh
ci-docker-run-gpu --name taichi-build \
registry.botmaster.tgr/taichi-build-cuda:${{ env.CI_IMAGE_VERSION }} \
/home/dev/taichi/.github/workflows/scripts/build.py $NIGHTLY
- name: Archive Wheel Artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/*.whl
retention-days: 20
- name: Test
run: |
. .github/workflows/scripts/common-utils.sh
ci-docker-run-gpu --name taichi-test \
registry.botmaster.tgr/taichi-test-cuda:${{ env.CI_IMAGE_VERSION }} \
/home/dev/taichi/.github/workflows/scripts/unix_test.sh
env:
PY: ${{ matrix.python }}
build_and_test_mac:
name: Build and Upload (macOS only)
needs: matrix_prep
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix_prep.outputs.matrix_osx) }}
runs-on: [self-hosted, macos-11]
env:
PY: ${{ matrix.python }}
CXX: clang++
TAICHI_CMAKE_ARGS: >-
-DTI_WITH_VULKAN:BOOL=ON
-DTI_WITH_OPENGL:BOOL=OFF
-DTI_BUILD_TESTS:BOOL=ON
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
fetch-depth: '0'
- name: Prepare Environment
run: |
. .github/workflows/scripts/common-utils.sh
prepare-build-cache
- name: Create Python Wheel
run: |
# Use the molten-vk v1.1.10 downloaded from taichi assets
brew uninstall molten-vk -f
.github/workflows/scripts/build.py $NIGHTLY
env:
PROJECT_NAME: ${{ matrix.name }}
- name: Archive Wheel Artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/*.whl
retention-days: 20
- name: Test
run: .github/workflows/scripts/unix_test.sh
env:
TI_WANTED_ARCHS: 'cpu'
TI_SKIP_CPP_TESTS: Disabled because Vulkan is supported but not working on buildbot4
build_and_test_m1:
name: Build and Upload (Apple M1)
needs: matrix_prep
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix_prep.outputs.matrix_osx) }}
runs-on: [self-hosted, m1, release]
defaults:
run:
shell: '/usr/bin/arch -arch arm64e /bin/bash --noprofile --norc -eo pipefail {0}'
env:
PY: ${{ matrix.python }}
CXX: clang++
PROJECT_NAME: ${{ matrix.name }}
TAICHI_CMAKE_ARGS: >-
-DTI_WITH_OPENGL:BOOL=OFF
-DTI_WITH_CUDA:BOOL=OFF
-DTI_WITH_VULKAN:BOOL=ON
-DTI_BUILD_TESTS:BOOL=ON
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
fetch-depth: '0'
- name: Prepare Environment
run: |
. .github/workflows/scripts/common-utils.sh
prepare-build-cache
- name: Build
run: |
brew install molten-vk
.github/workflows/scripts/build.py $NIGHTLY
- name: Archive Wheel Artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/*.whl
retention-days: 20
- name: Test
run: |
.github/workflows/scripts/unix_test.sh
env:
TI_WANTED_ARCHS: 'metal,vulkan,cpu'
PY: ${{ matrix.python }}
GPU_TEST: ON
build_and_test_windows:
name: Build and Upload (Windows only)
needs: matrix_prep
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix_prep.outputs.matrix) }}
# FIXME: force running on sm70 for now. Should be refactored out
runs-on: [self-hosted, windows, cuda, OpenGL, sm70]
env:
PY: ${{ matrix.python }}
PROJECT_NAME: ${{ matrix.name }}
TAICHI_CMAKE_ARGS: >-
-DTI_WITH_OPENGL:BOOL=ON
-DTI_WITH_VULKAN:BOOL=ON
-DTI_WITH_DX11:BOOL=ON
-DTI_WITH_DX12:BOOL=ON
-DTI_BUILD_TESTS:BOOL=ON
-DTI_WITH_C_API=ON
steps:
- name: Workaround checkout Needed single revision issue
run: |
git config --system core.longpaths true
git submodule foreach 'git rev-parse HEAD > /dev/null 2>&1 || rm -rf $PWD'
- uses: actions/checkout@v3
with:
submodules: 'recursive'
fetch-depth: '0'
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Build
shell: pwsh
run: |
$nightlyFlag = $null
if ($env:NIGHTLY) { $nightlyFlag = "--nightly" }
python .\.github\workflows\scripts\build.py $nightlyFlag
- name: Archive Wheel Artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/*.whl
retention-days: 20
- name: Test
shell: pwsh
run: |
.\.github\workflows\scripts\win_test.ps1
env:
PY: ${{ matrix.python }}
TI_WANTED_ARCHS: "cpu,cuda,opengl,vulkan"
TI_SKIP_VERSION_CHECK: ON
- name: Cleanup Git Cache Configs
shell: pwsh
if: always()
run: |
. .github/workflows/scripts/common-utils.ps1
UnsetGitCachingProxy
exit 0
upload_to_pypi:
name: Upload release to PyPI
needs: [build_and_test_linux, build_and_test_mac, build_and_test_m1, build_and_test_windows]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Get dist files
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Upload to PyPI
run: |
set -ex
ls -l dist/
if [ -z "$RELEASE_VERSION" ]; then
export PROJECT_NAME="taichi-nightly"
else
export PROJECT_NAME="taichi"
VER=$(echo $RELEASE_VERSION | sed 's/^v//')
if [ $(ls dist/taichi-$VER-*.whl | wc -l) != $(ls dist/*.whl | wc -l) ]; then
echo Version number mismatch
exit 1
fi
pip install -f dist taichi==$VER
if ! python -c 'import taichi' | grep "^.Taichi. version $VER,"; then
echo Taichi init version number mismatch!!
exit 1
fi
fi
python -m pip install requests twine
python misc/upload_release.py
create_release:
name: Create tag and publish release
needs: upload_to_pypi
runs-on: ubuntu-latest
if: ${{ github.event.inputs.version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Generate Changelog
id: changelog
run: |
pip3 install gitpython
python3 misc/make_changelog.py > CHANGELOG.md
cat CHANGELOG.md
- name: Create tag
run: |
git config user.email "[email protected]"
git config user.name "Taichi Gardener"
git tag -a ${RELEASE_VERSION} -m "Release ${RELEASE_VERSION}"
git push origin --tags
- name: Publish release
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG.md
tag_name: ${{ github.event.inputs.version }}