Skip to content

Commit 804716f

Browse files
workflow: Reduce CI time
- Speed up PR sample builds removing integration platforms. - paralleled twister jobs across the samples and variants. - Shared CI across four jobs with ccache and west/pip caching. Signed-off-by: Arkadiusz Balys <arkadiusz.balys@nordicsemi.no>
1 parent 077c720 commit 804716f

7 files changed

Lines changed: 110 additions & 175 deletions

File tree

.github/workflows/on_pr.yml

Lines changed: 68 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Build zigbee samples on pr
2-
on:
2+
on:
33
pull_request:
44
paths-ignore:
55
- 'docs/**'
@@ -20,37 +20,98 @@ on:
2020
permissions:
2121
contents: read
2222

23+
concurrency:
24+
group: zigbee-samples-${{ github.workflow }}-${{ github.head_ref || github.ref }}
25+
cancel-in-progress: true
26+
27+
env:
28+
CCACHE_DIR: ${{ github.workspace }}/.ccache
29+
CCACHE_COMPILERCHECK: content
30+
CCACHE_MAXSIZE: 2G
31+
CCACHE_SLOPPINESS: file_macro,time_macros,include_file_mtime,include_file_ctime
32+
WEST_PATH_CACHE: ${{ github.workspace }}/west-path-cache
33+
2334
jobs:
2435
Build-samples:
2536
runs-on: ubuntu-24.04
2637
container: ghcr.io/nrfconnect/sdk-nrf-toolchain:v3.4.0-rc1
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
subset: [1, 2, 3, 4]
2742
defaults:
2843
run:
2944
# Bash shell is needed to set toolchain related environment variables in docker container
3045
# It is a workaround for GitHub Actions limitation https://github.com/actions/runner/issues/1964
3146
shell: bash
32-
steps:
47+
steps:
3348
- name: Checkout repository code
3449
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4
3550
with:
36-
fetch-depth: 0
51+
fetch-depth: 1
3752
path: zigbee
53+
54+
- name: Restore west module path cache
55+
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
56+
with:
57+
path: west-path-cache
58+
key: west-path-cache-${{ hashFiles('zigbee/west.yml') }}
59+
restore-keys: |
60+
west-path-cache-
61+
62+
- name: Restore ccache
63+
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
64+
with:
65+
path: .ccache
66+
key: ccache-zigbee-${{ hashFiles('zigbee/west.yml') }}-${{ github.base_ref }}
67+
restore-keys: |
68+
ccache-zigbee-${{ hashFiles('zigbee/west.yml') }}-
69+
ccache-zigbee-
70+
71+
- name: Restore pip cache
72+
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4
73+
with:
74+
path: ~/.cache/pip
75+
key: pip-zigbee-${{ hashFiles('zigbee/west.yml') }}
76+
3877
- name: prepare west project
3978
run: |
4079
rm -rf .west
4180
west --version
42-
west init -l zigbee --mf west.yml &&
43-
west update -n -o=--depth=1 --path-cache /workdir/
81+
west init -l zigbee --mf west.yml
82+
west update -n -o=--depth=1 --path-cache "${WEST_PATH_CACHE}"
83+
4484
- name: Install Python deps for Matter (codegen + factory data)
4585
run: |
4686
pip3 install -r nrf/scripts/requirements-extra.txt
4787
pip3 install -r modules/lib/matter/scripts/setup/requirements.nrfconnect.txt
88+
89+
- name: Set up ccache
90+
run: |
91+
mkdir -p "${CCACHE_DIR}"
92+
ccache -z
93+
ccache -s
94+
4895
- name: Twister build samples
96+
# --integration limits each scenario to integration_platforms.
97+
# Scenarios tagged no_integration are excluded from PR CI (see sample.yaml).
98+
# Quarantine trims platform×scenario pairs for time; keep both layers.
4999
run: |
50100
source zephyr/zephyr-env.sh
51-
zephyr/scripts/twister --inline-logs --build-only -N --verbose -T zigbee/samples --all -x CONFIG_ZBOSS_HALT_ON_ASSERT=y -x CONFIG_RESET_ON_FATAL_ERROR=n -x CONFIG_FACTORY_RESET_PRESS_TIME_SECONDS=2
101+
zephyr/scripts/twister --build-only -N --inline-logs --verbose \
102+
-T zigbee/samples \
103+
--integration \
104+
-e no_integration \
105+
--subset ${{ matrix.subset }}/${{ strategy.job-total }} \
106+
-j "$(nproc)" \
107+
-M pass \
108+
-x CONFIG_ZBOSS_HALT_ON_ASSERT=y \
109+
-x CONFIG_RESET_ON_FATAL_ERROR=n \
110+
-x CONFIG_FACTORY_RESET_PRESS_TIME_SECONDS=2
111+
52112
- name: Store hex files
53113
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4
54114
with:
55-
name: hexes
115+
name: hexes-${{ matrix.subset }}
56116
path: twister-out/**/*.hex
117+
if-no-files-found: ignore

samples/light_bulb/sample.yaml

Lines changed: 9 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
sample:
22
description: Zigbee Light control - light bulb sample
33
name: Zigbee Light control
4+
common:
5+
tags:
6+
- ci_build
7+
- smoke
8+
- sysbuild
9+
- ci_samples_zigbee
410
tests:
511
sample.zigbee.light_bulb.matter:
612
sysbuild: true
@@ -10,17 +16,11 @@ tests:
1016
- SNIPPET=matter_fota_ext_flash
1117
integration_platforms:
1218
- nrf54l15dk/nrf54l15/cpuapp
13-
- nrf54lm20dk/nrf54lm20a/cpuapp
1419
- nrf54lm20dk/nrf54lm20b/cpuapp
1520
platform_allow:
1621
- nrf54l15dk/nrf54l15/cpuapp
1722
- nrf54lm20dk/nrf54lm20a/cpuapp
1823
- nrf54lm20dk/nrf54lm20b/cpuapp
19-
tags:
20-
- ci_build
21-
- smoke
22-
- sysbuild
23-
- ci_samples_zigbee
2424
sample.zigbee.light_bulb.matter.int_flash:
2525
sysbuild: true
2626
build_only: true
@@ -29,41 +29,28 @@ tests:
2929
integration_platforms:
3030
- nrf54lm20dk/nrf54lm20b/cpuapp
3131
platform_allow:
32+
- nrf54lm20dk/nrf54lm20a/cpuapp
3233
- nrf54lm20dk/nrf54lm20b/cpuapp
33-
tags:
34-
- ci_build
35-
- smoke
36-
- sysbuild
37-
- ci_samples_zigbee
3834
sample.zigbee.light_bulb.matter.release:
3935
sysbuild: true
4036
build_only: true
4137
extra_args:
4238
- FILE_SUFFIX=matter_fota
4339
- SNIPPET=matter_fota_ext_flash
4440
- EXTRA_CONF_FILE=matter_fota_release.conf
45-
integration_platforms:
46-
- nrf54l15dk/nrf54l15/cpuapp
47-
- nrf54lm20dk/nrf54lm20a/cpuapp
48-
- nrf54lm20dk/nrf54lm20b/cpuapp
4941
platform_allow:
5042
- nrf54l15dk/nrf54l15/cpuapp
5143
- nrf54lm20dk/nrf54lm20a/cpuapp
5244
- nrf54lm20dk/nrf54lm20b/cpuapp
5345
tags:
54-
- ci_build
55-
- smoke
56-
- sysbuild
57-
- ci_samples_zigbee
46+
- no_integration
5847
sample.zigbee.light_bulb:
5948
sysbuild: true
6049
build_only: true
6150
integration_platforms:
6251
- nrf52840dk/nrf52840
6352
- nrf5340dk/nrf5340/cpuapp
64-
- nrf54l15dk/nrf54l10/cpuapp
6553
- nrf54l15dk/nrf54l15/cpuapp
66-
- nrf54lm20dk/nrf54lm20a/cpuapp
6754
- nrf54lm20dk/nrf54lm20b/cpuapp
6855
platform_allow:
6956
- nrf52840dk/nrf52840
@@ -72,11 +59,6 @@ tests:
7259
- nrf54l15dk/nrf54l15/cpuapp
7360
- nrf54lm20dk/nrf54lm20a/cpuapp
7461
- nrf54lm20dk/nrf54lm20b/cpuapp
75-
tags:
76-
- ci_build
77-
- smoke
78-
- sysbuild
79-
- ci_samples_zigbee
8062
sample.zigbee.light_bulb.with_shell:
8163
sysbuild: true
8264
build_only: true
@@ -86,13 +68,6 @@ tests:
8668
- CONFIG_ZIGBEE_LOGGER_EP=n
8769
- CONFIG_ZIGBEE_SHELL_ENDPOINT=10
8870
- CONFIG_LOG_MODE_DEFERRED=y
89-
integration_platforms:
90-
- nrf52840dk/nrf52840
91-
- nrf5340dk/nrf5340/cpuapp
92-
- nrf54l15dk/nrf54l10/cpuapp
93-
- nrf54l15dk/nrf54l15/cpuapp
94-
- nrf54lm20dk/nrf54lm20a/cpuapp
95-
- nrf54lm20dk/nrf54lm20b/cpuapp
9671
platform_allow:
9772
- nrf52840dk/nrf52840
9873
- nrf5340dk/nrf5340/cpuapp
@@ -101,7 +76,5 @@ tests:
10176
- nrf54lm20dk/nrf54lm20a/cpuapp
10277
- nrf54lm20dk/nrf54lm20b/cpuapp
10378
tags:
104-
- ci_build
79+
- no_integration
10580
- shell
106-
- sysbuild
107-
- ci_samples_zigbee

0 commit comments

Comments
 (0)