-
Notifications
You must be signed in to change notification settings - Fork 106
393 lines (351 loc) · 11.2 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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
#
# 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/emscripten/**'
- 'src/platforms/esp32/**'
- 'src/platforms/rp2040/**'
- 'src/platforms/stm32/**'
- 'doc/**'
- 'LICENSES/**'
- '*.Md'
- '*.md'
pull_request:
paths-ignore:
- 'src/platforms/emscripten/**'
- 'src/platforms/esp32/**'
- 'src/platforms/rp2040/**'
- 'src/platforms/stm32/**'
- 'doc/**'
- 'LICENSES/**'
- '*.Md'
- '*.md'
concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# 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 24.04 has gcc from 9 to 14 ("gcc" is gcc-13)
# Ubuntu 20.04 has clang 10 and 12 to ("clang" is 10)
# Ubuntu 22.04 has clang from 12 to 15 ("clang" is 14)
# Ubuntu 24.04 has clang from 14 to 18 ("clang" is 18)
# We want to test every compiler but don't need to test every OS
# We only test several OTP versions with default compilers (gcc-9, 11, 13, clang-10, 14, 18)
cc: ["gcc-9", "gcc-11", "gcc-13", "clang-10", "clang-14", "clang-18"]
cflags: ["-O3"]
otp: ["25", "26", "27"]
include:
- cc: "gcc-7"
cxx: "g++-7"
compiler_pkgs: "gcc-7 g++-7"
os: "ubuntu-20.04"
otp: "27"
- cc: "gcc-8"
cxx: "g++-8"
compiler_pkgs: "gcc-8 g++-8"
os: "ubuntu-20.04"
otp: "27"
- cc: "gcc-9"
cxx: "g++-9"
compiler_pkgs: "gcc-9 g++-9"
os: "ubuntu-20.04"
# otp: all
- cc: "gcc-10"
cxx: "g++-10"
compiler_pkgs: "gcc-10 g++-10"
# Use Werror for recent GCC versions that have better diagnostics
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-22.04"
otp: "27"
- cc: "gcc-11"
cxx: "g++-11"
compiler_pkgs: "gcc-11 g++-11"
# Use Werror for recent GCC versions that have better diagnostics
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-22.04"
# otp: all
- cc: "gcc-12"
cxx: "g++-12"
compiler_pkgs: "gcc-12 g++-12"
# Use Werror for recent GCC versions that have better diagnostics
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-24.04"
otp: "27"
- cc: "gcc-13"
cxx: "g++-13"
compiler_pkgs: "gcc-13 g++-13"
# Use Werror for recent GCC versions that have better diagnostics
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-24.04"
# otp: all
- cc: "gcc-14"
cxx: "g++-14"
compiler_pkgs: "gcc-14 g++-14"
# Use Werror for recent GCC versions that have better diagnostics
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-24.04"
otp: "27"
- cc: "clang-10"
cxx: "clang++-10"
compiler_pkgs: "clang-10"
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-20.04"
# otp: all
- cc: "clang-11"
cxx: "clang++-11"
compiler_pkgs: "clang-11"
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-20.04"
otp: "27"
- cc: "clang-12"
cxx: "clang++-12"
compiler_pkgs: "clang-12"
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-22.04"
otp: "27"
- cc: "clang-13"
cxx: "clang++-13"
compiler_pkgs: "clang-13"
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-22.04"
otp: "27"
- cc: "clang-14"
cxx: "clang++-14"
compiler_pkgs: "clang-14"
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-22.04"
# otp: all
- cc: "clang-15"
cxx: "clang++-15"
compiler_pkgs: "clang-15"
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-24.04"
otp: "27"
- cc: "clang-16"
cxx: "clang++-16"
compiler_pkgs: "clang-16"
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-24.04"
otp: "27"
- cc: "clang-17"
cxx: "clang++-17"
compiler_pkgs: "clang-17"
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-24.04"
otp: "27"
- cc: "clang-18"
cxx: "clang++-18"
compiler_pkgs: "clang-18"
cmake_opts_other: "-DAVM_WARNINGS_ARE_ERRORS=ON"
os: "ubuntu-24.04"
# otp: all
- otp: "25"
elixir_version: "1.14"
- otp: "26"
elixir_version: "1.17"
- otp: "27"
elixir_version: "1.17"
# Old versions of OTP/Elixir
- os: "ubuntu-20.04"
cc: "cc"
cxx: "c++"
otp: "21"
cflags: ""
elixir_version: "1.7"
- os: "ubuntu-20.04"
cc: "cc"
cxx: "c++"
otp: "22"
cflags: ""
elixir_version: "1.8"
- os: "ubuntu-20.04"
cc: "cc"
cxx: "c++"
otp: "23"
cflags: ""
elixir_version: "1.11"
- os: "ubuntu-22.04"
cc: "cc"
cxx: "c++"
otp: "24"
cflags: ""
elixir_version: "1.14"
# TODO: enable master again
# master will not work until we don't adapt to atom table changes
# # master/main version of OTP/Elixir
# - os: "ubuntu-24.04"
# cc: "cc"
# cxx: "c++"
# otp: "master"
# elixir_version: "main"
# Additional default compiler builds
- os: "ubuntu-20.04"
cc: "cc"
cxx: "c++"
otp: "27"
cflags: ""
elixir_version: "1.17"
- os: "ubuntu-22.04"
cc: "cc"
cxx: "c++"
otp: "27"
cflags: ""
elixir_version: "1.17"
# Additional latest & -Os compiler builds
- os: "ubuntu-24.04"
cc: "gcc-14"
cxx: "g++-14"
otp: "27"
cflags: "-Os"
elixir_version: "1.17"
compiler_pkgs: "gcc-14 g++-14"
- os: "ubuntu-24.04"
cc: "clang-18"
cxx: "clang++-18"
otp: "27"
cflags: "-Os"
elixir_version: "1.17"
compiler_pkgs: "clang-18"
# Additional 32 bits build
- os: "ubuntu-20.04"
cc: "gcc-10"
cxx: "g++-10"
cflags: "-m32 -O3"
otp: "23"
elixir_version: "1.11"
# Use Werror so we get an error with 32 bit specific warnings
cmake_opts_other: "-DAVM_CREATE_STACKTRACES=off -DAVM_WARNINGS_ARE_ERRORS=ON"
arch: "i386"
compiler_pkgs: "gcc-10 g++-10 gcc-10-multilib g++-10-multilib libc6-dev-i386
libc6-dbg:i386 zlib1g-dev:i386 libmbedtls-dev:i386"
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
CFLAGS: ${{ matrix.cflags }}
CXXFLAGS: ${{ matrix.cflags }}
steps:
# Setup
- name: "Checkout repo"
uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir_version }}
hexpm-mirrors: |
https://builds.hex.pm
https://repo.hex.pm
https://cdn.jsdelivr.net/hex
- 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 libmbedtls-dev
# 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@v4
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
- name: "Build: run dialyzer"
working-directory: build
run: make dialyzer
# Test
- name: "Test: test-erlang"
timeout-minutes: 15
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: 5
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: "Test: Tests.avm (Elixir)"
timeout-minutes: 10
working-directory: build
run: |
if command -v elixirc &> /dev/null
then
./src/AtomVM ./tests/libs/exavmlib/Tests.avm
valgrind ./src/AtomVM ./tests/libs/exavmlib/Tests.avm
fi
- name: "Install and smoke test"
working-directory: build
run: |
sudo PATH=${PATH} make install
atomvm examples/erlang/hello_world.avm
atomvm -v
atomvm -h