Skip to content

Commit 32e4f49

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 32e4f49

1 file changed

Lines changed: 52 additions & 32 deletions

File tree

.github/workflows/build.yml

Lines changed: 52 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ on:
1212
- main
1313
- staging
1414
jobs:
15+
16+
setup-local-runner:
17+
runs-on: zephyr-xlarge-runner
18+
steps:
19+
- name: Create wasm directory
20+
run: mkdir /var/ocre-ci-files/wasm
21+
1522
build-zephyr-base:
1623
runs-on: zephyr-xlarge-runner
1724
container:
@@ -132,10 +139,11 @@ jobs:
132139
133140
# Build and upload wasm files as artifacts
134141
build-wasm-files:
142+
needs: setup-local-runner
135143
runs-on: zephyr-xlarge-runner
136144
container:
137145
image: ghcr.io/zephyrproject-rtos/ci:v0.26-branch
138-
options: --user root
146+
options: --user root -v /var/ocre-ci-files/:/var/ocre-ci-files/
139147
strategy:
140148
matrix:
141149
sample:
@@ -203,15 +211,34 @@ jobs:
203211
env:
204212
WASI_SDK_PATH: /opt/wasi-sdk
205213

206-
- name: Upload .wasm artifact
214+
# Replace with cp to /var/ocre-ci-files
215+
# - name: Upload .wasm artifact
216+
# if: always()
217+
# uses: actions/upload-artifact@v4
218+
# with:
219+
# name: "${{ matrix.sample.name }}"
220+
# path: "ocre-sdk/${{ matrix.sample.path }}/build/${{ matrix.sample.filename }}"
221+
222+
# Saving files to the runner so avoid uploading .wasm files as artifacts
223+
- name: Save .wasm artifact locally
224+
if: always()
225+
run: cp "ocre-sdk/${{ matrix.sample.path }}/build/${{ matrix.sample.filename }}" "/var/ocre-ci-files/wasm/${{ matrix.sample.filename }}"
226+
227+
artifact-wasm-files:
228+
needs: build-wasm-files
229+
runs-on: zephyr-xlarge-runner
230+
steps:
231+
- name: Artifact local wasm files
207232
if: always()
208233
uses: actions/upload-artifact@v4
209234
with:
210-
name: "${{ matrix.sample.name }}"
211-
path: "ocre-sdk/${{ matrix.sample.path }}/build/${{ matrix.sample.filename }}"
235+
name: wasm-build-artifacts
236+
path: "/var/ocre-ci/files/wasm"
237+
238+
212239

213240
build-and-run-linux-sample:
214-
needs: build-wasm-files
241+
needs: artifact-wasm-files
215242
runs-on: ubuntu-latest
216243
strategy:
217244
matrix:
@@ -236,8 +263,9 @@ jobs:
236263
- name: Download wasm artifact
237264
uses: actions/download-artifact@v4
238265
with:
239-
name: "${{ matrix.sample.name }}"
240-
path: ${{ matrix.sample.name }}
266+
name: wasm-build-artifacts
267+
path: wasm-build-artifacts
268+
241269

242270
- name: Update Submodules
243271
working-directory: application
@@ -254,7 +282,7 @@ jobs:
254282
working-directory: application/build
255283
run: |
256284
echo "=== Running sample: ${{ matrix.sample.name }} ==="
257-
WASM_FILE=$GITHUB_WORKSPACE/${{ matrix.sample.name }}/${{ matrix.sample.build-file }}
285+
WASM_FILE=$GITHUB_WORKSPACE/wasm-build-artifacts/${{ matrix.sample.name }}/${{ matrix.sample.build-file }}
258286
chmod +x app
259287
stdbuf -oL -eL timeout 20s ./app $WASM_FILE | tee "${{ matrix.sample.name }}_run.log"
260288
@@ -268,7 +296,7 @@ jobs:
268296
269297
# Run zephyr agent on github actions runner
270298
build-and-run-zephyr-sample:
271-
needs: build-wasm-files
299+
needs: artifact-wasm-files
272300
runs-on: zephyr-xlarge-runner
273301
container:
274302
image: ghcr.io/zephyrproject-rtos/ci:v0.26-branch
@@ -312,11 +340,10 @@ jobs:
312340
sdk-version: 0.16.8
313341

314342
- name: Download wasm artifact
315-
if: runner.environment == 'self-hosted'
316343
uses: actions/download-artifact@v4
317344
with:
318-
name: "${{ matrix.sample.name }}"
319-
path: ${{ matrix.sample.name }}
345+
name: wasm-build-artifacts
346+
path: wasm-build-artifacts
320347

321348
- name: Update Submodules
322349
working-directory: application
@@ -326,7 +353,7 @@ jobs:
326353
- name: Build Zephyr app
327354
run: |
328355
echo "=== Build app ==="
329-
WASM_FILE=$GITHUB_WORKSPACE/${{ matrix.sample.name }}/${{ matrix.sample.build-file }}
356+
WASM_FILE=$GITHUB_WORKSPACE/wasm-build-artifacts/${{ matrix.sample.name }}/${{ matrix.sample.build-file }}
330357
west build --pristine -b native_sim ./application -d build -- \
331358
-DMODULE_EXT_ROOT=$(pwd)/application \
332359
-DOCRE_INPUT_FILE=$WASM_FILE
@@ -386,16 +413,9 @@ jobs:
386413
if: always()
387414
run: cat /tmp/flashValidation.log
388415

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

397417
build-zephyr-modbus_server-b_u585i_iot02a:
398-
needs: build-wasm-files
418+
needs: artifact-wasm-files
399419
runs-on: zephyr-xlarge-runner
400420
container:
401421
image: ghcr.io/zephyrproject-rtos/ci:v0.26-branch
@@ -425,11 +445,11 @@ jobs:
425445
env:
426446
WASI_SDK_PATH: /opt/wasi-sdk
427447

428-
- name: Download WASM artifact
448+
- name: Download wasm artifact
429449
uses: actions/download-artifact@v4
430450
with:
431-
name: b_u585i-modbus-server
432-
path: b_u585i-modbus-server
451+
name: wasm-build-artifacts
452+
path: wasm-build-artifacts
433453

434454
- name: Setup Zephyr project
435455
uses: zephyrproject-rtos/action-zephyr-setup@v1
@@ -439,7 +459,7 @@ jobs:
439459

440460
- name: Build b_u585i_iot02a with modbus-server
441461
run: |
442-
WASM_FILE=$GITHUB_WORKSPACE/b_u585i-modbus-server/modbus-server.wasm
462+
WASM_FILE=$GITHUB_WORKSPACE/wasm-build-artifacts/b_u585i-modbus-server/modbus-server.wasm
443463
west -v build --pristine=auto -b b_u585i_iot02a ./application -d build -- \
444464
-DMODULE_EXT_ROOT=$(pwd)/application \
445465
-DOCRE_INPUT_FILE=$WASM_FILE \
@@ -487,10 +507,10 @@ jobs:
487507
if: always()
488508
run: cat /tmp/modbusServerValidation.log
489509

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-
510+
runner-cleanup:
511+
# All non-blocking jobs
512+
needs: [modbus-server-validation-tests, run-zephyr-base-native-sim, build-and-run-linux-sample, build-and-run-zephyr-sample, run-linux-base]
513+
runs-on: zephyr-xlarge-runner
514+
steps:
515+
- name: Remove old workflow files
516+
run: rm -rf /var/ocre-ci-files/*

0 commit comments

Comments
 (0)