Skip to content

Commit cf6341a

Browse files
committed
Github Artifact Cleanup
Removed artifacting of log files and combined wasm artifact uploads into a singluar artifact. Currently the build wasm step saves all artifacts to a directory local on disk and they are artifacted in a seperate step. The directory used is cleaned at the end of the workflow to prevent runs from affecting each other. Signed-off-by: Matthew Gee <mgee@iol.unh.edu>
1 parent a99ab63 commit cf6341a

File tree

1 file changed

+41
-33
lines changed

1 file changed

+41
-33
lines changed

.github/workflows/build.yml

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ on:
1212
- main
1313
- staging
1414
jobs:
15+
16+
setup-local-runner:
17+
runs-on: zephyr-xlarge-runner
18+
steps:
19+
- name: Remove old workflow files
20+
run: rm -rf /var/ocre-ci-files/*
21+
22+
- name: Create wasm directory
23+
run: mkdir /var/ocre-ci-files/wasm
24+
1525
build-zephyr-base:
1626
runs-on: zephyr-xlarge-runner
1727
container:
@@ -132,10 +142,11 @@ jobs:
132142
133143
# Build and upload wasm files as artifacts
134144
build-wasm-files:
145+
needs: setup-local-runner
135146
runs-on: zephyr-xlarge-runner
136147
container:
137148
image: ghcr.io/zephyrproject-rtos/ci:v0.26-branch
138-
options: --user root
149+
options: --user root -v /var/ocre-ci-files/:/var/ocre-ci-files/
139150
strategy:
140151
matrix:
141152
sample:
@@ -203,15 +214,26 @@ jobs:
203214
env:
204215
WASI_SDK_PATH: /opt/wasi-sdk
205216

206-
- name: Upload .wasm artifact
217+
# Saving files to the runner so avoid uploading .wasm files as artifacts individually, uploaded in separate step
218+
- name: Save .wasm artifact locally
219+
if: always()
220+
run: |
221+
mkdir /var/ocre-ci-files/wasm/${{ matrix.sample.name }}/
222+
cp "ocre-sdk/${{ matrix.sample.path }}/build/${{ matrix.sample.filename }}" "/var/ocre-ci-files/wasm/${{ matrix.sample.name }}/${{ matrix.sample.filename }}"
223+
224+
artifact-wasm-files:
225+
needs: build-wasm-files
226+
runs-on: zephyr-xlarge-runner
227+
steps:
228+
- name: Artifact local wasm files
207229
if: always()
208230
uses: actions/upload-artifact@v4
209231
with:
210-
name: "${{ matrix.sample.name }}"
211-
path: "ocre-sdk/${{ matrix.sample.path }}/build/${{ matrix.sample.filename }}"
232+
name: wasm-build-artifacts
233+
path: "/var/ocre-ci-files/wasm"
212234

213235
build-and-run-linux-sample:
214-
needs: build-wasm-files
236+
needs: artifact-wasm-files
215237
runs-on: ubuntu-latest
216238
strategy:
217239
matrix:
@@ -236,8 +258,9 @@ jobs:
236258
- name: Download wasm artifact
237259
uses: actions/download-artifact@v4
238260
with:
239-
name: "${{ matrix.sample.name }}"
240-
path: ${{ matrix.sample.name }}
261+
name: wasm-build-artifacts
262+
path: wasm-build-artifacts
263+
241264

242265
- name: Update Submodules
243266
working-directory: application
@@ -254,7 +277,7 @@ jobs:
254277
working-directory: application/build
255278
run: |
256279
echo "=== Running sample: ${{ matrix.sample.name }} ==="
257-
WASM_FILE=$GITHUB_WORKSPACE/${{ matrix.sample.name }}/${{ matrix.sample.build-file }}
280+
WASM_FILE=$GITHUB_WORKSPACE/wasm-build-artifacts/${{ matrix.sample.name }}/${{ matrix.sample.build-file }}
258281
chmod +x app
259282
stdbuf -oL -eL timeout 20s ./app $WASM_FILE | tee "${{ matrix.sample.name }}_run.log"
260283
@@ -265,10 +288,9 @@ jobs:
265288
exit 1
266289
fi
267290
268-
269291
# Run zephyr agent on github actions runner
270292
build-and-run-zephyr-sample:
271-
needs: build-wasm-files
293+
needs: artifact-wasm-files
272294
runs-on: zephyr-xlarge-runner
273295
container:
274296
image: ghcr.io/zephyrproject-rtos/ci:v0.26-branch
@@ -312,11 +334,10 @@ jobs:
312334
sdk-version: 0.16.8
313335

314336
- name: Download wasm artifact
315-
if: runner.environment == 'self-hosted'
316337
uses: actions/download-artifact@v4
317338
with:
318-
name: "${{ matrix.sample.name }}"
319-
path: ${{ matrix.sample.name }}
339+
name: wasm-build-artifacts
340+
path: wasm-build-artifacts
320341

321342
- name: Update Submodules
322343
working-directory: application
@@ -326,7 +347,7 @@ jobs:
326347
- name: Build Zephyr app
327348
run: |
328349
echo "=== Build app ==="
329-
WASM_FILE=$GITHUB_WORKSPACE/${{ matrix.sample.name }}/${{ matrix.sample.build-file }}
350+
WASM_FILE=$GITHUB_WORKSPACE/wasm-build-artifacts/${{ matrix.sample.name }}/${{ matrix.sample.build-file }}
330351
west build --pristine -b native_sim ./application -d build -- \
331352
-DMODULE_EXT_ROOT=$(pwd)/application \
332353
-DOCRE_INPUT_FILE=$WASM_FILE
@@ -386,16 +407,9 @@ jobs:
386407
if: always()
387408
run: cat /tmp/flashValidation.log
388409

389-
- name: Upload log file as artifact
390-
if: always()
391-
uses: actions/upload-artifact@v4
392-
with:
393-
name: "FlashValidation.log"
394-
path: /tmp/flashValidation.log
395-
396410

397411
build-zephyr-modbus_server-b_u585i_iot02a:
398-
needs: build-wasm-files
412+
needs: artifact-wasm-files
399413
runs-on: zephyr-xlarge-runner
400414
container:
401415
image: ghcr.io/zephyrproject-rtos/ci:v0.26-branch
@@ -425,11 +439,11 @@ jobs:
425439
env:
426440
WASI_SDK_PATH: /opt/wasi-sdk
427441

428-
- name: Download WASM artifact
442+
- name: Download wasm artifact
429443
uses: actions/download-artifact@v4
430444
with:
431-
name: b_u585i-modbus-server
432-
path: b_u585i-modbus-server
445+
name: wasm-build-artifacts
446+
path: wasm-build-artifacts
433447

434448
- name: Setup Zephyr project
435449
uses: zephyrproject-rtos/action-zephyr-setup@v1
@@ -439,7 +453,7 @@ jobs:
439453

440454
- name: Build b_u585i_iot02a with modbus-server
441455
run: |
442-
WASM_FILE=$GITHUB_WORKSPACE/b_u585i-modbus-server/modbus-server.wasm
456+
WASM_FILE=$GITHUB_WORKSPACE/wasm-build-artifacts/b_u585i-modbus-server/modbus-server.wasm
443457
west -v build --pristine=auto -b b_u585i_iot02a ./application -d build -- \
444458
-DMODULE_EXT_ROOT=$(pwd)/application \
445459
-DOCRE_INPUT_FILE=$WASM_FILE \
@@ -487,10 +501,4 @@ jobs:
487501
if: always()
488502
run: cat /tmp/modbusServerValidation.log
489503

490-
- name: Upload log file as artifact
491-
if: always()
492-
uses: actions/upload-artifact@v4
493-
with:
494-
name: "ModbusServerValidation.log"
495-
path: /tmp/modbusServerValidation.log
496-
504+

0 commit comments

Comments
 (0)