forked from Oneflow-Inc/oneflow
-
Notifications
You must be signed in to change notification settings - Fork 0
252 lines (250 loc) · 9.83 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
name: Simple CI
on:
pull_request:
types: [review_requested]
branches:
- "*"
push:
branches:
- master
workflow_dispatch:
inputs:
placeholder:
description: "placeholder, no effect"
required: false
jobs:
cancel_previous:
name: Cancel previous runs
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs of outdated commit
if: github.ref != 'refs/heads/master'
uses: styfle/cancel-workflow-action@0.9.0
with:
access_token: ${{ github.token }}
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/latest/clang-tidy-489012f-x86_64.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-489012f-x86_64.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 of_git_version oneflow_deps generate_functional of_cfgobj generate_py_cfg
- name: Run Maybe-related checks by clang-tidy
# 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-489012f-x86_64.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" '^((?!third_party_install).)+(?<!cfg.cpp)(?<!pb.cc)$'
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 }}
needs: [cancel_previous]
env:
CFLAGS: "-w"
CXXFLAGS: "-w"
strategy:
fail-fast: true
max-parallel: 3
matrix:
test_suite: ["conda", "mac", "ubuntu"]
cmake_generator: ["Ninja", "Unix Makefiles"]
cmake_build_type: ["Debug", "Release"]
build_shared_libs: ["ON", "OFF"]
include:
- test_suite: conda
os: "ubuntu-20.04"
make_concurrency: 2
- test_suite: mac
os: "macos-10.15"
make_concurrency: 2
- test_suite: ubuntu
os: "ubuntu-20.04"
make_concurrency: 2
exclude:
- test_suite: conda
cmake_generator: "Ninja"
- test_suite: mac
cmake_build_type: "Debug"
- test_suite: ubuntu
cmake_generator: "Ninja"
cmake_build_type: "Debug"
steps:
- 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') && matrix.test_suite != 'conda'
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)
if: matrix.test_suite != 'conda'
run: |
python3 -m pip install -r ci/requirements.txt
python3 -m pip install -r dev-requirements.txt
- name: Download conda environment.yml
if: matrix.test_suite == 'conda'
run: |
wget https://raw.githubusercontent.com/Oneflow-Inc/conda-env/5b985c863ef73fc3f3b597289fdcf740d52cf71c/dev/gcc7/environment.yml
- uses: conda-incubator/setup-miniconda@v2
if: matrix.test_suite == 'conda'
name: Setup conda
with:
activate-environment: oneflow-dev-gcc7
environment-file: environment.yml
python-version: 3.6
auto-activate-base: false
- name: Set environment variables (conda)
if: matrix.test_suite == 'conda'
run: |
conda env config vars set CXXFLAGS="-w -fPIC"
shell: bash -l {0}
- 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
shell: bash -l {0}
- 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)
shell: bash -l {0}
- name: Build (of_ccobj)
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 of_ccobj
shell: bash -l {0}
- 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
shell: bash -l {0}
- 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
shell: bash -l {0}
- 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
shell: bash -l {0}
- 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 }}
shell: bash -l {0}
- 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
shell: bash -l {0}
- 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
shell: bash -l {0}
- 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