Skip to content

Commit 11f7926

Browse files
committed
CI: Fix pico, add combined uf2 & artifacts
CI for release was using outdated way of building atomvmlib-pico.uf2/atomvmlib-pico2.uf2, fixed to the ninja building. Moved said building to a job before, the various pico builds. Removed wrong 'mv atomvmlib.uf2' segment, file is non-existent on new ninja builds. Added combined uf2 artifacts using uf2tool. Upload the artifacts, so they are available for testing. Include combined artifact in release. Signed-off-by: Peter M <[email protected]>
1 parent 98a57a2 commit 11f7926

File tree

1 file changed

+87
-20
lines changed

1 file changed

+87
-20
lines changed

.github/workflows/pico-build.yaml

Lines changed: 87 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,46 @@ concurrency:
3636
cancel-in-progress: true
3737

3838
jobs:
39+
build-atomvmlib:
40+
runs-on: ubuntu-24.04
41+
steps:
42+
- name: Checkout repo
43+
uses: actions/checkout@v4
44+
45+
- name: "apt update"
46+
run: sudo apt update
47+
48+
- name: "Install deps"
49+
run: |
50+
sudo apt install -y \
51+
cmake doxygen gperf ninja-build gcc-arm-none-eabi \
52+
libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib \
53+
erlang-base erlang-dev erlang-dialyzer erlang-eunit rebar3
54+
55+
- name: Build atomvmlib-pico.uf2/atomvmlib-pico2.uf2
56+
shell: bash
57+
run: |
58+
set -euo pipefail
59+
mkdir build
60+
cd build
61+
cmake .. -G Ninja
62+
cmake --build . -t atomvmlib
63+
64+
- name: Upload atomvmlib artifacts
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: atomvmlib-uf2-files
68+
path: build/libs/*.uf2
69+
70+
- name: Upload uf2tool artifact
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: uf2tool
74+
path: build/tools/uf2tool/uf2tool
75+
3976
pico:
4077
runs-on: ubuntu-24.04
78+
needs: build-atomvmlib
4179
strategy:
4280
matrix:
4381
board: ["pico", "pico_w", "pico2"]
@@ -65,6 +103,23 @@ jobs:
65103
https://repo.hex.pm
66104
https://cdn.jsdelivr.net/hex
67105
106+
- name: Set and escape ref name
107+
shell: bash
108+
run: |
109+
echo "AVM_REF_NAME=${{ github.ref_name }}" | tr '/' '-' >> "$GITHUB_ENV";
110+
111+
- name: Download atomvmlib artifacts
112+
uses: actions/download-artifact@v4
113+
with:
114+
name: atomvmlib-uf2-files
115+
path: build/libs/
116+
117+
- name: Download uf2tool artifact
118+
uses: actions/download-artifact@v4
119+
with:
120+
name: uf2tool
121+
path: .
122+
68123
- name: "apt update"
69124
run: sudo apt update
70125

@@ -138,41 +193,49 @@ jobs:
138193
npm install
139194
npx tsx run-tests.ts ../build.nosmp/tests/rp2_tests.uf2 ../build.nosmp/tests/test_erl_sources/rp2_test_modules.uf2
140195
141-
- name: Build atomvmlib.uf2
142-
if: startsWith(github.ref, 'refs/tags/') && matrix.board != 'pico_w' && matrix.platform == '' && matrix.jit == ''
143-
shell: bash
144-
run: |
145-
set -euo pipefail
146-
mkdir build
147-
cd build
148-
cmake ..
149-
make atomvmlib-${{ matrix.board }}.uf2
150-
151196
- name: Rename AtomVM and write sha256sum
152-
if: startsWith(github.ref, 'refs/tags/') && matrix.platform == '' && matrix.jit == ''
197+
if: matrix.platform == '' && matrix.jit == ''
153198
shell: bash
154199
run: |
155200
pushd src/platforms/rp2/build
156-
ATOMVM_UF2=AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2
201+
ATOMVM_UF2=AtomVM-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2
157202
mv src/AtomVM.uf2 "src/${ATOMVM_UF2}"
158203
sha256sum "src/${ATOMVM_UF2}" > "src/${ATOMVM_UF2}.sha256"
159204
popd
160-
pushd build/libs
161-
ATOMVMLIB_FILE=atomvmlib-${{ matrix.board }}-${{ github.ref_name }}.uf2
162-
mv atomvmlib.uf2 "${ATOMVMLIB_FILE}"
163-
sha256sum "${ATOMVMLIB_FILE}" > "${ATOMVMLIB_FILE}.sha256"
164-
popd
205+
206+
- name: Upload AtomVM artifact
207+
if: matrix.platform == '' && matrix.jit == ''
208+
uses: actions/upload-artifact@v4
209+
with:
210+
name: AtomVM-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2
211+
path: src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-*.uf2
165212

166213
- name: Rename atomvmlib and write sha256sum
167-
if: startsWith(github.ref, 'refs/tags/') && matrix.board != 'pico_w' && matrix.platform == '' && matrix.jit == ''
214+
if: matrix.platform == '' && matrix.jit == ''
168215
shell: bash
169216
run: |
170217
pushd build/libs
171-
ATOMVMLIB_FILE=atomvmlib-${{ matrix.board }}-${{ github.ref_name }}.uf2
172-
mv atomvmlib-${{ matrix.board }}.uf2 "${ATOMVMLIB_FILE}"
218+
ATOMVMLIB_FILE=atomvmlib-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2
219+
mv atomvmlib-${{matrix.board == 'pico_w' && 'pico' || matrix.board}}.uf2 "${ATOMVMLIB_FILE}"
173220
sha256sum "${ATOMVMLIB_FILE}" > "${ATOMVMLIB_FILE}.sha256"
174221
popd
175222
223+
- name: Combine uf2 using uf2tool
224+
if: matrix.platform == '' && matrix.jit == ''
225+
shell: bash
226+
run: |
227+
ATOMVM_COMBINED_FILE=AtomVM-combined-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2
228+
./uf2tool join -o "${ATOMVM_COMBINED_FILE}" src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2 build/libs/atomvmlib-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2
229+
sha256sum "${ATOMVM_COMBINED_FILE}" > "${ATOMVM_COMBINED_FILE}.sha256"
230+
echo "ATOMVM_COMBINED_FILE=${ATOMVM_COMBINED_FILE}" >> $GITHUB_ENV
231+
232+
- name: Upload combined AtomVM artifact
233+
if: matrix.platform == '' && matrix.jit == ''
234+
uses: actions/upload-artifact@v4
235+
with:
236+
name: ${{ env.ATOMVM_COMBINED_FILE }}
237+
path: ${{ env.ATOMVM_COMBINED_FILE }}
238+
176239
- name: Release (Pico & Pico2)
177240
uses: softprops/action-gh-release@v1
178241
if: startsWith(github.ref, 'refs/tags/') && matrix.board != 'pico_w' && matrix.platform == '' && matrix.jit == ''
@@ -184,6 +247,8 @@ jobs:
184247
src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2.sha256
185248
build/libs/atomvmlib-${{ matrix.board }}-${{ github.ref_name }}.uf2
186249
build/libs/atomvmlib-${{ matrix.board }}-${{ github.ref_name }}.uf2.sha256
250+
${{ env.ATOMVM_COMBINED_FILE }}
251+
${{ env.ATOMVM_COMBINED_FILE }}.sha256
187252
188253
- name: Release (PicoW)
189254
uses: softprops/action-gh-release@v1
@@ -194,3 +259,5 @@ jobs:
194259
files: |
195260
src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2
196261
src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2.sha256
262+
${{ env.ATOMVM_COMBINED_FILE }}
263+
${{ env.ATOMVM_COMBINED_FILE }}.sha256

0 commit comments

Comments
 (0)