forked from WebAssembly/binaryen
-
Notifications
You must be signed in to change notification settings - Fork 0
207 lines (186 loc) · 5.85 KB
/
ci.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
name: CI
on:
# If we run CI on all branches then we end up doing duplicate work for
# branches which are also PRs.
push:
branches:
- master
- kripken/*
pull_request:
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- uses: actions/checkout@v1
- name: install tools
run: |
sudo pip3 install flake8==3.7.8
sudo apt-get install clang-format clang-tidy
echo "::add-path::/usr/lib/llvm-8/bin"
- run: flake8
- run: ./scripts/clang-format-diff.sh
- name: clang-tidy
run: |
# clang-tidy requires compile_commands.json generated by cmake
cmake . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
./scripts/clang-tidy-diff.sh
- name: gen-s-parser
run: ./scripts/gen-s-parser.py | diff src/gen-s-parser.inc -
build:
name: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- uses: actions/checkout@v1
- name: install ninja (linux)
run: sudo apt-get install ninja-build
if: matrix.os == 'ubuntu-latest'
- name: install ninja (macos)
run: brew install ninja
if: matrix.os == 'macos-latest'
- name: install ninja (win)
run: choco install ninja
if: matrix.os == 'windows-latest'
- name: mkdir
run: mkdir -p out
- name: cmake (linux)
run: cmake -S . -B out -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=out/install
if: matrix.os == 'ubuntu-latest'
- name: cmake (macos)
run: cmake -S . -B out -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=out/install
if: matrix.os == 'macos-latest'
- name: cmake (win)
# -G "Visual Studio 15 2017"
run: cmake -S . -B out -DCMAKE_INSTALL_PREFIX=out/install
if: matrix.os == 'windows-latest'
- name: build
run: cmake --build out --config Release
- name: install
run: cmake --install out --config Release
- name: strip
run: find out/install/ -type f -perm -u=x -exec strip -x {} +
if: matrix.os != 'windows-latest'
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: build-${{ matrix.os }}
path: out/install
- name: test
run: python check.py --binaryen-bin=out/install/bin
build-clang:
name: clang
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- uses: actions/checkout@v1
- name: install ninja
run: sudo apt-get install ninja-build
- name: cmake
run: |
mkdir -p out
cmake -S . -B out -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
- name: build
run: cmake --build out
- name: test
run: python check.py --binaryen-bin=out/bin
# TODO(sbc): Find a way to reduce the duplicate between these sanitizer jobs
build-asan:
name: asan
runs-on: ubuntu-latest
env:
ASAN_OPTIONS: "symbolize=1"
COMPILER_FLAGS: "-fsanitize=address"
steps:
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- uses: actions/checkout@v1
- name: install ninja
run: sudo apt-get install ninja-build
- name: cmake
run: |
mkdir -p out
cmake -S . -B out -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_FLAGS="$COMPILER_FLAGS" -DCMAKE_CXX_FLAGS="$COMPILER_FLAGS"
- name: build
run: cmake --build out
- name: test
run: python check.py --binaryen-bin=out/bin
# Duplicates build-asan. Please keep in sync
build-ubsan:
name: ubsan
runs-on: ubuntu-latest
env:
COMPILER_FLAGS: "-fsanitize=undefined -fno-sanitize-recover=all"
CC: "clang"
CXX: "clang++"
steps:
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- uses: actions/checkout@v1
- name: install ninja
run: sudo apt-get install ninja-build
- name: cmake
run: |
mkdir -p out
cmake -S . -B out -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_FLAGS="$COMPILER_FLAGS" -DCMAKE_CXX_FLAGS="$COMPILER_FLAGS -fsanitize-blacklist=$PWD/ubsan.blacklist"
- name: build
run: cmake --build out
- name: test
run: python check.py --binaryen-bin=out/bin
# Duplicates build-asan. Please keep in sync
build-tsan:
name: tsan
runs-on: ubuntu-latest
env:
COMPILER_FLAGS: "-fsanitize=thread"
LINKER_FLAGS: "-fsanitize=thread"
steps:
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- uses: actions/checkout@v1
- name: install ninja
run: sudo apt-get install ninja-build
- name: cmake
run: |
mkdir -p out
cmake -S . -B out -G Ninja -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_FLAGS="$COMPILER_FLAGS" -DCMAKE_CXX_FLAGS="$COMPILER_FLAGS" -DCMAKE_EXE_LINKER_FLAGS="$LINKER_FLAGS"
- name: build
run: cmake --build out
- name: test
run: python check.py --binaryen-bin=out/bin
# Build the .js outputs using emcc
build-emscripten:
name: emscripten
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v1
with:
python-version: '3.x'
- uses: actions/checkout@v1
- name: install ninja
run: sudo apt-get install ninja-build
- name: emsdk install
run: |
mkdir $HOME/emsdk
git clone --depth 1 https://github.com/emscripten-core/emsdk.git $HOME/emsdk
$HOME/emsdk/emsdk update-tags
$HOME/emsdk/emsdk install tot
$HOME/emsdk/emsdk activate tot
echo "::add-path::$HOME/emsdk"
- name: emcc-tests
run: |
source $HOME/emsdk/emsdk_env.sh
./scripts/emcc-tests.sh