Skip to content

Commit 00a6eb6

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 start of every workflow to prevent runs from affecting each other. Signed-off-by: Matthew Gee <mgee@iol.unh.edu>
1 parent a99ab63 commit 00a6eb6

1 file changed

Lines changed: 49 additions & 32 deletions

File tree

.github/workflows/build.yml

Lines changed: 49 additions & 32 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,34 @@ jobs:
203214
env:
204215
WASI_SDK_PATH: /opt/wasi-sdk
205216

206-
- name: Upload .wasm artifact
217+
# Replace with cp to /var/ocre-ci-files
218+
# - name: Upload .wasm artifact
219+
# if: always()
220+
# uses: actions/upload-artifact@v4
221+
# with:
222+
# name: "${{ matrix.sample.name }}"
223+
# path: "ocre-sdk/${{ matrix.sample.path }}/build/${{ matrix.sample.filename }}"
224+
225+
# Saving files to the runner so avoid uploading .wasm files as artifacts
226+
- name: Save .wasm artifact locally
227+
if: always()
228+
run: cp "ocre-sdk/${{ matrix.sample.path }}/build/${{ matrix.sample.filename }}" "/var/ocre-ci-files/wasm/${{ matrix.sample.name }}/${{ matrix.sample.filename }}"
229+
230+
artifact-wasm-files:
231+
needs: build-wasm-files
232+
runs-on: zephyr-xlarge-runner
233+
steps:
234+
- name: Artifact local wasm files
207235
if: always()
208236
uses: actions/upload-artifact@v4
209237
with:
210-
name: "${{ matrix.sample.name }}"
211-
path: "ocre-sdk/${{ matrix.sample.path }}/build/${{ matrix.sample.filename }}"
238+
name: wasm-build-artifacts
239+
path: "/var/ocre-ci-files/wasm"
240+
241+
212242

213243
build-and-run-linux-sample:
214-
needs: build-wasm-files
244+
needs: artifact-wasm-files
215245
runs-on: ubuntu-latest
216246
strategy:
217247
matrix:
@@ -236,8 +266,9 @@ jobs:
236266
- name: Download wasm artifact
237267
uses: actions/download-artifact@v4
238268
with:
239-
name: "${{ matrix.sample.name }}"
240-
path: ${{ matrix.sample.name }}
269+
name: wasm-build-artifacts
270+
path: wasm-build-artifacts
271+
241272

242273
- name: Update Submodules
243274
working-directory: application
@@ -254,7 +285,7 @@ jobs:
254285
working-directory: application/build
255286
run: |
256287
echo "=== Running sample: ${{ matrix.sample.name }} ==="
257-
WASM_FILE=$GITHUB_WORKSPACE/${{ matrix.sample.name }}/${{ matrix.sample.build-file }}
288+
WASM_FILE=$GITHUB_WORKSPACE/wasm-build-artifacts/${{ matrix.sample.name }}/${{ matrix.sample.build-file }}
258289
chmod +x app
259290
stdbuf -oL -eL timeout 20s ./app $WASM_FILE | tee "${{ matrix.sample.name }}_run.log"
260291
@@ -268,7 +299,7 @@ jobs:
268299
269300
# Run zephyr agent on github actions runner
270301
build-and-run-zephyr-sample:
271-
needs: build-wasm-files
302+
needs: artifact-wasm-files
272303
runs-on: zephyr-xlarge-runner
273304
container:
274305
image: ghcr.io/zephyrproject-rtos/ci:v0.26-branch
@@ -312,11 +343,10 @@ jobs:
312343
sdk-version: 0.16.8
313344

314345
- name: Download wasm artifact
315-
if: runner.environment == 'self-hosted'
316346
uses: actions/download-artifact@v4
317347
with:
318-
name: "${{ matrix.sample.name }}"
319-
path: ${{ matrix.sample.name }}
348+
name: wasm-build-artifacts
349+
path: wasm-build-artifacts
320350

321351
- name: Update Submodules
322352
working-directory: application
@@ -326,7 +356,7 @@ jobs:
326356
- name: Build Zephyr app
327357
run: |
328358
echo "=== Build app ==="
329-
WASM_FILE=$GITHUB_WORKSPACE/${{ matrix.sample.name }}/${{ matrix.sample.build-file }}
359+
WASM_FILE=$GITHUB_WORKSPACE/wasm-build-artifacts/${{ matrix.sample.name }}/${{ matrix.sample.build-file }}
330360
west build --pristine -b native_sim ./application -d build -- \
331361
-DMODULE_EXT_ROOT=$(pwd)/application \
332362
-DOCRE_INPUT_FILE=$WASM_FILE
@@ -386,16 +416,9 @@ jobs:
386416
if: always()
387417
run: cat /tmp/flashValidation.log
388418

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-
396419

397420
build-zephyr-modbus_server-b_u585i_iot02a:
398-
needs: build-wasm-files
421+
needs: artifact-wasm-files
399422
runs-on: zephyr-xlarge-runner
400423
container:
401424
image: ghcr.io/zephyrproject-rtos/ci:v0.26-branch
@@ -425,11 +448,11 @@ jobs:
425448
env:
426449
WASI_SDK_PATH: /opt/wasi-sdk
427450

428-
- name: Download WASM artifact
451+
- name: Download wasm artifact
429452
uses: actions/download-artifact@v4
430453
with:
431-
name: b_u585i-modbus-server
432-
path: b_u585i-modbus-server
454+
name: wasm-build-artifacts
455+
path: wasm-build-artifacts
433456

434457
- name: Setup Zephyr project
435458
uses: zephyrproject-rtos/action-zephyr-setup@v1
@@ -439,7 +462,7 @@ jobs:
439462

440463
- name: Build b_u585i_iot02a with modbus-server
441464
run: |
442-
WASM_FILE=$GITHUB_WORKSPACE/b_u585i-modbus-server/modbus-server.wasm
465+
WASM_FILE=$GITHUB_WORKSPACE/wasm-build-artifacts/b_u585i-modbus-server/modbus-server.wasm
443466
west -v build --pristine=auto -b b_u585i_iot02a ./application -d build -- \
444467
-DMODULE_EXT_ROOT=$(pwd)/application \
445468
-DOCRE_INPUT_FILE=$WASM_FILE \
@@ -487,10 +510,4 @@ jobs:
487510
if: always()
488511
run: cat /tmp/modbusServerValidation.log
489512

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-
513+

0 commit comments

Comments
 (0)