@@ -36,8 +36,52 @@ concurrency:
3636 cancel-in-progress : true
3737
3838jobs :
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+ ninja
63+
64+ - name : Upload atomvmlib-pico artifact
65+ uses : actions/upload-artifact@v4
66+ with :
67+ name : atomvmlib-pico.uf2
68+ path : build/libs/atomvmlib-pico.uf2
69+
70+ - name : Upload atomvmlib-pico2 artifact
71+ uses : actions/upload-artifact@v4
72+ with :
73+ name : atomvmlib-pico2.uf2
74+ path : build/libs/atomvmlib-pico2.uf2
75+
76+ - name : Upload uf2tool artifact
77+ uses : actions/upload-artifact@v4
78+ with :
79+ name : uf2tool
80+ path : build/tools/uf2tool/uf2tool
81+
3982 pico :
4083 runs-on : ubuntu-24.04
84+ needs : build-atomvmlib
4185 strategy :
4286 matrix :
4387 board : ["pico", "pico_w", "pico2"]
4791 - name : Checkout repo
4892 uses : actions/checkout@v4
4993
94+ - name : Set and escape ref name
95+ shell : bash
96+ run : |
97+ echo "AVM_REF_NAME=${{ github.ref_name }}" | tr '/' '-' >> "$GITHUB_ENV";
98+
99+ - name : Download atomvmlib-pico artifact
100+ uses : actions/download-artifact@v4
101+ with :
102+ name : atomvmlib-pico.uf2
103+ path : build/libs/
104+
105+ - name : Download atomvmlib-pico2 artifact
106+ uses : actions/download-artifact@v4
107+ with :
108+ name : atomvmlib-pico2.uf2
109+ path : build/libs/
110+
111+ - name : Download uf2tool artifact
112+ uses : actions/download-artifact@v4
113+ with :
114+ name : uf2tool
115+ path : .
116+
50117 - name : " apt update"
51118 run : sudo apt update
52119
@@ -111,41 +178,44 @@ jobs:
111178 npm install
112179 npx tsx run-tests.ts ../build.nosmp/tests/rp2_tests.uf2 ../build.nosmp/tests/test_erl_sources/rp2_test_modules.uf2
113180
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-
124181 - name : Rename AtomVM and write sha256sum
125- if : startsWith(github.ref, 'refs/tags/')
126182 shell : bash
127183 run : |
128184 pushd src/platforms/rp2/build
129- ATOMVM_UF2=AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2
185+ ATOMVM_UF2=AtomVM-${{ matrix.board }}-${{env.AVM_REF_NAME }}.uf2
130186 mv src/AtomVM.uf2 "src/${ATOMVM_UF2}"
131187 sha256sum "src/${ATOMVM_UF2}" > "src/${ATOMVM_UF2}.sha256"
132188 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
189+
190+ - name : Upload AtomVM artifact
191+ uses : actions/upload-artifact@v4
192+ with :
193+ name : AtomVM-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2
194+ path : src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-*.uf2
138195
139196 - name : Rename atomvmlib and write sha256sum
140- if : startsWith(github.ref, 'refs/tags/') && matrix.board != 'pico_w'
141197 shell : bash
142198 run : |
143199 pushd build/libs
144- ATOMVMLIB_FILE=atomvmlib-${{ matrix.board }}-${{ github.ref_name }}.uf2
145- mv atomvmlib-${{ matrix.board }}.uf2 "${ATOMVMLIB_FILE}"
200+ ATOMVMLIB_FILE=atomvmlib-${{ matrix.board }}-${{env.AVM_REF_NAME }}.uf2
201+ mv atomvmlib-${{matrix.board == 'pico_w' && 'pico' || matrix.board }}.uf2 "${ATOMVMLIB_FILE}"
146202 sha256sum "${ATOMVMLIB_FILE}" > "${ATOMVMLIB_FILE}.sha256"
147203 popd
148204
205+ - name : Combine uf2 using uf2tool
206+ shell : bash
207+ run : |
208+ ATOMVM_COMBINED_FILE=AtomVM-combined-${{ matrix.board }}-${{env.AVM_REF_NAME}}.uf2
209+ ./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
210+ sha256sum "${ATOMVM_COMBINED_FILE}" > "${ATOMVM_COMBINED_FILE}.sha256"
211+ echo "ATOMVM_COMBINED_FILE=${ATOMVM_COMBINED_FILE}" >> $GITHUB_ENV
212+
213+ - name : Upload combined AtomVM artifact
214+ uses : actions/upload-artifact@v4
215+ with :
216+ name : ${{ env.ATOMVM_COMBINED_FILE }}
217+ path : ${{ env.ATOMVM_COMBINED_FILE }}
218+
149219 - name : Release (Pico & Pico2)
150220 uses : softprops/action-gh-release@v1
151221 if : startsWith(github.ref, 'refs/tags/') && matrix.board != 'pico_w'
@@ -157,6 +227,8 @@ jobs:
157227 src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2.sha256
158228 build/libs/atomvmlib-${{ matrix.board }}-${{ github.ref_name }}.uf2
159229 build/libs/atomvmlib-${{ matrix.board }}-${{ github.ref_name }}.uf2.sha256
230+ ${{ env.ATOMVM_COMBINED_FILE }}
231+ ${{ env.ATOMVM_COMBINED_FILE }}.sha256
160232
161233 - name : Release (PicoW)
162234 uses : softprops/action-gh-release@v1
@@ -167,3 +239,5 @@ jobs:
167239 files : |
168240 src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2
169241 src/platforms/rp2/build/src/AtomVM-${{ matrix.board }}-${{ github.ref_name }}.uf2.sha256
242+ ${{ env.ATOMVM_COMBINED_FILE }}
243+ ${{ env.ATOMVM_COMBINED_FILE }}.sha256
0 commit comments