-
Notifications
You must be signed in to change notification settings - Fork 107
186 lines (167 loc) · 6.35 KB
/
build-and-test-other.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
#
# Copyright 2022 Davide Bettio <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
#
name: Build and Test on Other Architectures
on:
push:
paths-ignore:
- 'src/platforms/emscripten/**'
- 'src/platforms/esp32/**'
- 'src/platforms/rp2/**'
- 'src/platforms/stm32/**'
- 'doc/**'
- 'LICENSES/**'
- '*.Md'
- '*.md'
pull_request:
paths-ignore:
- 'src/platforms/emscripten/**'
- 'src/platforms/esp32/**'
- 'src/platforms/rp2/**'
- '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:
compile_tests:
runs-on: ubuntu-24.04
container: erlang:27
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install required packages
run: apt update && apt install -y gperf zlib1g-dev cmake ninja-build
- name: Compile test modules
run: |
set -e
mkdir build_tests
cd build_tests
cmake .. -G Ninja -DAVM_WARNINGS_ARE_ERRORS=ON
ninja erlang_test_modules test_etest test_estdlib test_eavmlib test_alisp
- name: Upload test modules
uses: actions/upload-artifact@v4
with:
name: test-modules
path: |
build_tests/**/*.avm
build_tests/**/*.beam
build_tests/**/*.hrl
retention-days: 1
build-and-test-other:
needs: compile_tests
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
arch: ["arm32v5", "arm32v7", "arm64v8"]
include:
- arch: "arm32v5"
platform: "arm/v5"
cflags: "-O2 -mthumb -mthumb-interwork -march=armv4t"
cmake_opts: "-DAVM_DISABLE_SMP=On -DAVM_DISABLE_TASK_DRIVER=On"
tag: "stretch"
sources: |
deb [trusted=yes] http://archive.debian.org/debian/ stretch-backports main
deb [trusted=yes] http://archive.debian.org/debian/ stretch-backports-sloppy main
deb [trusted=yes] http://archive.debian.org/debian-security/ stretch/updates main
deb-src [trusted=yes] http://archive.debian.org/debian-security/ stretch/updates main
deb [trusted=yes] http://archive.debian.org/debian/ stretch main
deb-src [trusted=yes] http://archive.debian.org/debian/ stretch main
# Workaround from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=954852
install_deps: |
apt update &&
apt install -y -t stretch-backports-sloppy libarchive13 &&
apt install -y -t stretch-backports cmake &&
apt install -y file gcc g++ binutils make doxygen gperf zlib1g-dev libmbedtls-dev
- arch: "arm32v7"
platform: "arm/v7"
tag: "bullseye"
# -D_FILE_OFFSET_BITS=64 is required for making atomvm:posix_readdir/1 test work
# otherwise readdir will fail due to 64 bits inode numbers with 32 bit ino_t
cflags: "-mcpu=cortex-a7 -mfloat-abi=hard -O2 -mthumb -mthumb-interwork -D_FILE_OFFSET_BITS=64"
cmake_opts: "-DAVM_WARNINGS_ARE_ERRORS=ON"
- arch: "arm64v8"
platform: "arm64/v8"
tag: "bookworm"
cflags: "-O2"
cmake_opts: "-DAVM_WARNINGS_ARE_ERRORS=ON"
# Required for testing big endian archs
- arch: "s390x"
platform: "s390x"
tag: "bullseye"
cflags: "-O2"
cmake_opts: "-DAVM_WARNINGS_ARE_ERRORS=ON"
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: apt update
run: sudo apt update
- name: Install required packages
run: sudo apt install -y debootstrap
- name: Download test modules
uses: actions/download-artifact@v4
with:
name: test-modules
path: build_tests
- name: Set up QEMU
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: "Build and Test: AtomVM on foreign arch"
timeout-minutes: 15
run: |
docker run --platform linux/${{ matrix.platform }} --rm -v $PWD:/atomvm -w /atomvm \
-e CFLAGS="${{ matrix.cflags }}" -e CXXFLAGS="${{ matrix.cflags }}" \
${{ matrix.arch }}/debian:${{ matrix.tag }} /bin/bash -c '
([ -n "${{ matrix.sources }}" ] && echo "${{ matrix.sources }}" > /etc/apt/sources.list || true) &&
cat /etc/apt/sources.list || true &&
cat /etc/apt/sources.list.d/* || true &&
if test -n "${{ matrix.install_deps }}"; then
echo
${{ matrix.install_deps }}
else
apt update &&
apt install -y file gcc g++ binutils cmake make doxygen gperf zlib1g-dev libmbedtls-dev
fi &&
file /bin/bash &&
uname -a &&
cc --version &&
ld --version &&
ldd --version &&
echo $CFLAGS &&
echo $CXXFLAGS &&
cmake --version &&
mkdir -p build &&
cd build &&
cmake .. ${{ matrix.cmake_opts }} &&
cp ../build_tests/tests/erlang_tests/*.beam tests/erlang_tests/ &&
cp ../build_tests/tests/erlang_tests/code_load/*.{avm,beam,hrl} tests/erlang_tests/code_load/ &&
mkdir -p tests/erlang_tests/code_load/beams/ &&
cp ../build_tests/tests/erlang_tests/code_load/beams/*.beam tests/erlang_tests/code_load/beams/ &&
cp ../build_tests/tests/libs/etest/*.avm tests/libs/etest/ &&
cp ../build_tests/tests/libs/estdlib/*.avm tests/libs/estdlib/ &&
cp ../build_tests/tests/libs/eavmlib/*.avm tests/libs/eavmlib/ &&
cp ../build_tests/tests/libs/alisp/*.avm tests/libs/alisp/ &&
make AtomVM &&
make test-erlang &&
make test-enif &&
make test-mailbox &&
make test-structs &&
file ./tests/test-erlang &&
./tests/test-erlang -s prime_smp &&
file ./tests/test-enif &&
./tests/test-enif &&
file ./tests/test-mailbox &&
./tests/test-mailbox &&
file ./tests/test-structs &&
./tests/test-structs &&
file ./src/AtomVM &&
./src/AtomVM tests/libs/etest/test_etest.avm &&
./src/AtomVM tests/libs/estdlib/test_estdlib.avm &&
./src/AtomVM tests/libs/eavmlib/test_eavmlib.avm &&
./src/AtomVM tests/libs/alisp/test_alisp.avm
'