-
Notifications
You must be signed in to change notification settings - Fork 666
264 lines (262 loc) · 10.4 KB
/
simple.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
name: Simple CI
on:
pull_request:
types: [review_requested]
branches:
- "*"
push:
branches:
- master
workflow_dispatch:
inputs:
placeholder:
description: "placeholder, no effect"
required: false
concurrency:
group: simple-ci-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
static_analysis_with_clang:
name: Static analysis with clang
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/master' || (github.event.pull_request.draft == false && contains(github.event.pull_request.requested_reviewers.*.login, 'oneflow-ci-bot') && contains(github.event.pull_request.labels.*.name, 'need-simple-ci'))
steps:
- name: Check out OneFlow
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libopenblas-dev nasm python3-pip ninja-build
- name: Download OneFlow custom clang-tidy
run: |
wget https://github.com/Oneflow-Inc/llvm-project/releases/download/maybe-14.0.4/clang-tidy-14.AppImage
wget https://raw.githubusercontent.com/oneflow-inc/llvm-project/maybe/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
chmod +x clang-tidy-14.AppImage run-clang-tidy.py
- name: Build third party libs and generate files
run: |
mkdir build
cd build
cmake .. -C ../cmake/caches/international/cpu.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=ON
cmake --build . -j$(nproc) --target oneflow_deps of_protoobj of_functional_obj of_functional_tensor_obj of_op_schema
- name: Run clang-tidy for all translation units
# use clang as compiler for correct compiler flags
run: |
cd build
rm CMakeCache.txt
cmake .. -C ../cmake/caches/international/cpu.cmake \
-DCMAKE_C_COMPILER=clang-12 \
-DCMAKE_CXX_COMPILER=clang++-12 \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cd ..
./run-clang-tidy.py -clang-tidy-binary ./clang-tidy-14.AppImage -p build -quiet -allow-enabling-alpha-checkers -extra-arg="-Xclang" -extra-arg="-analyzer-config" -extra-arg="-Xclang" -extra-arg="aggressive-binary-operation-simplification=true" "^(?!$(pwd)/build)"
hosted:
name: CPU-only
if: github.ref == 'refs/heads/master' || (github.event.pull_request.draft == false && contains(github.event.pull_request.requested_reviewers.*.login, 'oneflow-ci-bot') && contains(github.event.pull_request.labels.*.name, 'need-simple-ci'))
runs-on: ${{ matrix.os }}
env:
CFLAGS: "-w"
CXXFLAGS: "-w"
strategy:
fail-fast: true
max-parallel: 1
matrix:
test_suite: ["mac", "ubuntu"]
cmake_generator: ["Ninja", "Unix Makefiles"]
cmake_build_type: ["Debug", "Release"]
build_shared_libs: ["ON", "OFF"]
include:
- test_suite: mac
os: "macos-10.15"
make_concurrency: 2
- test_suite: ubuntu
os: "ubuntu-20.04"
make_concurrency: 2
exclude:
- test_suite: mac
cmake_build_type: "Debug"
- test_suite: mac
cmake_generator: "Ninja"
- test_suite: ubuntu
cmake_generator: "Ninja"
cmake_build_type: "Debug"
- test_suite: ubuntu
cmake_generator: "Ninja"
build_shared_libs: "OFF"
- test_suite: ubuntu
cmake_build_type: "Debug"
build_shared_libs: "OFF"
- test_suite: ubuntu
cmake_generator: "Unix Makefiles"
cmake_build_type: "Release"
steps:
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 5
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install dependencies (homebrew)
if: matrix.test_suite == 'mac'
run: |
brew install nasm ninja
- name: Install dependencies (apt)
if: matrix.test_suite == 'ubuntu'
run: |
sudo apt install -y libopenblas-dev nasm g++ gcc python3-pip ninja-build
- name: Cache pip (Linux)
if: startsWith(runner.os, 'Linux')
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ matrix.os }}-pip-${{ hashFiles('**/requirements.txt') }}
- name: Cache pip (macOS)
if: startsWith(runner.os, 'macOS')
uses: actions/cache@v2
with:
path: ~/Library/Caches/pip
key: ${{ matrix.os }}-pip-${{ hashFiles('**/requirements.txt') }}
- name: Install dependencies (pip)
run: |
python3 -m pip install -r ci/requirements.txt
python3 -m pip install -r dev-requirements.txt
- name: Set environment variables
run: |
set -x
cmake_flags=""
cmake_flags+=" -DBUILD_CUDA=OFF"
cmake_flags+=" -DBUILD_TESTING=ON"
cmake_flags+=" -G '${{ matrix.cmake_generator }}'"
cmake_flags+=" -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }}"
cmake_flags+=" -DBUILD_SHARED_LIBS=${{ matrix.build_shared_libs }}"
cmake_flags+=" -DCMAKE_MACOSX_RPATH=FALSE"
cmake_flags+=" -DCMAKE_BUILD_WITH_INSTALL_RPATH=FALSE"
echo "cmake_flags=${cmake_flags}" >> $GITHUB_ENV
- name: Build (third party)
if: matrix.cmake_generator != 'Ninja'
run: |
set -x
mkdir -p build-third_party
mkdir -p third_party_install
cd build-third_party
cmake .. ${{ env.cmake_flags }} -DTHIRD_PARTY=ON -DONEFLOW=OFF -DTHIRD_PARTY_DIR=$PWD/../third_party_install
cmake --build . -j $(nproc)
- name: Build (oneflow)
if: matrix.cmake_generator != 'Ninja'
run: |
mkdir -p build
cd build
cmake .. ${{ env.cmake_flags }} -DTHIRD_PARTY=OFF -DONEFLOW=ON -DTHIRD_PARTY_DIR=$PWD/../third_party_install
cmake --build . -j ${{ matrix.make_concurrency }} --target oneflow
- name: Build (oneflow_internal)
if: always() && matrix.cmake_generator != 'Ninja'
run: |
mkdir -p build
cd build
cmake .. ${{ env.cmake_flags }} -DTHIRD_PARTY=OFF -DONEFLOW=ON
cmake --build . -j ${{ matrix.make_concurrency }} --target oneflow_internal
- name: Build (oneflow_py)
if: always() && matrix.cmake_generator != 'Ninja'
run: |
mkdir -p build
cd build
cmake .. ${{ env.cmake_flags }} -DTHIRD_PARTY=OFF -DONEFLOW=ON
cmake --build . -j ${{ matrix.make_concurrency }} --target oneflow_py
- name: Build (oneflow_testexe)
if: always() && matrix.cmake_generator != 'Ninja'
run: |
mkdir -p build
cd build
cmake .. ${{ env.cmake_flags }} -DTHIRD_PARTY=OFF -DONEFLOW=ON
cmake --build . -j ${{ matrix.make_concurrency }} --target oneflow_testexe
- name: Build (ALL)
if: always()
continue-on-error: ${{ startsWith(runner.os, 'macOS') && matrix.cmake_generator == 'Ninja' && matrix.build_shared_libs == 'ON' }}
run: |
mkdir -p build
cd build
cmake .. ${{ env.cmake_flags }}
cmake --build . -j ${{ matrix.make_concurrency }}
- name: Exe test
if: always()
continue-on-error: true
run: |
ulimit -c
ulimit -c unlimited
ulimit -c
mkdir -p build
cd build
./bin/oneflow_testexe
- name: Op test
if: always()
continue-on-error: true
run: |
ulimit -c
ulimit -c unlimited
ulimit -c
source build/source.sh
ONEFLOW_TEST_GITHUB_HOSTED=1 ONEFLOW_TEST_CPU_ONLY=1 bash ci/test/1node_op_test.sh
- name: "Tar logs"
if: always() && contains(github.event.pull_request.labels.*.name, 'need-simple-ci-upload-artifact')
continue-on-error: true
run: |
set -ex
if [[ -d "${HOME}/oneflow_temp" ]]
then
tar -cvf home_oneflow_temp.tar ${HOME}/oneflow_temp
fi
if [[ -d "${PWD}/test_tmp_dir" ]]
then
tar -cvf cwd_test_tmp_dir.tar ${PWD}/test_tmp_dir
fi
- name: Upload logs
if: always() && contains(github.event.pull_request.labels.*.name, 'need-simple-ci-upload-artifact')
uses: actions/upload-artifact@v2
with:
name: logs-${{ matrix.test_suite }}-${{ matrix.cmake_generator }}-${{ matrix.cmake_build_type }}-shared-${{ matrix.build_shared_libs }}
path: |
home_oneflow_temp.tar
cwd_test_tmp_dir.tar
conda:
name: Build with conda
if: github.ref == 'refs/heads/master' || (github.event.pull_request.draft == false && contains(github.event.pull_request.requested_reviewers.*.login, 'oneflow-ci-bot') && contains(github.event.pull_request.labels.*.name, 'need-simple-ci'))
runs-on: ubuntu-latest
strategy:
fail-fast: true
max-parallel: 1
matrix:
build-type: ["gcc7", "clang10"]
steps:
- name: Checkout Oneflow-Inc/oneflow
uses: actions/checkout@v2
- name: Checkout Oneflow-Inc/conda-env
uses: actions/checkout@v2
with:
repository: Oneflow-Inc/conda-env
ref: 30a7f00eb48ee9009d85a848e720823e5054c66b
path: conda-env
- uses: Oneflow-Inc/get-oneflow@whl-skip-nccl
name: Build with gcc7
if: ${{ matrix.build-type == 'gcc7'}}
with:
cmake-init-cache: cmake/caches/ci/gh-hosted/cpu-gcc.cmake
oneflow-src: .
oneflow-build-env: conda
conda-env-file: conda-env/dev/gcc7/environment-v2.yml
conda-env-name: oneflow-dev-gcc7-v2
- uses: Oneflow-Inc/get-oneflow@whl-skip-nccl
name: Build with clang10
if: ${{ matrix.build-type == 'clang10'}}
with:
cmake-init-cache: cmake/caches/ci/gh-hosted/cpu-clang.cmake
oneflow-src: .
oneflow-build-env: conda
conda-env-file: conda-env/dev/clang10/environment-v2.yml
conda-env-name: oneflow-dev-clang10-v2