Skip to content

Commit 8f4ceba

Browse files
committed
ci test
1 parent ca0cfca commit 8f4ceba

2 files changed

Lines changed: 104 additions & 90 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Prepare zenv native container
2+
description: Prepare a GitHub native job container to run zenv project commands.
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Configure zenv environment
7+
shell: bash
8+
run: |
9+
set -euo pipefail
10+
11+
project_root="${GITHUB_WORKSPACE:-${PWD}}"
12+
git config --global --add safe.directory "${project_root}"
13+
14+
source "${ZEPHYR_WS}/.venv/bin/activate"
15+
16+
echo "ZENV_PROJECT_ROOT=${project_root}" >> "${GITHUB_ENV}"
17+
echo "CCACHE_DIR=${project_root}/ccache" >> "${GITHUB_ENV}"
18+
echo "${VIRTUAL_ENV}/bin" >> "${GITHUB_PATH}"

.github/workflows/ci.yml

Lines changed: 86 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,17 @@ jobs:
7070
needs:
7171
- app-targets
7272
- devcontainer
73+
container:
74+
image: ${{ needs.devcontainer.outputs.image_name }}:${{ needs.devcontainer.outputs.image_tag }}
75+
credentials:
76+
username: ${{ github.repository_owner }}
77+
password: ${{ secrets.GITHUB_TOKEN }}
78+
options: --user root
79+
env:
80+
HOME: /home/ubuntu
81+
defaults:
82+
run:
83+
shell: bash
7384
strategy:
7485
fail-fast: false
7586
matrix:
@@ -86,37 +97,25 @@ jobs:
8697
uses: actions/checkout@v6
8798
with:
8899
fetch-depth: 0
89-
- name: Login to GitHub Container Registry
90-
uses: docker/login-action@v4
91-
with:
92-
registry: ghcr.io
93-
username: ${{ github.repository_owner }}
94-
password: ${{ secrets.GITHUB_TOKEN }}
100+
- name: Prepare zenv
101+
uses: ./.github/actions/prepare-zenv-native
95102
- name: Setup ccache
96103
uses: hendrikmuhs/ccache-action@v1.2
97104
with:
98105
key: app-${{ matrix.target }}
99106
restore-keys: app-${{ matrix.target }}
100107
max-size: 1G
101-
env:
102-
CCACHE_DIR: ${{ github.workspace }}/ccache
103108
- name: Build target
104-
uses: devcontainers/ci@v0.3
105-
with:
106-
configFile: .devcontainer/ci/devcontainer.json
107-
push: never
108-
runCmd: |
109-
set -euo pipefail
110-
git fetch --tags
111-
git rev-parse HEAD
112-
git status --short
113-
make TARGET=${{ matrix.target }}
114-
./scripts/copy_release_binaries.sh --build-dir=build --copy-dir=release/${{ matrix.target }}
115-
test -n "$(find release/${{ matrix.target }} -type f -print -quit)"
116-
cd release/${{ matrix.target }}
117-
python3 -m zipfile -c ../../release-${{ matrix.target }}.zip *
118-
env:
119-
OPENDECK_DEVCONTAINER_IMAGE: ${{ needs.devcontainer.outputs.image_name }}:${{ needs.devcontainer.outputs.image_tag }}
109+
run: |
110+
set -euo pipefail
111+
git fetch --tags
112+
git rev-parse HEAD
113+
git status --short
114+
make TARGET=${{ matrix.target }}
115+
./scripts/copy_release_binaries.sh --build-dir=build --copy-dir=release/${{ matrix.target }}
116+
test -n "$(find release/${{ matrix.target }} -type f -print -quit)"
117+
cd release/${{ matrix.target }}
118+
python3 -m zipfile -c ../../release-${{ matrix.target }}.zip *
120119
- name: Upload release binaries
121120
uses: actions/upload-artifact@v7
122121
with:
@@ -145,6 +144,17 @@ jobs:
145144
needs:
146145
- host-test-targets
147146
- devcontainer
147+
container:
148+
image: ${{ needs.devcontainer.outputs.image_name }}:${{ needs.devcontainer.outputs.image_tag }}
149+
credentials:
150+
username: ${{ github.repository_owner }}
151+
password: ${{ secrets.GITHUB_TOKEN }}
152+
options: --user root
153+
env:
154+
HOME: /home/ubuntu
155+
defaults:
156+
run:
157+
shell: bash
148158
steps:
149159
- name: Free Disk Space
150160
uses: jlumbroso/free-disk-space@main
@@ -157,36 +167,35 @@ jobs:
157167
uses: actions/checkout@v6
158168
with:
159169
fetch-depth: 0
160-
- name: Login to GitHub Container Registry
161-
uses: docker/login-action@v4
162-
with:
163-
registry: ghcr.io
164-
username: ${{ github.repository_owner }}
165-
password: ${{ secrets.GITHUB_TOKEN }}
170+
- name: Prepare zenv
171+
uses: ./.github/actions/prepare-zenv-native
166172
- name: Setup ccache
167173
uses: hendrikmuhs/ccache-action@v1.2
168174
with:
169175
key: host-test-shared
170176
restore-keys: host-test-shared
171177
max-size: 1G
172-
env:
173-
CCACHE_DIR: ${{ github.workspace }}/ccache
174178
- name: Run shared host tests
175-
uses: devcontainers/ci@v0.3
176-
with:
177-
configFile: .devcontainer/ci/devcontainer.json
178-
push: never
179-
runCmd: |
180-
set -euo pipefail
181-
./scripts/bulk_build.sh --type=host-test --test-scope=shared
182-
env:
183-
OPENDECK_DEVCONTAINER_IMAGE: ${{ needs.devcontainer.outputs.image_name }}:${{ needs.devcontainer.outputs.image_tag }}
179+
run: |
180+
set -euo pipefail
181+
./scripts/bulk_build.sh --type=host-test --test-scope=shared
184182
host-test-target:
185183
name: Tests (${{ matrix.target }})
186184
runs-on: ubuntu-latest
187185
needs:
188186
- host-test-targets
189187
- devcontainer
188+
container:
189+
image: ${{ needs.devcontainer.outputs.image_name }}:${{ needs.devcontainer.outputs.image_tag }}
190+
credentials:
191+
username: ${{ github.repository_owner }}
192+
password: ${{ secrets.GITHUB_TOKEN }}
193+
options: --user root
194+
env:
195+
HOME: /home/ubuntu
196+
defaults:
197+
run:
198+
shell: bash
190199
strategy:
191200
fail-fast: false
192201
matrix:
@@ -203,55 +212,43 @@ jobs:
203212
uses: actions/checkout@v6
204213
with:
205214
fetch-depth: 0
206-
- name: Login to GitHub Container Registry
207-
uses: docker/login-action@v4
208-
with:
209-
registry: ghcr.io
210-
username: ${{ github.repository_owner }}
211-
password: ${{ secrets.GITHUB_TOKEN }}
215+
- name: Prepare zenv
216+
uses: ./.github/actions/prepare-zenv-native
212217
- name: Setup ccache
213218
uses: hendrikmuhs/ccache-action@v1.2
214219
with:
215220
key: host-test-${{ matrix.target }}
216221
restore-keys: host-test-${{ matrix.target }}
217222
max-size: 1G
218-
env:
219-
CCACHE_DIR: ${{ github.workspace }}/ccache
220223
- name: Run host test
221-
uses: devcontainers/ci@v0.3
222-
with:
223-
configFile: .devcontainer/ci/devcontainer.json
224-
push: never
225-
runCmd: |
226-
set -euo pipefail
227-
make configure-app TARGET=${{ matrix.target }}
228-
./scripts/bulk_build.sh --type=host-test --test-scope=preset --test-target=${{ matrix.target }}
229-
env:
230-
OPENDECK_DEVCONTAINER_IMAGE: ${{ needs.devcontainer.outputs.image_name }}:${{ needs.devcontainer.outputs.image_tag }}
224+
run: |
225+
set -euo pipefail
226+
make configure-app TARGET=${{ matrix.target }}
227+
./scripts/bulk_build.sh --type=host-test --test-scope=preset --test-target=${{ matrix.target }}
231228
format:
232229
name: Code formatting
233230
runs-on: ubuntu-latest
234231
needs: devcontainer
232+
container:
233+
image: ${{ needs.devcontainer.outputs.image_name }}:${{ needs.devcontainer.outputs.image_tag }}
234+
credentials:
235+
username: ${{ github.repository_owner }}
236+
password: ${{ secrets.GITHUB_TOKEN }}
237+
options: --user root
238+
env:
239+
HOME: /home/ubuntu
240+
defaults:
241+
run:
242+
shell: bash
235243
steps:
236244
- name: Pull the repository
237245
uses: actions/checkout@v6
238246
with:
239247
fetch-depth: 0
240-
- name: Login to GitHub Container Registry
241-
uses: docker/login-action@v4
242-
with:
243-
registry: ghcr.io
244-
username: ${{ github.repository_owner }}
245-
password: ${{ secrets.GITHUB_TOKEN }}
248+
- name: Prepare zenv
249+
uses: ./.github/actions/prepare-zenv-native
246250
- name: Check formatting
247-
uses: devcontainers/ci@v0.3
248-
with:
249-
configFile: .devcontainer/ci/devcontainer.json
250-
push: never
251-
runCmd: |
252-
make format
253-
env:
254-
OPENDECK_DEVCONTAINER_IMAGE: ${{ needs.devcontainer.outputs.image_name }}:${{ needs.devcontainer.outputs.image_tag }}
251+
run: make format
255252
lint-targets:
256253
name: Lint targets
257254
runs-on: ubuntu-latest
@@ -274,6 +271,17 @@ jobs:
274271
needs:
275272
- lint-targets
276273
- devcontainer
274+
container:
275+
image: ${{ needs.devcontainer.outputs.image_name }}:${{ needs.devcontainer.outputs.image_tag }}
276+
credentials:
277+
username: ${{ github.repository_owner }}
278+
password: ${{ secrets.GITHUB_TOKEN }}
279+
options: --user root
280+
env:
281+
HOME: /home/ubuntu
282+
defaults:
283+
run:
284+
shell: bash
277285
strategy:
278286
fail-fast: false
279287
matrix:
@@ -290,27 +298,15 @@ jobs:
290298
uses: actions/checkout@v6
291299
with:
292300
fetch-depth: 0
293-
- name: Login to GitHub Container Registry
294-
uses: docker/login-action@v4
295-
with:
296-
registry: ghcr.io
297-
username: ${{ github.repository_owner }}
298-
password: ${{ secrets.GITHUB_TOKEN }}
301+
- name: Prepare zenv
302+
uses: ./.github/actions/prepare-zenv-native
299303
- name: Setup ccache
300304
uses: hendrikmuhs/ccache-action@v1.2
301305
with:
302306
key: lint-${{ matrix.target }}
303307
restore-keys: lint-${{ matrix.target }}
304308
max-size: 1G
305-
env:
306-
CCACHE_DIR: ${{ github.workspace }}/ccache
307309
- name: Run lint
308-
uses: devcontainers/ci@v0.3
309-
with:
310-
configFile: .devcontainer/ci/devcontainer.json
311-
push: never
312-
runCmd: |
313-
set -euo pipefail
314-
make CHECK=1 TARGET=${{ matrix.target }}
315-
env:
316-
OPENDECK_DEVCONTAINER_IMAGE: ${{ needs.devcontainer.outputs.image_name }}:${{ needs.devcontainer.outputs.image_tag }}
310+
run: |
311+
set -euo pipefail
312+
make CHECK=1 TARGET=${{ matrix.target }}

0 commit comments

Comments
 (0)