Skip to content

Commit 51a0681

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 003afe8 commit 51a0681

File tree

1 file changed

+82
-20
lines changed

1 file changed

+82
-20
lines changed

.github/workflows/pico-build.yaml

Lines changed: 82 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"]
@@ -47,6 +85,23 @@ jobs:
4785
- name: Checkout repo
4886
uses: actions/checkout@v4
4987

88+
- name: Set and escape ref name
89+
shell: bash
90+
run: |
91+
echo "AVM_REF_NAME=${{ github.ref_name }}" | tr '/' '-' >> "$GITHUB_ENV";
92+
93+
- name: Download atomvmlib artifacts
94+
uses: actions/download-artifact@v4
95+
with:
96+
name: atomvmlib-uf2-files
97+
path: build/libs/
98+
99+
- name: Download uf2tool artifact
100+
uses: actions/download-artifact@v4
101+
with:
102+
name: uf2tool
103+
path: .
104+
50105
- name: "apt update"
51106
run: sudo apt update
52107

@@ -111,41 +166,44 @@ jobs:
111166
npm install
112167
npx tsx run-tests.ts ../build.nosmp/tests/rp2_tests.uf2 ../build.nosmp/tests/test_erl_sources/rp2_test_modules.uf2
113168
114-
- name: Build atomvmlib.uf2
115-
if: startsWith(github.ref, 'refs/tags/') && matrix.board != 'pico_w'
116-
shell: bash
117-
run: |
118-
set -euo pipefail
119-
mkdir build
120-
cd build
121-
cmake ..
122-
make atomvmlib-${{ matrix.board }}.uf2
123-
124169
- name: Rename AtomVM and write sha256sum
125-
if: startsWith(github.ref, 'refs/tags/')
126170
shell: bash
127171
run: |
128172
pushd src/platforms/rp2/build
129-
ATOMVM_UF2=AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2
173+
ATOMVM_UF2=AtomVM-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2
130174
mv src/AtomVM.uf2 "src/${ATOMVM_UF2}"
131175
sha256sum "src/${ATOMVM_UF2}" > "src/${ATOMVM_UF2}.sha256"
132176
popd
133-
pushd build/libs
134-
ATOMVMLIB_FILE=atomvmlib-${{ matrix.board }}-${{ github.ref_name }}.uf2
135-
mv atomvmlib.uf2 "${ATOMVMLIB_FILE}"
136-
sha256sum "${ATOMVMLIB_FILE}" > "${ATOMVMLIB_FILE}.sha256"
137-
popd
177+
178+
- name: Upload AtomVM artifact
179+
uses: actions/upload-artifact@v4
180+
with:
181+
name: AtomVM-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2
182+
path: src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-*.uf2
138183

139184
- name: Rename atomvmlib and write sha256sum
140-
if: startsWith(github.ref, 'refs/tags/') && matrix.board != 'pico_w'
141185
shell: bash
142186
run: |
143187
pushd build/libs
144-
ATOMVMLIB_FILE=atomvmlib-${{ matrix.board }}-${{ github.ref_name }}.uf2
145-
mv atomvmlib-${{ matrix.board }}.uf2 "${ATOMVMLIB_FILE}"
188+
ATOMVMLIB_FILE=atomvmlib-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2
189+
mv atomvmlib-${{matrix.board == 'pico_w' && 'pico' || matrix.board}}.uf2 "${ATOMVMLIB_FILE}"
146190
sha256sum "${ATOMVMLIB_FILE}" > "${ATOMVMLIB_FILE}.sha256"
147191
popd
148192
193+
- name: Combine uf2 using uf2tool
194+
shell: bash
195+
run: |
196+
ATOMVM_COMBINED_FILE=AtomVM-combined-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2
197+
./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
198+
sha256sum "${ATOMVM_COMBINED_FILE}" > "${ATOMVM_COMBINED_FILE}.sha256"
199+
echo "ATOMVM_COMBINED_FILE=${ATOMVM_COMBINED_FILE}" >> $GITHUB_ENV
200+
201+
- name: Upload combined AtomVM artifact
202+
uses: actions/upload-artifact@v4
203+
with:
204+
name: ${{ env.ATOMVM_COMBINED_FILE }}
205+
path: ${{ env.ATOMVM_COMBINED_FILE }}
206+
149207
- name: Release (Pico & Pico2)
150208
uses: softprops/action-gh-release@v1
151209
if: startsWith(github.ref, 'refs/tags/') && matrix.board != 'pico_w'
@@ -157,6 +215,8 @@ jobs:
157215
src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2.sha256
158216
build/libs/atomvmlib-${{ matrix.board }}-${{ github.ref_name }}.uf2
159217
build/libs/atomvmlib-${{ matrix.board }}-${{ github.ref_name }}.uf2.sha256
218+
${{ env.ATOMVM_COMBINED_FILE }}
219+
${{ env.ATOMVM_COMBINED_FILE }}.sha256
160220
161221
- name: Release (PicoW)
162222
uses: softprops/action-gh-release@v1
@@ -167,3 +227,5 @@ jobs:
167227
files: |
168228
src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2
169229
src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2.sha256
230+
${{ env.ATOMVM_COMBINED_FILE }}
231+
${{ env.ATOMVM_COMBINED_FILE }}.sha256

0 commit comments

Comments
 (0)