-
Notifications
You must be signed in to change notification settings - Fork 144
278 lines (241 loc) · 9.27 KB
/
pico-build.yaml
File metadata and controls
278 lines (241 loc) · 9.27 KB
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
#
# Copyright 2022 Paul Guyot <pguyot@kallisys.net>
#
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
#
name: Pico Build
on:
push:
paths:
- '.github/workflows/pico-build.yaml'
- 'CMakeLists.txt'
- 'CMakeModules/**'
- 'libs/**'
- 'src/platforms/rp2/**'
- 'src/platforms/esp32/test/main/test_erl_sources/test_crypto.erl'
- 'src/libAtomVM/**'
pull_request:
paths:
- '.github/workflows/pico-build.yaml'
- 'CMakeLists.txt'
- 'CMakeModules/**'
- 'libs/**'
- 'src/platforms/rp2/**'
- 'src/platforms/esp32/test/main/test_erl_sources/test_crypto.erl'
- 'src/libAtomVM/**'
permissions:
actions: read
contents: write
security-events: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref != 'refs/heads/main' && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
build-atomvmlib:
runs-on: ubuntu-24.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: "apt update"
run: sudo apt update
- name: "Install deps"
run: |
sudo apt install -y \
cmake doxygen gperf ninja-build
- uses: erlef/setup-beam@v1
with:
otp-version: "28.1"
rebar3-version: "3.24.0"
hexpm-mirrors: |
https://builds.hex.pm
https://repo.hex.pm
https://cdn.jsdelivr.net/hex
- name: Build atomvmlib-rp2-pico.uf2/atomvmlib-rp2-pico2.uf2
shell: bash
run: |
set -euo pipefail
mkdir build
cd build
cmake .. -G Ninja
cmake --build . -t atomvmlib-rp2
- name: Upload atomvmlib artifacts
uses: actions/upload-artifact@v4
with:
name: atomvmlib-uf2-files
path: build/libs/*.uf2
- name: Upload uf2tool artifact
uses: actions/upload-artifact@v4
with:
name: uf2tool
path: build/tools/uf2tool/uf2tool
pico:
runs-on: ubuntu-24.04
needs: build-atomvmlib
strategy:
matrix:
board: ["pico", "pico_w", "pico2", "pico2_w"]
platform: [""]
jit: ["", "-DAVM_DISABLE_JIT=OFF"]
include:
- board: "pico2"
platform: "-DPICO_PLATFORM=rp2350-riscv"
jit: ""
- board: "pico2"
platform: "-DPICO_PLATFORM=rp2350-riscv"
jit: "-DAVM_DISABLE_JIT=OFF"
- board: "pico2_w"
platform: "-DPICO_PLATFORM=rp2350-riscv"
jit: ""
- board: "pico2_w"
platform: "-DPICO_PLATFORM=rp2350-riscv"
jit: "-DAVM_DISABLE_JIT=OFF"
steps:
- name: Checkout repo
uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
otp-version: "28.1"
rebar3-version: "3.24.0"
hexpm-mirrors: |
https://builds.hex.pm
https://repo.hex.pm
https://cdn.jsdelivr.net/hex
- name: Set and escape ref name
shell: bash
run: |
echo "AVM_REF_NAME=${{ github.ref_name }}" | tr '/' '-' >> "$GITHUB_ENV";
- name: Download atomvmlib artifacts
uses: actions/download-artifact@v4
with:
name: atomvmlib-uf2-files
path: build/libs/
- name: Download uf2tool artifact
uses: actions/download-artifact@v4
with:
name: uf2tool
path: .
- name: "apt update"
run: sudo apt update
- name: "Install deps"
run: |
sudo apt install -y \
cmake doxygen gperf ninja-build gcc-arm-none-eabi \
libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib
- name: Install riscv32 toolchain
if: matrix.platform == '-DPICO_PLATFORM=rp2350-riscv'
run: |
sudo mkdir -p /opt/riscv32-toolchain
cd /opt/riscv32-toolchain
sudo wget -q https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.2.0-3/riscv-toolchain-15-x86_64-lin.tar.gz
sudo tar xzf riscv-toolchain-15-x86_64-lin.tar.gz
sudo rm riscv-toolchain-15-x86_64-lin.tar.gz
echo "/opt/riscv32-toolchain/bin" >> $GITHUB_PATH
- name: "Git config safe.directory for codeql"
run: git config --global --add safe.directory /__w/AtomVM/AtomVM
- name: "Initialize CodeQL"
uses: github/codeql-action/init@v4
with:
languages: "cpp"
build-mode: manual
queries: +./code-queries/term-to-non-term-func.ql,./code-queries/non-term-to-term-func.ql,./code-queries/mismatched-atom-string-length.ql,./code-queries/mismatched-free-type.ql,./code-queries/term-use-after-gc.ql
- name: Build
shell: bash
working-directory: ./src/platforms/rp2/
run: |
set -euo pipefail
mkdir build
cd build
cmake .. -G Ninja -DPICO_BOARD=${{ matrix.board }} ${{ matrix.platform }} ${{ matrix.jit }}
cmake --build . --target=AtomVM
- name: "Perform CodeQL Analysis"
uses: github/codeql-action/analyze@v4
- name: Install nvm and nodejs 20
if: matrix.board != 'pico2' && matrix.board != 'pico2_w'
run: |
set -euo pipefail
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
source $HOME/.nvm/nvm.sh
nvm install 24
- name: Build tests (without SMP)
if: matrix.board != 'pico2' && matrix.board != 'pico2_w'
shell: bash
working-directory: ./src/platforms/rp2/
run: |
set -euo pipefail
mkdir build.nosmp
cd build.nosmp
# TODO: fix all warnings and enable -DAVM_WARNINGS_ARE_ERRORS=ON
cmake .. -G Ninja -DPICO_BOARD=${{ matrix.board }} ${{ matrix.jit }} -DAVM_DISABLE_SMP=1
cmake --build . --target=rp2_tests
- name: Run tests with rp2040js
if: matrix.board != 'pico2' && matrix.board != 'pico2_w'
shell: bash
working-directory: ./src/platforms/rp2/tests
run: |
set -euo pipefail
source $HOME/.nvm/nvm.sh
nvm use node
npm install
npx tsx run-tests.ts ../build.nosmp/tests/rp2_tests.uf2 ../build.nosmp/tests/test_erl_sources/rp2_test_modules.uf2
- name: Rename AtomVM and write sha256sum
if: matrix.platform == '' && matrix.jit == ''
shell: bash
run: |
pushd src/platforms/rp2/build
ATOMVM_UF2=AtomVM-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2
mv src/AtomVM.uf2 "src/${ATOMVM_UF2}"
sha256sum "src/${ATOMVM_UF2}" > "src/${ATOMVM_UF2}.sha256"
popd
- name: Upload AtomVM artifact
if: matrix.platform == '' && matrix.jit == ''
uses: actions/upload-artifact@v4
with:
name: AtomVM-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2
path: src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-*.uf2
- name: Rename atomvmlib-rp2 and write sha256sum
if: matrix.platform == '' && matrix.jit == ''
shell: bash
run: |
pushd build/libs
ATOMVMLIB_FILE=atomvmlib-rp2-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2
mv atomvmlib-rp2-${{matrix.board == 'pico_w' && 'pico' || matrix.board == 'pico2_w' && 'pico2' || matrix.board}}.uf2 "${ATOMVMLIB_FILE}"
sha256sum "${ATOMVMLIB_FILE}" > "${ATOMVMLIB_FILE}.sha256"
popd
- name: Combine uf2 using uf2tool
if: matrix.platform == '' && matrix.jit == ''
shell: bash
run: |
ATOMVM_COMBINED_FILE=AtomVM-combined-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2
./uf2tool join -o "${ATOMVM_COMBINED_FILE}" src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2 build/libs/atomvmlib-rp2-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2
sha256sum "${ATOMVM_COMBINED_FILE}" > "${ATOMVM_COMBINED_FILE}.sha256"
echo "ATOMVM_COMBINED_FILE=${ATOMVM_COMBINED_FILE}" >> $GITHUB_ENV
- name: Upload combined AtomVM artifact
if: matrix.platform == '' && matrix.jit == ''
uses: actions/upload-artifact@v4
with:
name: ${{ env.ATOMVM_COMBINED_FILE }}
path: ${{ env.ATOMVM_COMBINED_FILE }}
- name: Release (Pico & Pico2)
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && matrix.board != 'pico_w' && matrix.board != 'pico2_w' && matrix.platform == '' && matrix.jit == ''
with:
draft: true
fail_on_unmatched_files: true
files: |
src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2
src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2.sha256
build/libs/atomvmlib-rp2-${{ matrix.board }}-${{ github.ref_name }}.uf2
build/libs/atomvmlib-rp2-${{ matrix.board }}-${{ github.ref_name }}.uf2.sha256
${{ env.ATOMVM_COMBINED_FILE }}
${{ env.ATOMVM_COMBINED_FILE }}.sha256
- name: Release (PicoW & Pico2W)
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && (matrix.board == 'pico_w' || matrix.board == 'pico2_w') && matrix.platform == '' && matrix.jit == ''
with:
draft: true
fail_on_unmatched_files: true
files: |
src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2
src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2.sha256
${{ env.ATOMVM_COMBINED_FILE }}
${{ env.ATOMVM_COMBINED_FILE }}.sha256