Skip to content

Commit 5daa426

Browse files
authored
refactor(ci): Cleanup the workspace for linux and zephyr builds (#157)
Due to self-hosted runners' specifics, old garbage might be still there when the new build is happening. Cleanup step would ensure that the workspace is ready. Additionally, the west update command may be checking out specific versions that don't preserve the submodule state from the initial checkout. The update submodule helps to fix this race condition. Signed-off-by: Krisztian Szilvasi <34309983+kr-t@users.noreply.github.com>
1 parent 1ab648e commit 5daa426

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

.github/workflows/linux.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ jobs:
2222
image: ghcr.io/${{ github.repository }}/devcontainer-linux:${{ inputs.devcontainer-tag }}
2323
options: --user 1000:1000
2424
steps:
25+
- name: Clean workspace
26+
run: |
27+
git clean -ffdx || true
28+
git reset --hard || true
29+
git submodule foreach --recursive git clean -ffdx || true
30+
git submodule foreach --recursive git reset --hard || true
31+
git submodule deinit --all -f || true
32+
continue-on-error: true
33+
2534
- name: Checkout
2635
uses: actions/checkout@v4
2736
with:

.github/workflows/zephyr.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,18 @@ jobs:
3232
- demo
3333
- supervisor
3434
steps:
35+
- name: Clean workspace
36+
run: |
37+
rm -rf ocre-runtime || true
38+
rm -rf ../.west || true
39+
continue-on-error: true
40+
3541
- name: Checkout
3642
uses: actions/checkout@v4
3743
with:
3844
path: ocre-runtime
3945
submodules: true
4046

41-
- name: Clean .west directory
42-
run: rm -rf ../.west
43-
4447
- name: West init
4548
run: |
4649
. /opt/zephyr-venv/bin/activate
@@ -51,8 +54,9 @@ jobs:
5154
. /opt/zephyr-venv/bin/activate
5255
west update
5356
54-
- name: Clean build directory
55-
run: rm -rf build
57+
- name: Update submodules
58+
run: |
59+
git submodule update --init --recursive
5660
5761
- name: West build
5862
run: |

0 commit comments

Comments
 (0)