-
Notifications
You must be signed in to change notification settings - Fork 106
290 lines (251 loc) · 7.79 KB
/
build-and-test.yaml
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
#
# Copyright 2017-2022 Davide Bettio <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
#
name: Build and Test
on:
push:
paths-ignore:
- 'src/platforms/esp32/**'
- 'src/platforms/stm32/**'
- 'doc/**'
- 'LICENSES/**'
pull_request:
paths-ignore:
- 'src/platforms/esp32/**'
- 'src/platforms/stm32/**'
- 'doc/**'
- 'LICENSES/**'
jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-20.04", "ubuntu-22.04"]
cc: ["gcc-7", "gcc-8", "gcc-9", "gcc-10", "gcc-11", "gcc-12", "clang-10", "clang-11"]
# cc: ["gcc-7", "gcc-8", "gcc-9", "gcc-10", "gcc-11", "gcc-12", "clang-10", "clang-11", "clang-12", "clang-13", "clang-14"]
cflags: ["-O3"]
otp: ["21", "22", "23", "24", "25", "master"]
exclude:
# Ubuntu 22.04 with setup-beam only has OTP >= 24.2
- os: "ubuntu-22.04"
otp: "21"
- os: "ubuntu-22.04"
otp: "22"
- os: "ubuntu-22.04"
otp: "23"
# Ubuntu 20.04 has gcc from 7 to 10 ("gcc" is gcc-9)
# Ubuntu 22.04 has gcc from 9 to 12 ("gcc" is gcc-11)
# Ubuntu 20.04 has clang 10 and 12 to ("clang" is 10)
# Ubuntu 22.04 has clang from 12 to 14 ("clang" is 14)
# We want to test every compiler but don't need to test every OS
# and we favor later Ubuntu 22.04 + defaults
- os: "ubuntu-22.04"
cc: "gcc-7"
- os: "ubuntu-22.04"
cc: "gcc-8"
- os: "ubuntu-20.04"
cc: "gcc-10"
- os: "ubuntu-20.04"
cc: "gcc-11"
- os: "ubuntu-20.04"
cc: "gcc-12"
- os: "ubuntu-22.04"
cc: "clang-10"
- os: "ubuntu-22.04"
cc: "clang-11"
# - os: "ubuntu-20.04"
# cc: "clang-12"
# - os: "ubuntu-20.04"
# cc: "clang-13"
# - os: "ubuntu-20.04"
# cc: "clang-14"
include:
- cc: "gcc-7"
cxx: "g++-7"
compiler_pkgs: "gcc-7 g++-7"
- cc: "gcc-8"
cxx: "g++-8"
compiler_pkgs: "gcc-8 g++-8"
- cc: "gcc-9"
cxx: "g++-9"
compiler_pkgs: "gcc-9 g++-9"
- cc: "gcc-10"
cxx: "g++-10"
compiler_pkgs: "gcc-10 g++-10"
- cc: "gcc-11"
cxx: "g++-11"
compiler_pkgs: "gcc-11 g++-11"
- cc: "gcc-12"
cxx: "g++-12"
compiler_pkgs: "gcc-12 g++-12"
- cc: "clang-10"
cxx: "clang++-10"
compiler_pkgs: "clang-10"
- cc: "clang-11"
cxx: "clang++-11"
compiler_pkgs: "clang-11"
# - cc: "clang-12"
# cxx: "clang++-12"
# compiler_pkgs: "clang-12"
# - cc: "clang-13"
# cxx: "clang++-13"
# compiler_pkgs: "clang-13"
# - cc: "clang-14"
# cxx: "clang++-14"
# compiler_pkgs: "clang-14"
- otp: "21"
elixir_version: "1.7"
- otp: "22"
elixir_version: "1.8"
- otp: "23"
elixir_version: "1.11"
- otp: "24"
elixir_version: "1.14"
- otp: "25"
elixir_version: "1.14"
- otp: "master"
elixir_version: "master"
# Additional default compiler builds
- os: "ubuntu-20.04"
cc: "cc"
cxx: "c++"
otp: "25"
cflags: ""
elixir_version: "1.14"
- os: "ubuntu-22.04"
cc: "cc"
cxx: "c++"
otp: "25"
cflags: ""
elixir_version: "1.14"
# Additional latest & -Os compiler builds
- os: "ubuntu-22.04"
cc: "gcc-12"
cxx: "g++-12"
otp: "24"
cflags: "-Os"
elixir_version: "1.14"
compiler_pkgs: "gcc-12 g++-12"
# - os: "ubuntu-22.04"
# cc: "clang-14"
# cxx: "clang++-14"
# otp: "24"
# cflags: "-Os"
# elixir_version: "1.14"
# compiler_pkgs: "clang-14"
# Additional 32 bits build
- os: "ubuntu-20.04"
cc: "gcc-10"
cxx: "g++-10"
cflags: "-m32 -O3"
otp: "23"
elixir_version: "1.11"
cmake_opts_other: "-DOPENSSL_CRYPTO_LIBRARY=/usr/lib/i386-linux-gnu/libcrypto.so -DAVM_CREATE_STACKTRACES=off"
arch: "i386"
compiler_pkgs: "gcc-10 g++-10 gcc-10-multilib g++-10-multilib libc6-dev-i386
libc6-dbg:i386 zlib1g-dev:i386 libssl-dev:i386"
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
CFLAGS: ${{ matrix.cflags }}
CXXFLAGS: ${{ matrix.cflags }}
steps:
# Setup
- name: "Checkout repo"
uses: actions/checkout@v2
with:
submodules: 'recursive'
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir_version }}
- name: "Add i386 architecture"
if: matrix.arch == 'i386'
run: sudo dpkg --add-architecture i386
- name: "APT update"
run: sudo apt update -y
- name: "Install deps"
run: sudo apt install -y ${{ matrix.compiler_pkgs}} cmake gperf zlib1g-dev doxygen valgrind
# Builder info
- name: "System info"
run: |
echo "**uname:**"
uname -a
echo "**libc version:**"
ldd --version
echo "**C Compiler version:**"
$CC --version
$CXX --version
echo "**Linker version:**"
ld --version
echo "**CMake version:**"
cmake --version
echo "**OTP version:**"
cat $(dirname $(which erlc))/../releases/RELEASES || true
# Build
- name: "Build: create build dir"
run: mkdir build
- uses: actions/cache@v2
id: cache
with:
path: 'build/tests/**/*.beam'
key: ${{ matrix.otp }}-${{ hashFiles('**/build-and-test.yaml', 'tests/**/*.erl') }}
- name: "Build: run cmake"
working-directory: build
run: |
cmake ${{ matrix.cmake_opts_fp }} ${{ matrix.cmake_opts_smp }} ${{ matrix.cmake_opts_other }} ..
# git clone will use more recent timestamps than cached beam files
# touch them so we can benefit from the cache and avoid costly beam file rebuild.
find . -name '*.beam' -exec touch {} \;
- name: "Build: run make"
working-directory: build
run: make
# Test
- name: "Test: test-erlang"
timeout-minutes: 10
working-directory: build
run: |
./tests/test-erlang -s prime_smp
valgrind ./tests/test-erlang -s prime_smp
- name: "Test: test-enif"
working-directory: build
run: |
./tests/test-enif
valgrind ./tests/test-enif
- name: "Test: test-mailbox"
working-directory: build
run: |
./tests/test-mailbox
valgrind ./tests/test-mailbox
- name: "Test: test-structs"
timeout-minutes: 10
working-directory: build
run: |
./tests/test-structs
valgrind ./tests/test-structs
- name: "Test: test_estdlib.avm"
timeout-minutes: 10
working-directory: build
run: |
./src/AtomVM ./tests/libs/estdlib/test_estdlib.avm
valgrind ./src/AtomVM ./tests/libs/estdlib/test_estdlib.avm
- name: "Test: test_eavmlib.avm"
timeout-minutes: 10
working-directory: build
run: |
./src/AtomVM ./tests/libs/eavmlib/test_eavmlib.avm
valgrind ./src/AtomVM ./tests/libs/eavmlib/test_eavmlib.avm
- name: "Test: test_alisp.avm"
timeout-minutes: 10
working-directory: build
run: |
./src/AtomVM ./tests/libs/alisp/test_alisp.avm
valgrind ./src/AtomVM ./tests/libs/alisp/test_alisp.avm
- name: "Install and smoke test"
working-directory: build
run: |
sudo PATH=${PATH} make install
atomvm examples/erlang/hello_world.avm