Skip to content

Commit 0270085

Browse files
authored
use docker CI (#99)
1 parent 30b45f8 commit 0270085

File tree

1 file changed

+9
-285
lines changed

1 file changed

+9
-285
lines changed

.github/workflows/presubmit.yml

Lines changed: 9 additions & 285 deletions
Original file line numberDiff line numberDiff line change
@@ -4,292 +4,16 @@ on:
44
types: [opened, synchronize, reopened]
55

66
jobs:
7-
title_format:
8-
name: Check PR Title
9-
if: ${{ github.event.pull_request }}
7+
docker_cpu_build:
108
runs-on: ubuntu-latest
9+
container: registry.taichigraphics.com/taichidev-ubuntu20.04-test:v0.1
1110
steps:
12-
- uses: actions/checkout@v2
13-
- uses: actions/setup-python@v2
14-
with:
15-
python-version: 3.8
11+
- run: |
12+
ti test
1613
17-
- name: Run PR Title Checker
18-
run: |
19-
pip install semver GitPython
20-
python misc/ci_check_pr_title.py "$PR_TITLE"
21-
env:
22-
PR_TITLE: ${{ github.event.pull_request.title }}
23-
24-
check_code_format:
25-
name: Check Code Format
26-
runs-on: ubuntu-latest
27-
# This job will be required to pass before merging to master branch.
28-
steps:
29-
- uses: actions/checkout@v2
30-
- name: Set up Python ${{ matrix.python-version }}
31-
uses: actions/setup-python@v2
32-
with:
33-
python-version: 3.8
34-
35-
- name: Setup git & clang-format
36-
run: |
37-
git config user.email "[email protected]"
38-
git config user.name "Taichi Gardener"
39-
git checkout -b _fake_squash
40-
git remote add upstream https://github.com/taichi-dev/taichi.git
41-
git fetch upstream master
42-
sudo apt install clang-format-10
43-
44-
- name: Cache PIP
45-
uses: actions/cache@v2
46-
with:
47-
path: ~/.cache/pip
48-
key: ${{ hashFiles('setup.py') }}-${{ hashFiles('requirements_dev.txt') }}
49-
50-
- name: Install requirements
51-
run: |
52-
python3 -m pip install --user -r requirements_dev.txt
53-
54-
- name: Check code format
55-
run: |
56-
python3 misc/code_format.py
57-
git checkout -b _enforced_format
58-
git commit -am "enforce code format" || true
59-
# exit with 1 if there were differences:
60-
git diff _fake_squash _enforced_format --exit-code
61-
62-
- name: Pylint
63-
run: |
64-
# Make sure pylint doesn't regress
65-
pylint python/taichi/ --disable=all --enable=C0415
66-
if [ $? -eq 0 ]
67-
then
68-
echo "PASSED: pylint is happy"
69-
exit 0
70-
else
71-
echo "FAILED: please run the pylint command above and make sure it passes"
72-
exit 1
73-
fi
74-
75-
build_and_test_cpu_required:
76-
# This job will be required to pass before merging to master branch.
77-
name: Required Build and Test (CPU)
78-
needs: check_code_format
79-
timeout-minutes: 60
80-
strategy:
81-
matrix:
82-
include:
83-
- os: ubuntu-latest
84-
python: 3.6
85-
runs-on: ${{ matrix.os }}
86-
steps:
87-
- uses: actions/checkout@v2
88-
with:
89-
submodules: 'recursive'
90-
91-
- uses: actions/setup-python@v2
92-
with:
93-
python-version: ${{ matrix.python }}
94-
95-
- name: Download Pre-Built LLVM 10.0.0
96-
run: |
97-
python misc/ci_download.py
98-
mkdir taichi-llvm
99-
cd taichi-llvm
100-
unzip ../taichi-llvm.zip
101-
env:
102-
CI_PLATFORM: ${{ matrix.os }}
103-
104-
- name: Build & Install
105-
run: .github/workflows/scripts/unix_build.sh
106-
env:
107-
CI_SETUP_CMAKE_ARGS: -DTI_WITH_OPENGL:BOOL=OFF -DTI_WITH_CC:BOOL=ON -DTI_WITH_VULKAN:BOOL=OFF -DTI_BUILD_TESTS:BOOL=ON
108-
CXX: clang++
109-
110-
- name: Test
111-
run: .github/workflows/scripts/unix_test.sh
112-
113-
build_and_test_cpu:
114-
name: Build and Test (CPU)
115-
needs: build_and_test_cpu_required
116-
timeout-minutes: 60
117-
strategy:
118-
matrix:
119-
include:
120-
- os: macos-latest
121-
python: 3.7
122-
with_cc: OFF
123-
with_cpp_tests: ON
124-
- os: ubuntu-latest
125-
python: 3.9
126-
with_cc: OFF
127-
with_cpp_tests: OFF
128-
- os: ubuntu-latest
129-
python: 3.8
130-
with_cc: ON
131-
with_cpp_tests: OFF
132-
runs-on: ${{ matrix.os }}
133-
steps:
134-
- uses: actions/checkout@v2
135-
with:
136-
submodules: 'recursive'
137-
138-
- uses: actions/setup-python@v2
139-
with:
140-
python-version: ${{ matrix.python }}
141-
142-
- name: Download Pre-Built LLVM 10.0.0
143-
run: |
144-
python misc/ci_download.py
145-
mkdir taichi-llvm
146-
cd taichi-llvm
147-
unzip ../taichi-llvm.zip
148-
env:
149-
CI_PLATFORM: ${{ matrix.os }}
150-
151-
- name: Build & Install
152-
run: .github/workflows/scripts/unix_build.sh
153-
env:
154-
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 }}
155-
CXX: clang++
156-
# [DEBUG] Copy this step around to enable debugging inside Github Action instances.
157-
#- name: Setup tmate session
158-
# uses: mxschmitt/action-tmate@v3
159-
# with:
160-
# limit-access-to-actor: true
161-
162-
- name: Test
163-
run: .github/workflows/scripts/unix_test.sh
164-
env:
165-
RUN_CPP_TESTS: ${{ matrix.with_cpp_tests }}
166-
167-
build_and_test_gpu_linux:
168-
name: Build and Test (GPU)
169-
needs: check_code_format
170-
runs-on: [self-hosted, cuda, vulkan, cn]
171-
timeout-minutes: 60
172-
steps:
173-
- uses: actions/checkout@v2
174-
with:
175-
submodules: 'recursive'
176-
177-
- name: Build
178-
run: |
179-
export PATH=$PATH:/usr/local/cuda/bin
180-
.github/workflows/scripts/unix_build.sh
181-
env:
182-
LLVM_LIB_ROOT_DIR: /opt/taichi-llvm-10.0.0
183-
CI_SETUP_CMAKE_ARGS: -DTI_WITH_OPENGL:BOOL=ON -DTI_WITH_CC:BOOL=OFF -DTI_WITH_VULKAN:BOOL=ON
184-
BUILD_NUM_THREADS: 8
185-
LLVM_PATH: /opt/taichi-llvm-10.0.0/bin
186-
LLVM_DIR: /opt/taichi-llvm-10.0.0/lib/cmake/llvm
187-
CXX: clang++-8
188-
189-
- name: Test
190-
run: .github/workflows/scripts/unix_test.sh
191-
env:
192-
DISPLAY: :1
193-
GPU_TEST: ON
194-
195-
build_and_test_windows:
196-
name: Build and Test (Windows)
197-
needs: check_code_format
198-
runs-on: windows-latest
199-
timeout-minutes: 90
200-
steps:
201-
202-
- name: Install 7Zip PowerShell
203-
shell: powershell
204-
run: Install-Module 7Zip4PowerShell -Force -Verbose
205-
206-
- uses: actions/checkout@v2
207-
with:
208-
submodules: 'recursive'
209-
210-
- uses: actions/setup-python@v2
211-
with:
212-
python-version: 3.7
213-
214-
- name: Add msbuild to PATH
215-
uses: microsoft/[email protected]
216-
217-
- name: Download And Install Vulkan
218-
shell: powershell
219-
run: |
220-
Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/1.2.189.0/windows/VulkanSDK-1.2.189.0-Installer.exe" -OutFile VulkanSDK.exe
221-
$installer = Start-Process -FilePath VulkanSDK.exe -Wait -PassThru -ArgumentList @("/S");
222-
$installer.WaitForExit();
223-
224-
- name: Build
225-
shell: powershell
226-
run: |
227-
$env:Path += ";C:/VulkanSDK/1.2.189.0/Bin"
228-
cd C:\
229-
Remove-item alias:curl
230-
curl --retry 10 --retry-delay 5 https://github.com/taichi-dev/taichi_assets/releases/download/llvm10/taichi-llvm-10.0.0-msvc2019.zip -LO
231-
7z x taichi-llvm-10.0.0-msvc2019.zip -otaichi_llvm
232-
curl --retry 10 --retry-delay 5 https://github.com/taichi-dev/taichi_assets/releases/download/llvm10/clang-10.0.0-win.zip -LO
233-
7z x clang-10.0.0-win.zip -otaichi_clang
234-
$env:PATH = ";C:\taichi_llvm\bin;C:\taichi_clang\bin;" + $env:PATH
235-
clang --version
236-
cd D:\a\taichi\taichi
237-
python -m pip install -r requirements_dev.txt
238-
cd python
239-
git fetch origin master
240-
$env:TAICHI_CMAKE_ARGS = $env:CI_SETUP_CMAKE_ARGS
241-
python build.py build
242-
cd ..\dist
243-
$env:WHL = $(dir *.whl)
244-
python -m pip install $env:WHL
245-
env:
246-
PYTHON: C:\hostedtoolcache\windows\Python\3.7.9\x64\python.exe
247-
CI_SETUP_CMAKE_ARGS: -G "Visual Studio 16 2019" -A x64 -DLLVM_DIR=C:\taichi_llvm\lib\cmake\llvm -DTI_WITH_VULKAN:BOOL=ON
248-
VULKAN_SDK: C:/VulkanSDK/1.2.189.0
249-
250-
- name: Test
251-
shell: powershell
252-
run: |
253-
$env:PATH = ";C:\taichi_llvm\bin;C:\taichi_clang\bin;" + $env:PATH
254-
python -c "import taichi"
255-
python examples/algorithm/laplace.py
256-
python bin/taichi diagnose
257-
python bin/taichi changelog
258-
python bin/taichi test -vr2 -t2
259-
env:
260-
PYTHON: C:\hostedtoolcache\windows\Python\3.7.9\x64\python.exe
261-
262-
build_and_test_m1:
263-
name: Build and Test (Apple M1)
264-
needs: check_code_format
265-
timeout-minutes: 60
266-
strategy:
267-
matrix:
268-
include:
269-
- os: macos-latest
270-
python: 3.8
271-
defaults:
272-
run:
273-
# https://github.com/actions/runner/issues/805#issuecomment-844426478
274-
shell: "/usr/bin/arch -arch arm64e /bin/bash --noprofile --norc -eo pipefail {0}"
275-
runs-on: [self-hosted, m1]
14+
docker_gpu_build:
15+
runs-on: [self-hosted, cuda, vulkan]
16+
container: registry.taichigraphics.com/taichidev-ubuntu20.04-test:v0.1
27617
steps:
277-
- uses: actions/checkout@v2
278-
with:
279-
submodules: 'recursive'
280-
281-
- name: Build
282-
run: |
283-
rm -rf $HOME/Library/Python/3.8/lib/python/site-packages/taichi
284-
.github/workflows/scripts/unix_build.sh
285-
env:
286-
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
287-
CXX: clang++
288-
289-
- name: Test
290-
run: |
291-
export PATH=$PATH:$HOME/Library/Python/3.8/bin
292-
python3 examples/algorithm/laplace.py
293-
TI_LIB_DIR=`python3 -c "import taichi;print(taichi.__path__[0])" | tail -1`
294-
TI_LIB_DIR="$TI_LIB_DIR/lib" ./build/taichi_cpp_tests
295-
ti test -vr2 -t4 -x
18+
- run: |
19+
ti test

0 commit comments

Comments
 (0)