forked from taichi-dev/taichi
-
Notifications
You must be signed in to change notification settings - Fork 0
342 lines (315 loc) · 11.6 KB
/
presubmit.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
name: Presubmit Checks
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master
jobs:
title_format:
name: Check PR Title
if: ${{ github.event.pull_request }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Run PR Title Checker
run: |
pip install semver GitPython
python misc/ci_check_pr_title.py "$PR_TITLE"
env:
PR_TITLE: ${{ github.event.pull_request.title }}
check_code_format:
name: Check Code Format
runs-on: ubuntu-latest
# This job will be required to pass before merging to master branch.
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Check code format
run: |
git config user.email "[email protected]"
git config user.name "Taichi Gardener"
git checkout -b _fake_squash
git remote add upstream https://github.com/taichi-dev/taichi.git
git fetch upstream master
sudo apt install clang-format-10
python3 -m pip install --user yapf==0.31.0 gitpython colorama isort
python3 python/taichi/code_format.py
git checkout -b _enforced_format
git commit -am "enforce code format" || true
# exit with 1 if there were differences:
git diff _fake_squash _enforced_format --exit-code
build_and_test_cpu_required:
# This job will be required to pass before merging to master branch.
name: Required Build and Test (CPU)
needs: check_code_format
timeout-minutes: 60
strategy:
matrix:
include:
- os: ubuntu-latest
python: 3.6
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Download Pre-Built LLVM 10.0.0
run: |
python misc/ci_download.py
mkdir taichi-llvm
cd taichi-llvm
unzip ../taichi-llvm.zip
env:
CI_PLATFORM: ${{ matrix.os }}
- name: Build & Install
run: |
TAICHI_REPO_DIR=`pwd`
export PATH=$TAICHI_REPO_DIR/taichi-llvm/bin/:$PATH
export CXX=clang++
python -m pip install -r requirements_dev.txt
cd python
git fetch origin master
TAICHI_CMAKE_ARGS=$CI_SETUP_CMAKE_ARGS python build.py build
cd ..
export NUM_WHL=`ls dist/*.whl | wc -l`
if [ $NUM_WHL -ne 1 ]; then echo 'ERROR: created more than 1 whl.' && exit 1; fi
pip install dist/*.whl
env:
CI_SETUP_CMAKE_ARGS: -DTI_WITH_OPENGL:BOOL=OFF -DTI_WITH_CC:BOOL=ON -DTI_WITH_VULKAN:BOOL=OFF -DTI_BUILD_TESTS:BOOL=ON
- name: Test
run: |
TAICHI_REPO_DIR=`pwd`
export PATH=$TAICHI_REPO_DIR/taichi-llvm/bin/:$PATH
# Note we only need this since we cannot write into system python package.
export PATH=$PATH:$HOME/.local/bin
hash -r
python examples/algorithm/laplace.py
ti diagnose
ti changelog
# taichi_cpp_tests requires passing in TI_LIB_DIR manually.
TI_LIB_DIR=`python -c "import taichi;print(taichi.__path__[0])" | tail -1`
TI_LIB_DIR="$TI_LIB_DIR/lib" ./build/taichi_cpp_tests
ti test -vr2 -t2
build_and_test_cpu:
name: Build and Test (CPU)
needs: build_and_test_cpu_required
timeout-minutes: 60
strategy:
matrix:
include:
- os: macos-latest
python: 3.7
with_cc: OFF
with_cpp_tests: ON
- os: ubuntu-latest
python: 3.9
with_cc: OFF
with_cpp_tests: OFF
- os: ubuntu-latest
python: 3.8
with_cc: ON
with_cpp_tests: OFF
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Download Pre-Built LLVM 10.0.0
run: |
python misc/ci_download.py
mkdir taichi-llvm
cd taichi-llvm
unzip ../taichi-llvm.zip
env:
CI_PLATFORM: ${{ matrix.os }}
- name: Build & Install
run: |
TAICHI_REPO_DIR=`pwd`
export PATH=$TAICHI_REPO_DIR/taichi-llvm/bin/:$PATH
export CXX=clang++
python -m pip install -r requirements_dev.txt
cd python
git fetch origin master
TAICHI_CMAKE_ARGS=$CI_SETUP_CMAKE_ARGS python build.py build
cd ..
NUM_WHL=`ls dist/*.whl | wc -l`
if [ $NUM_WHL -ne 1 ]; then echo 'ERROR: created more than 1 whl.' && exit 1; fi
pip install dist/*.whl
env:
CI_SETUP_CMAKE_ARGS: -DTI_WITH_OPENGL:BOOL=OFF -DTI_WITH_CC:BOOL=${{ matrix.with_cc }} -DTI_WITH_VULKAN:BOOL=OFF -DTI_BUILD_TESTS:BOOL=${{ matrix.with_cpp_tests }}
# [DEBUG] Copy this step around to enable debugging inside Github Action instances.
#- name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true
- name: Test
run: |
TAICHI_REPO_DIR=`pwd`
export PATH=$TAICHI_REPO_DIR/taichi-llvm/bin/:$PATH
export PATH=$PATH:$HOME/.local/bin
hash -r
python examples/algorithm/laplace.py
ti diagnose
ti changelog
# taichi_cpp_tests requires passing in TI_LIB_DIR manually.
TI_LIB_DIR=`python -c "import taichi;print(taichi.__path__[0])" | tail -1`
[ "$RUN_CPP_TESTS" = "ON" ] && TI_LIB_DIR="$TI_LIB_DIR/lib" ./build/taichi_cpp_tests
ti test -vr2 -t2
env:
RUN_CPP_TESTS: ${{ matrix.with_cpp_tests }}
build_and_test_gpu_linux:
name: Build and Test (GPU)
needs: check_code_format
runs-on: [self-hosted, cuda, vulkan, cn]
timeout-minutes: 60
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Build
run: |
git --version
export PATH=$LLVM_LIB_ROOT_DIR/bin:/usr/local/cuda/bin:$PATH
export LLVM_DIR=$LLVM_LIB_ROOT_DIR/lib/cmake/llvm
export CXX=clang++-8
export PYTHON=/usr/bin/python3
$PYTHON -m pip uninstall taichi -y
$PYTHON -m pip install -r requirements_dev.txt
cd python
git fetch origin master
TAICHI_CMAKE_ARGS=$CI_SETUP_CMAKE_ARGS $PYTHON build.py build
cd ..
export NUM_WHL=`ls dist/*.whl | wc -l`
if [ $NUM_WHL -ne 1 ]; then echo 'ERROR: created more than 1 whl.' && exit 1; fi
$PYTHON -m pip install dist/*.whl
env:
LLVM_LIB_ROOT_DIR: /opt/taichi-llvm-10.0.0
CI_SETUP_CMAKE_ARGS: -DTI_WITH_OPENGL:BOOL=ON -DTI_WITH_CC:BOOL=OFF -DTI_WITH_VULKAN:BOOL=ON
BUILD_NUM_THREADS: 8
- name: Test
run: |
export PYTHON=/usr/bin/python3
export PATH=$PATH:$HOME/.local/bin
export DISPLAY=:1
hash -r
glewinfo
$PYTHON examples/algorithm/laplace.py
ti diagnose
ti changelog
ti test -vr2 -t2 -k "not ndarray"
ti test -vr2 -t1 -k "ndarray"
build_and_test_windows:
name: Build and Test (Windows)
needs: check_code_format
runs-on: windows-latest
timeout-minutes: 60
steps:
- name: Install 7Zip PowerShell
shell: powershell
run: Install-Module 7Zip4PowerShell -Force -Verbose
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Add msbuild to PATH
uses: microsoft/[email protected]
- name: Download And Install Vulkan
shell: powershell
run: |
Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/1.2.189.0/windows/VulkanSDK-1.2.189.0-Installer.exe" -OutFile VulkanSDK.exe
$installer = Start-Process -FilePath VulkanSDK.exe -Wait -PassThru -ArgumentList @("/S");
$installer.WaitForExit();
- name: Build
shell: powershell
run: |
$env:Path += ";C:/VulkanSDK/1.2.189.0/Bin"
cd C:\
Remove-item alias:curl
curl --retry 10 --retry-delay 5 https://github.com/taichi-dev/taichi_assets/releases/download/llvm10/taichi-llvm-10.0.0-msvc2019.zip -LO
7z x taichi-llvm-10.0.0-msvc2019.zip -otaichi_llvm
curl --retry 10 --retry-delay 5 https://github.com/taichi-dev/taichi_assets/releases/download/llvm10/clang-10.0.0-win.zip -LO
7z x clang-10.0.0-win.zip -otaichi_clang
$env:PATH += ";C:\taichi_llvm\bin"
$env:PATH += ";C:\taichi_clang\bin"
clang --version
cd D:\a\taichi\taichi
python -m pip install -r requirements_dev.txt
cd python
git fetch origin master
$env:TAICHI_CMAKE_ARGS = $env:CI_SETUP_CMAKE_ARGS
python build.py build
cd ..\dist
$env:WHL = $(dir *.whl)
python -m pip install $env:WHL
env:
PYTHON: C:\hostedtoolcache\windows\Python\3.7.9\x64\python.exe
CI_SETUP_CMAKE_ARGS: -G "Visual Studio 16 2019" -A x64 -DLLVM_DIR=C:\taichi_llvm\lib\cmake\llvm -DTI_WITH_VULKAN:BOOL=ON
VULKAN_SDK: C:/VulkanSDK/1.2.189.0
- name: Test
shell: powershell
run: |
$env:PATH += ";C:\taichi_llvm\bin"
$env:PATH += ";C:\taichi_clang\bin"
python -c "import taichi"
python examples/algorithm/laplace.py
python bin/taichi diagnose
python bin/taichi changelog
python bin/taichi test -vr2 -t2
env:
PYTHON: C:\hostedtoolcache\windows\Python\3.7.9\x64\python.exe
build_and_test_m1:
name: Build and Test (Apple M1)
needs: check_code_format
timeout-minutes: 60
strategy:
matrix:
include:
- os: macos-latest
python: 3.8
defaults:
run:
# https://github.com/actions/runner/issues/805#issuecomment-844426478
shell: "/usr/bin/arch -arch arm64e /bin/bash --noprofile --norc -eo pipefail {0}"
runs-on: [self-hosted, m1]
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Build
run: |
python3 -m pip uninstall taichi -y
rm -rf $HOME/Library/Python/3.8/lib/python/site-packages/taichi
git --version
export CXX=clang++
python3 -m pip install -r requirements_dev.txt
cd python
git fetch origin master
TAICHI_CMAKE_ARGS=$CI_SETUP_CMAKE_ARGS python3 build.py build
cd ..
export NUM_WHL=`ls dist/*.whl | wc -l`
if [ $NUM_WHL -ne 1 ]; then echo 'ERROR: created more than 1 whl.' && exit 1; fi
python3 -m pip install dist/*.whl
env:
CI_SETUP_CMAKE_ARGS: -DTI_WITH_OPENGL:BOOL=OFF -DTI_WITH_CUDA:BOOL=OFF -DTI_WITH_CC:BOOL=OFF -DTI_WITH_VULKAN:BOOL=OFF -DTI_BUILD_TESTS:BOOL=ON
- name: Test
run: |
export PATH=$PATH:$HOME/Library/Python/3.8/bin
python3 examples/algorithm/laplace.py
TI_LIB_DIR=`python3 -c "import taichi;print(taichi.__path__[0])" | tail -1`
TI_LIB_DIR="$TI_LIB_DIR/lib" ./build/taichi_cpp_tests
ti test -vr2 -t4 -x