Skip to content

Commit 9e7fa11

Browse files
GHA: add test_config and update GHA
prepare gitHub automation for unit test refactoring Signed-off-by: Robert Gałat <[email protected]>
1 parent 9d16395 commit 9e7fa11

File tree

41 files changed

+158
-137
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+158
-137
lines changed

.github/workflows/on-commit.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,37 @@ jobs:
3333
with:
3434
reference_commit: "HEAD~${{needs.get_base_commit.outputs.commit_number}}"
3535

36+
discover_target_boards:
37+
runs-on: ubuntu-latest
38+
outputs:
39+
targets: ${{ steps.platforms.outputs.targets }}
40+
steps:
41+
- name: install yq
42+
run: pip install yq
43+
44+
- name: Checkout
45+
uses: actions/checkout@v4
46+
with:
47+
path: sidewalk
48+
49+
- name: get_platforms
50+
id: platforms
51+
run: |
52+
result=$(yq '.common.platform_allow' sidewalk/samples/sid_end_device/sample.yaml -c)
53+
echo "targets=$result" >> $GITHUB_OUTPUT;
54+
echo "$result"
55+
3656
build_samples:
57+
needs: [discover_target_boards]
3758
uses: ./.github/workflows/samples_build.yml
59+
with:
60+
boards_to_test: ${{needs.discover_target_boards.outputs.targets}}
3861

3962
build_and_run_tests:
63+
needs: [discover_target_boards]
4064
uses: ./.github/workflows/run_tests.yml
65+
with:
66+
boards_to_test: ${{needs.discover_target_boards.outputs.targets}}
4167

4268
Post_fail_to_Teams:
4369
needs: [verify_changes, build_samples, build_and_run_tests]

.github/workflows/on-pr.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,36 @@ jobs:
6060
path: |
6161
PR_number
6262
63+
discover_target_boards:
64+
runs-on: ubuntu-latest
65+
outputs:
66+
targets: ${{ steps.platforms.outputs.targets }}
67+
steps:
68+
- name: install yq
69+
run: pip install yq
70+
71+
- name: Checkout
72+
uses: actions/checkout@v4
73+
with:
74+
path: sidewalk
75+
76+
- name: get_platforms
77+
id: platforms
78+
run: |
79+
result=$(yq '.common.platform_allow' sidewalk/samples/sid_end_device/sample.yaml -c)
80+
echo "targets=$result" >> $GITHUB_OUTPUT;
81+
echo "$result"
82+
6383
build_samples:
64-
needs: Run_Configuration
84+
needs: [Run_Configuration, discover_target_boards]
6585
uses: ./.github/workflows/samples_build.yml
6686
with:
6787
nrf_revision: ${{needs.Run_Configuration.outputs.NRF_revision}}
88+
boards_to_test: ${{needs.discover_target_boards.outputs.targets}}
6889

6990
build_and_run_tests:
70-
needs: Run_Configuration
91+
needs: [Run_Configuration, discover_target_boards]
7192
uses: ./.github/workflows/run_tests.yml
7293
with:
7394
nrf_revision: ${{needs.Run_Configuration.outputs.NRF_revision}}
95+
boards_to_test: ${{needs.discover_target_boards.outputs.targets}}

.github/workflows/run_tests.yml

Lines changed: 3 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -8,88 +8,10 @@ on:
88
default: "main"
99
boards_to_test:
1010
type: string
11-
required: false
12-
default: '["nrf52840dk/nrf52840", "nrf5340dk/nrf5340/cpuapp", "nrf54l15dk/nrf54l15/cpuapp"]'
11+
required: true
12+
default: '["nrf52840dk/nrf52840", "nrf5340dk/nrf5340/cpuapp", "nrf54l15dk/nrf54l15/cpuapp", "nrf54l15dk/nrf54l15/cpuapp/ns", "nrf54l15dk/nrf54l10/cpuapp"]'
1313

1414
jobs:
15-
build_manual_tests:
16-
strategy:
17-
fail-fast: false
18-
matrix:
19-
subset: [1, 2, 3, 4, 5]
20-
env:
21-
MAX_SUBSETS: 5
22-
23-
runs-on: ubuntu-latest
24-
container:
25-
image: ghcr.io/nrfconnect/sdk-sidewalk:main
26-
options: --cpus 2
27-
defaults:
28-
run:
29-
shell: nrfutil toolchain-manager launch --install-dir /root/ncs bash -- {0}
30-
31-
steps:
32-
- name: Checkout
33-
uses: actions/checkout@v4
34-
with:
35-
fetch-depth: 0
36-
path: sidewalk
37-
38-
- name: update NRF
39-
run: |
40-
cd sidewalk && git rev-parse HEAD > /workdir/sidewalk_hash && cd .. &&
41-
west init -m https://github.com/nrfconnect/sdk-nrf --mr main . &&
42-
cd nrf &&
43-
git fetch origin ${{inputs.nrf_revision}}:PR-branch &&
44-
git checkout PR-branch &&
45-
cd .. &&
46-
west config manifest.group-filter +sidewalk &&
47-
west update -n -o=--depth=1 --path-cache /workdir/ &&
48-
cd sidewalk && git checkout `cat /workdir/sidewalk_hash` && rm -rf /workdir/sidewalk_hash
49-
50-
- name: Install Python dependencies
51-
run: |
52-
python3 -m pip install -r nrf/scripts/requirements.txt -r zephyr/scripts/requirements.txt -r sidewalk/scripts/ci/requirements.txt
53-
54-
- name: Twister build manual tests
55-
run: |
56-
source zephyr/zephyr-env.sh
57-
west twister --testsuite-root sidewalk/tests/manual --inline-logs --overflow-as-errors --enable-size-report --show-footprint --footprint-from-buildlog -vvv --build-only --subset ${{ matrix.subset }}/${{ env.MAX_SUBSETS }}
58-
59-
- name: Prepare artifacts for upload
60-
run: |
61-
mkdir -p subsets/${{ matrix.subset }}_of_${{ env.MAX_SUBSETS }}
62-
cp twister-out/twister.json subsets/${{ matrix.subset }}_of_${{ env.MAX_SUBSETS }}
63-
64-
- name: Upload build artifacts
65-
uses: actions/upload-artifact@v4
66-
if: always()
67-
with:
68-
name: manual-tests-artifacts-${{ matrix.subset }}
69-
path: |
70-
subsets
71-
twister-out/**/*sidewalk*/build.log
72-
twister-out/**/*sidewalk*/zephyr/.config
73-
twister-out/**/*sidewalk*/zephyr/runners.yaml
74-
twister-out/**/*sidewalk*/zephyr/zephyr.elf
75-
twister-out/**/*sidewalk*/zephyr/zephyr.hex
76-
twister-out/**/*sidewalk*/zephyr/merged.hex
77-
twister-out/**/*sidewalk*/zephyr/merged_domains.hex
78-
twister-out/**/*sidewalk*/zephyr/*.dts
79-
twister-out/**/*sidewalk*/zephyr/dfu_application.zip
80-
81-
merge_manual_tests:
82-
needs: build_manual_tests
83-
runs-on: ubuntu-latest
84-
permissions: write-all
85-
steps:
86-
- name: Merge Artifacts
87-
uses: actions/upload-artifact/merge@v4
88-
with:
89-
delete-merged: true
90-
name: manual-tests-artifacts
91-
pattern: manual-tests-artifacts-*
92-
9315
build_and_run_x86_tests:
9416
runs-on: ubuntu-latest
9517
container:
@@ -125,7 +47,7 @@ jobs:
12547
- name: Twister build and run x86 tests
12648
run: |
12749
source zephyr/zephyr-env.sh
128-
west twister --platform native_posix --platform unit_testing --coverage --coverage-basedir sidewalk --coverage-formats html,xml --enable-ubsan --enable-lsan --enable-asan --testsuite-root sidewalk --inline-logs --overflow-as-errors -vvv
50+
west twister --test-config sidewalk/test_config.yaml --level="Github_tests" --testsuite-root sidewalk --platform native_sim --platform native_posix --platform unit_testing --coverage --coverage-basedir sidewalk --coverage-formats html,xml --enable-ubsan --enable-lsan --enable-asan --inline-logs --overflow-as-errors -vvv
12951
13052
- name: Upload test results
13153
uses: actions/upload-artifact@v4

.github/workflows/run_tests_dut.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
- name: Build DUT test artifacts
6464
run: |
6565
source zephyr/zephyr-env.sh
66-
west twister --platform ${{inputs.target_board}} --testsuite-root sidewalk --filter runnable --shuffle-tests --shuffle-tests-seed 123 --inline-logs --overflow-as-errors -vvv --prep-artifacts-for-testing --package-artifacts PACKAGE_ARTIFACTS_${{ inputs.subset }}.tar.bz2 --subset ${{ inputs.subset }}/${{ inputs.max_subsets }}
66+
west twister --test-config sidewalk/test_config.yaml --levels="Github_tests" --platform ${{inputs.target_board}} --testsuite-root sidewalk --filter runnable --shuffle-tests --shuffle-tests-seed 123 --inline-logs --overflow-as-errors -vvv --prep-artifacts-for-testing --package-artifacts PACKAGE_ARTIFACTS_${{ inputs.subset }}.tar.bz2 --subset ${{ inputs.subset }}/${{ inputs.max_subsets }}
6767
6868
- name: Replace slash with underscore
6969
id: replace

.github/workflows/samples_build.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,21 @@ on:
1010
type: boolean
1111
required: false
1212
default: true
13+
boards_to_test:
14+
type: string
15+
required: true
16+
default: '["nrf52840dk/nrf52840", "nrf5340dk/nrf5340/cpuapp", "nrf54l15dk/nrf54l15/cpuapp", "nrf54l15dk/nrf54l15/cpuapp/ns", "nrf54l15dk/nrf54l10/cpuapp"]'
17+
1318

1419
jobs:
1520
build_samples:
1621
strategy:
1722
fail-fast: false
1823
matrix:
19-
subset: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
24+
subset: [1, 2, 3, 4, 5]
25+
board: ${{ fromJson(inputs.boards_to_test) }}
2026
env:
21-
MAX_SUBSETS: 15
27+
MAX_SUBSETS: 5
2228

2329
runs-on: ubuntu-latest
2430
container:
@@ -51,21 +57,28 @@ jobs:
5157
run: |
5258
python3 -m pip install -r nrf/scripts/requirements.txt -r zephyr/scripts/requirements.txt -r sidewalk/scripts/ci/requirements.txt
5359
60+
- name: Replace slash with underscore
61+
id: replace
62+
run: |
63+
TARGET_BOARD=${{ matrix.board }}
64+
TARGET_BOARD=${TARGET_BOARD//\//_}
65+
echo "target_board=$TARGET_BOARD" >> $GITHUB_OUTPUT
66+
5467
- name: Twister build samples
5568
run: |
5669
source zephyr/zephyr-env.sh
57-
west twister --testsuite-root sidewalk/samples/ --inline-logs --overflow-as-errors --enable-size-report --show-footprint -vvv --build-only --subset ${{ matrix.subset }}/${{ env.MAX_SUBSETS }}
70+
west twister --test-config sidewalk/test_config.yaml --testsuite-root sidewalk --level="samples" --platform ${{ matrix.board }} --inline-logs --overflow-as-errors --enable-size-report --show-footprint -vvv --build-only --subset ${{ matrix.subset }}/${{ env.MAX_SUBSETS }}
5871
5972
- name: Prepare artifacts for upload
6073
run: |
61-
mkdir -p subsets/${{ matrix.subset }}_of_${{ env.MAX_SUBSETS }}
62-
cp twister-out/twister.json subsets/${{ matrix.subset }}_of_${{ env.MAX_SUBSETS }}
74+
mkdir -p subsets/${{ matrix.subset }}_of_${{ env.MAX_SUBSETS }}_${{ steps.replace.outputs.target_board}}
75+
cp twister-out/twister.json subsets/${{ matrix.subset }}_of_${{ env.MAX_SUBSETS }}_${{ steps.replace.outputs.target_board}}
6376
6477
- name: Upload build metadata
6578
uses: actions/upload-artifact@v4
6679
if: always()
6780
with:
68-
name: sample-artifacts-meta-${{ matrix.subset }}
81+
name: sample-artifacts-meta-${{ matrix.subset }}-${{ steps.replace.outputs.target_board}}
6982
path: |
7083
subsets
7184
twister-out/**/build.log
@@ -77,12 +90,14 @@ jobs:
7790
uses: actions/upload-artifact@v4
7891
if: ${{ inputs.save_images }}
7992
with:
80-
name: sample-artifacts-build-${{ matrix.subset }}
93+
name: sample-artifacts-build-${{ matrix.subset }}-${{ steps.replace.outputs.target_board}}
8194
path: |
95+
subsets
8296
twister-out/**/zephyr.elf
8397
twister-out/**/zephyr.hex
8498
twister-out/**/merged.hex
8599
twister-out/**/merged_domains.hex
100+
twister-out/**/dfu_multi_image.bin
86101
twister-out/**/dfu_application.zip
87102
88103
merge_sample_artifacts:

samples/sid_end_device/sample.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,44 +17,44 @@ common:
1717
- nrf54l15dk/nrf54l15/cpuapp/ns
1818
- nrf54l15dk/nrf54l10/cpuapp
1919
tests:
20-
sample.sidewalk.hello:
20+
sidewalk.samples.sid_end_device.hello:
2121
extra_configs:
2222
- CONFIG_SID_END_DEVICE_PERSISTENT_LINK_MASK=y
2323
- CONFIG_SIDEWALK_FILE_TRANSFER=y
2424
- CONFIG_SIDEWALK_APPLICATION_NAME="hello"
2525
tags: Sidewalk hello
2626

27-
sample.sidewalk.hello.release:
27+
sidewalk.samples.sid_end_device.hello.release:
2828
extra_args:
2929
FILE_SUFFIX=release
3030
extra_configs:
3131
- CONFIG_SID_END_DEVICE_PERSISTENT_LINK_MASK=y
3232
- CONFIG_SIDEWALK_APPLICATION_NAME="hello.release"
3333
tags: Sidewalk hello
3434

35-
sample.sidewalk.hello.ble_only:
35+
sidewalk.samples.sid_end_device.hello.ble_only:
3636
extra_configs:
3737
- CONFIG_SIDEWALK_SUBGHZ_SUPPORT=n
3838
- CONFIG_SIDEWALK_APPLICATION_NAME="hello.ble_only"
3939
tags: Sidewalk hello BLE
4040

41-
sample.sidewalk.hello.ble_only.release:
41+
sidewalk.samples.sid_end_device.hello.ble_only.release:
4242
extra_args:
4343
FILE_SUFFIX=release
4444
extra_configs:
4545
- CONFIG_SIDEWALK_SUBGHZ_SUPPORT=n
4646
- CONFIG_SIDEWALK_APPLICATION_NAME="hello.ble_only.release"
4747
tags: Sidewalk hello BLE
4848

49-
sample.sidewalk.demo:
49+
sidewalk.samples.sid_end_device.demo:
5050
extra_args:
5151
OVERLAY_CONFIG="overlay-demo.conf"
5252
extra_configs:
5353
- CONFIG_SID_END_DEVICE_PERSISTENT_LINK_MASK=y
5454
- CONFIG_SIDEWALK_APPLICATION_NAME="demo"
5555
tags: Sidewalk demo
5656

57-
sample.sidewalk.demo.ble_only:
57+
sidewalk.samples.sid_end_device.demo.ble_only:
5858
platform_allow:
5959
- thingy53/nrf5340/cpuapp
6060
extra_args:
@@ -66,22 +66,22 @@ tests:
6666
- thingy53/nrf5340/cpuapp
6767
tags: Sidewalk demo BLE
6868

69-
sample.sidewalk.dut:
69+
sidewalk.samples.sid_end_device.dut:
7070
extra_args:
7171
OVERLAY_CONFIG="overlay-dut.conf"
7272
extra_configs:
7373
- CONFIG_SIDEWALK_APPLICATION_NAME="dut"
7474
tags: Sidewalk cli
7575

76-
sample.sidewalk.dut.ble_only:
76+
sidewalk.samples.sid_end_device.dut.ble_only:
7777
extra_args:
7878
OVERLAY_CONFIG="overlay-dut.conf"
7979
extra_configs:
8080
- CONFIG_SIDEWALK_SUBGHZ_SUPPORT=n
8181
- CONFIG_SIDEWALK_APPLICATION_NAME="dut.ble_only"
8282
tags: Sidewalk cli BLE
8383

84-
sample.sidewalk.dut.no_secure:
84+
sidewalk.samples.sid_end_device.dut.no_secure:
8585
extra_args:
8686
OVERLAY_CONFIG="overlay-dut.conf"
8787
extra_configs:

test_config.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
platforms:
2+
override_default_platforms: false
3+
increased_platform_scope: false
4+
5+
levels:
6+
- name: samples
7+
description: >
8+
Prepare samples.
9+
adds:
10+
- sidewalk.samples.*
11+
- sidewalk.test.acceptance.simple_bootloader
12+
13+
- name: unit
14+
description: >
15+
Check units in isolation.
16+
adds:
17+
- sidewalk.test.unit.*
18+
19+
- name: integration
20+
description: >
21+
Verify implementation of PAL on target
22+
adds:
23+
- sidewalk.test.integration.*
24+
25+
- name: Github_tests
26+
description: >
27+
set of tests run on GitHub
28+
inherits:
29+
- unit
30+
- integration
31+
32+
- name: bugs
33+
description: >
34+
Test known issues and bug scenarios.
35+
adds:
36+
- sidewalk.test.acceptance.bugs.*

tests/functional/critical_region/testcase.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
tests:
2-
sidewalk.functional.critical_region:
2+
sidewalk.test.integration.critical_region:
33
sysbuild: true
44
platform_allow:
55
- nrf52840dk/nrf52840

tests/functional/crypto/testcase.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
tests:
2-
sidewalk.functional.crypto:
2+
sidewalk.test.integration.crypto:
33
sysbuild: true
44
tags: Sidewalk
55
platform_allow:

tests/functional/crypto_keys/testcase.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
tests:
2-
sidewalk.functional.crypto_keys:
2+
sidewalk.test.integration.crypto_keys:
33
sysbuild: true
44
tags: Sidewalk
55
platform_allow:

0 commit comments

Comments
 (0)