-
Notifications
You must be signed in to change notification settings - Fork 106
254 lines (229 loc) · 9.26 KB
/
build-linux-artifacts.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
#
# Copyright 2022 Davide Bettio <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
#
name: Build Linux Artifacts
on:
push:
tags:
- '**'
permissions:
contents: write
env:
otp_version: 24
elixir_version: 1.14
jobs:
compile_tests:
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.otp_version }}
elixir-version: ${{ env.elixir_version }}
- name: apt update
run: sudo apt update
- name: Install required packages
run: sudo apt install -y gperf
- name: Compile test modules
run: |
set -e
mkdir build_tests
cd build_tests
cmake ..
make erlang_test_modules
make test_estdlib
make test_eavmlib
make test_alisp
- name: Upload test modules
uses: actions/upload-artifact@v3
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-22.04
strategy:
fail-fast: false
matrix:
include:
- arch: "arm32v5"
build_name: "linux-arm32v5"
docker_image: "arm32v5/debian"
platform: "arm/v5"
cflags: "-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 tzdata
- arch: "arm32v7"
build_name: "linux-arm32v7thl"
docker_image: "arm32v7/debian"
platform: "arm/v7"
tag: "stretch"
cflags: "-mfloat-abi=hard -mthumb -mthumb-interwork"
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 tzdata
- arch: "arm64v8"
build_name: "linux-arm64v8"
docker_image: "arm64v8/ubuntu"
platform: "arm64/v8"
tag: "22.04"
cflags: ""
- arch: "riscv64"
build_name: "linux-riscv64"
docker_image: "riscv64/ubuntu"
platform: "riscv64"
tag: "22.04"
cflags: ""
- arch: "x86_64"
build_name: "linux-x86_64-static-mbedtls"
docker_image: "ubuntu"
platform: "amd64"
tag: "18.04"
cflags: ""
cmake_opts: "-DAVM_STATIC_MBEDTLS=ON"
install_deps: |
apt update &&
apt install -y file gcc g++ binutils make doxygen gperf zlib1g-dev libmbedtls-dev wget tzdata &&
apt purge -y cmake &&
wget https://cmake.org/files/v3.13/cmake-3.13.5-Linux-x86_64.tar.gz &&
tar xf cmake-3.13.5-Linux-x86_64.tar.gz &&
mv cmake-3.13.5-Linux-x86_64 /opt/cmake-3.13.5 &&
ln -sf /opt/cmake-3.13.5/bin/* /usr/bin/
- arch: "x86_64"
build_name: "linux-x86_64"
docker_image: "ubuntu"
platform: "amd64"
tag: "18.04"
cflags: ""
install_deps: |
apt update &&
apt install -y file gcc g++ binutils make doxygen gperf zlib1g-dev libmbedtls-dev wget tzdata &&
apt purge -y cmake &&
wget https://cmake.org/files/v3.13/cmake-3.13.5-Linux-x86_64.tar.gz &&
tar xf cmake-3.13.5-Linux-x86_64.tar.gz &&
mv cmake-3.13.5-Linux-x86_64 /opt/cmake-3.13.5 &&
ln -sf /opt/cmake-3.13.5/bin/* /usr/bin/
- arch: "i386"
build_name: "linux-i386"
docker_image: "i386/debian"
platform: "386"
cflags: ""
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
steps:
- name: Checkout repo
uses: actions/checkout@v3
- 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@v3
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 AtomVM using docker
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.docker_image }}:${{ matrix.tag }} /bin/bash -c '
([ -n "${{ matrix.sources }}" ] && echo "${{ matrix.sources }}" > /etc/apt/sources.list || true) &&
cat /etc/apt/sources.list &&
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 tzdata
fi &&
file /bin/bash &&
uname -a &&
cc --version &&
ld --version &&
ldd --version &&
echo $CFLAGS &&
echo $CXXFLAGS &&
cmake --version &&
mkdir -p build &&
cd build &&
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo ${{ 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/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/ &&
VERBOSE=1 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/estdlib/test_estdlib.avm &&
./src/AtomVM tests/libs/eavmlib/test_eavmlib.avm &&
./src/AtomVM tests/libs/alisp/test_alisp.avm &&
cp ./src/AtomVM ./AtomVM-${{ matrix.build_name }}-${{ github.ref_name }} &&
sha256sum ./src/AtomVM > ./AtomVM-${{ matrix.build_name }}-${{ github.ref_name }}.sha256
'
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
fail_on_unmatched_files: true
files: |
build/AtomVM*