-
Notifications
You must be signed in to change notification settings - Fork 27
176 lines (156 loc) · 6.07 KB
/
run_tests_dut.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Build and run DUT tests
on:
workflow_call:
inputs:
nrf_revision:
type: string
required: false
default: "main"
subset:
description: ""
required: true
type: number
max_subsets:
description: ""
type: number
required: true
target_board:
description: "target board for tests"
type: string
required: true
run_tests:
description: ""
required: false
type: boolean
default: true
jobs:
build_dut_tests:
name: "Build DUT tests (${{inputs.target_board}} - ${{ inputs.subset }})"
runs-on: ubuntu-24.04
container:
image: ghcr.io/nrfconnect/sdk-sidewalk:main
options: --cpus 2
defaults:
run:
shell: nrfutil toolchain-manager launch --install-dir /root/ncs bash -- {0}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
path: sidewalk
- name: update NRF
run: |
rm -rf .west nrf;
cp -r /workdir/nrf nrf;
cd sidewalk && git rev-parse HEAD > /workdir/sidewalk_hash && cd .. &&
west init -l nrf &&
cd nrf &&
git fetch origin ${{inputs.nrf_revision}}:branch_to_run &&
git checkout branch_to_run &&
git rev-parse HEAD &&
cd .. &&
west config manifest.group-filter +sidewalk &&
west update -n -o=--depth=1 --path-cache /workdir/ &&
cd sidewalk && git checkout `cat /workdir/sidewalk_hash` && rm -rf /workdir/sidewalk_hash
- name: Install Python dependencies
run: |
python3 -m pip install -r nrf/scripts/requirements.txt -r zephyr/scripts/requirements.txt -r sidewalk/scripts/ci/requirements.txt
- name: Replace slash with underscore
id: replace
run: |
TARGET_BOARD=${{ inputs.target_board }}
TARGET_BOARD=${TARGET_BOARD//\//_}
echo "target_board=$TARGET_BOARD" >> $GITHUB_OUTPUT
- name: Ccache
id: ccache
uses: actions/cache@v4
with:
path: ~/.cache/ccache
key: ccache-tests_dut-${{ inputs.subset }}-${{steps.replace.outputs.target_board}}-${{ github.run_id }}
restore-keys: ccache-tests_dut-${{ inputs.subset }}-${{ steps.replace.outputs.target_board}}-
- name: Build DUT test artifacts
run: |
source zephyr/zephyr-env.sh
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 }}
- name: Print ccache stats
run: |
ccache -ps;
- name: Save build artifacts
uses: actions/upload-artifact@v4
with:
path: PACKAGE_ARTIFACTS_${{ inputs.subset }}.tar.bz2
name: DUT_artifacts_${{steps.replace.outputs.target_board}}_${{ inputs.subset }}
run_dut_ut:
needs: [build_dut_tests]
if: ${{ fromJson(inputs.run_tests) }}
name: "Run DUT tests (${{inputs.target_board}} - ${{ inputs.subset }})"
runs-on: [self-hosted, linux, x64, "${{inputs.target_board}}"]
container:
image: ghcr.io/nrfconnect/sdk-sidewalk:main
options: --cpus 2 --privileged
volumes:
- /dev:/dev
- /run/udev:/run/udev
permissions: write-all
defaults:
run:
shell: nrfutil toolchain-manager launch --install-dir /root/ncs bash -- {0}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: sidewalk
- name: update NRF
run: |
rm -rf .west nrf;
cp -r /workdir/nrf nrf;
cd sidewalk && git rev-parse HEAD > /workdir/sidewalk_hash && cd .. &&
west init -l nrf &&
cd nrf &&
git fetch origin ${{inputs.nrf_revision}}:branch_to_run &&
git checkout branch_to_run &&
git rev-parse HEAD &&
cd .. &&
west config manifest.group-filter +sidewalk &&
west update -n -o=--depth=1 --path-cache /workdir/ &&
cd sidewalk && git checkout `cat /workdir/sidewalk_hash` && rm -rf /workdir/sidewalk_hash
- name: Replace slash with underscore
id: replace
run: |
TARGET_BOARD=${{ inputs.target_board }}
TARGET_BOARD=${TARGET_BOARD//\//_}
echo "target_board=$TARGET_BOARD" >> $GITHUB_OUTPUT
- name: Install Python dependencies
run: |
python3 -m pip install -r sidewalk/scripts/ci/requirements.txt
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: DUT_artifacts_${{steps.replace.outputs.target_board}}_${{ inputs.subset }}
- name: Unwrap artifacts
run: |
tar -xf PACKAGE_ARTIFACTS_${{ inputs.subset }}.tar.bz2
- name: Run Tests
run: |
source zephyr/zephyr-env.sh
west twister --no-clean -vvv --inline-logs --test-only --hardware-map /__w/hardware_map.yaml --device-testing -T sidewalk --retry-failed 2 --west-flash="--recover,--erase"
- name: rename_twister_xml_report
run: |
mv twister-out/twister.xml twister-out/${{steps.replace.outputs.target_board}}_${{ inputs.subset }}_twister.xml
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: tests-dut_result_${{steps.replace.outputs.target_board}}_${{ inputs.subset }}
path: |
twister-out/${{steps.replace.outputs.target_board}}_${{ inputs.subset }}_twister.xml
twister-out/**/handler.log
twister-out/**/device.log
twister-out/**/zephyr.hex
twister-out/**/zephyr.elf
- name: clean artifacts
if: always()
run: |
cd nrf; git checkout main; git branch -D branch_to_run; cd ..;
rm -rf PACKAGE_ARTIFACTS_* twister-out