Skip to content

Commit 2d7d1ad

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 <petermm@gmail.com>
1 parent 6f66fa4 commit 2d7d1ad

File tree

1 file changed

+95
-21
lines changed

1 file changed

+95
-21
lines changed

.github/workflows/pico-build.yaml

Lines changed: 95 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,53 @@ 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
52+
53+
- uses: erlef/setup-beam@v1
54+
with:
55+
otp-version: "28.1"
56+
rebar3-version: "3.24.0"
57+
hexpm-mirrors: |
58+
https://builds.hex.pm
59+
https://repo.hex.pm
60+
https://cdn.jsdelivr.net/hex
61+
62+
- name: Build atomvmlib-pico.uf2/atomvmlib-pico2.uf2
63+
shell: bash
64+
run: |
65+
set -euo pipefail
66+
mkdir build
67+
cd build
68+
cmake .. -G Ninja
69+
cmake --build . -t atomvmlib
70+
71+
- name: Upload atomvmlib artifacts
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: atomvmlib-uf2-files
75+
path: build/libs/*.uf2
76+
77+
- name: Upload uf2tool artifact
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: uf2tool
81+
path: build/tools/uf2tool/uf2tool
82+
3983
pico:
4084
runs-on: ubuntu-24.04
85+
needs: build-atomvmlib
4186
strategy:
4287
matrix:
4388
board: ["pico", "pico_w", "pico2"]
@@ -65,6 +110,23 @@ jobs:
65110
https://repo.hex.pm
66111
https://cdn.jsdelivr.net/hex
67112
113+
- name: Set and escape ref name
114+
shell: bash
115+
run: |
116+
echo "AVM_REF_NAME=${{ github.ref_name }}" | tr '/' '-' >> "$GITHUB_ENV";
117+
118+
- name: Download atomvmlib artifacts
119+
uses: actions/download-artifact@v4
120+
with:
121+
name: atomvmlib-uf2-files
122+
path: build/libs/
123+
124+
- name: Download uf2tool artifact
125+
uses: actions/download-artifact@v4
126+
with:
127+
name: uf2tool
128+
path: .
129+
68130
- name: "apt update"
69131
run: sudo apt update
70132

@@ -102,7 +164,7 @@ jobs:
102164
mkdir build
103165
cd build
104166
cmake .. -G Ninja -DPICO_BOARD=${{ matrix.board }} ${{ matrix.platform }} ${{ matrix.jit }}
105-
ninja
167+
cmake --build . --target=AtomVM
106168
107169
- name: "Perform CodeQL Analysis"
108170
uses: github/codeql-action/analyze@v4
@@ -138,41 +200,49 @@ jobs:
138200
npm install
139201
npx tsx run-tests.ts ../build.nosmp/tests/rp2_tests.uf2 ../build.nosmp/tests/test_erl_sources/rp2_test_modules.uf2
140202
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-
151203
- name: Rename AtomVM and write sha256sum
152-
if: startsWith(github.ref, 'refs/tags/') && matrix.platform == '' && matrix.jit == ''
204+
if: matrix.platform == '' && matrix.jit == ''
153205
shell: bash
154206
run: |
155207
pushd src/platforms/rp2/build
156-
ATOMVM_UF2=AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2
208+
ATOMVM_UF2=AtomVM-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2
157209
mv src/AtomVM.uf2 "src/${ATOMVM_UF2}"
158210
sha256sum "src/${ATOMVM_UF2}" > "src/${ATOMVM_UF2}.sha256"
159211
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
212+
213+
- name: Upload AtomVM artifact
214+
if: matrix.platform == '' && matrix.jit == ''
215+
uses: actions/upload-artifact@v4
216+
with:
217+
name: AtomVM-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2
218+
path: src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-*.uf2
165219

166220
- name: Rename atomvmlib and write sha256sum
167-
if: startsWith(github.ref, 'refs/tags/') && matrix.board != 'pico_w' && matrix.platform == '' && matrix.jit == ''
221+
if: matrix.platform == '' && matrix.jit == ''
168222
shell: bash
169223
run: |
170224
pushd build/libs
171-
ATOMVMLIB_FILE=atomvmlib-${{ matrix.board }}-${{ github.ref_name }}.uf2
172-
mv atomvmlib-${{ matrix.board }}.uf2 "${ATOMVMLIB_FILE}"
225+
ATOMVMLIB_FILE=atomvmlib-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2
226+
mv atomvmlib-${{matrix.board == 'pico_w' && 'pico' || matrix.board}}.uf2 "${ATOMVMLIB_FILE}"
173227
sha256sum "${ATOMVMLIB_FILE}" > "${ATOMVMLIB_FILE}.sha256"
174228
popd
175229
230+
- name: Combine uf2 using uf2tool
231+
if: matrix.platform == '' && matrix.jit == ''
232+
shell: bash
233+
run: |
234+
ATOMVM_COMBINED_FILE=AtomVM-combined-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2
235+
./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
236+
sha256sum "${ATOMVM_COMBINED_FILE}" > "${ATOMVM_COMBINED_FILE}.sha256"
237+
echo "ATOMVM_COMBINED_FILE=${ATOMVM_COMBINED_FILE}" >> $GITHUB_ENV
238+
239+
- name: Upload combined AtomVM artifact
240+
if: matrix.platform == '' && matrix.jit == ''
241+
uses: actions/upload-artifact@v4
242+
with:
243+
name: ${{ env.ATOMVM_COMBINED_FILE }}
244+
path: ${{ env.ATOMVM_COMBINED_FILE }}
245+
176246
- name: Release (Pico & Pico2)
177247
uses: softprops/action-gh-release@v1
178248
if: startsWith(github.ref, 'refs/tags/') && matrix.board != 'pico_w' && matrix.platform == '' && matrix.jit == ''
@@ -184,6 +254,8 @@ jobs:
184254
src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2.sha256
185255
build/libs/atomvmlib-${{ matrix.board }}-${{ github.ref_name }}.uf2
186256
build/libs/atomvmlib-${{ matrix.board }}-${{ github.ref_name }}.uf2.sha256
257+
${{ env.ATOMVM_COMBINED_FILE }}
258+
${{ env.ATOMVM_COMBINED_FILE }}.sha256
187259
188260
- name: Release (PicoW)
189261
uses: softprops/action-gh-release@v1
@@ -194,3 +266,5 @@ jobs:
194266
files: |
195267
src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2
196268
src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2.sha256
269+
${{ env.ATOMVM_COMBINED_FILE }}
270+
${{ env.ATOMVM_COMBINED_FILE }}.sha256

0 commit comments

Comments
 (0)