Skip to content

Commit 9b03968

Browse files
tests: on_target: add ppk test
Add ppk test and update nightly badge accordingly. Also, add html interactive power plot, hosted on github pages. Signed-off-by: Giacomo Dematteis <[email protected]>
1 parent f5cd069 commit 9b03968

File tree

5 files changed

+362
-2
lines changed

5 files changed

+362
-2
lines changed

.github/workflows/on_target.yml

+99-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ on:
1919
default: true
2020
run_fullmfwfota_test:
2121
type: boolean
22-
required: true
22+
required: false
2323
default: false
2424
run_dfu_tests:
2525
type: boolean
@@ -29,6 +29,18 @@ on:
2929
type: boolean
3030
required: false
3131
default: true
32+
run_wifi_location_tests:
33+
type: boolean
34+
required: false
35+
default: true
36+
run_modem_trace_tests:
37+
type: boolean
38+
required: false
39+
default: true
40+
run_ppk_tests:
41+
type: boolean
42+
required: false
43+
default: false
3244
workflow_dispatch:
3345
inputs:
3446
artifact_fw_version:
@@ -59,11 +71,25 @@ on:
5971
type: boolean
6072
required: true
6173
default: false
74+
run_wifi_location_tests:
75+
type: boolean
76+
required: true
77+
default: false
78+
run_modem_trace_tests:
79+
type: boolean
80+
required: true
81+
default: false
82+
run_ppk_tests:
83+
type: boolean
84+
required: true
85+
default: false
6286

6387
jobs:
6488
target_test:
6589
name: Target Test
6690
runs-on: self-hosted
91+
permissions:
92+
contents: write
6793
environment: production
6894
container:
6995
image: ghcr.io/hello-nrfcloud/firmware:docker-v1.0.3
@@ -183,6 +209,7 @@ jobs:
183209
LOG_FILENAME: oob_conn_bridge_test_log
184210

185211
- name: Run Wi-Fi location tests
212+
if: ${{ inputs.run_wifi_location_tests }}
186213
working-directory: thingy91x-oob/tests/on_target
187214
run: |
188215
mkdir -p results
@@ -193,6 +220,7 @@ jobs:
193220
SEGGER: ${{ secrets.SEGGER_DUT_1 }}
194221

195222
- name: Run modem trace test
223+
if: ${{ inputs.run_modem_trace_tests }}
196224
working-directory: thingy91x-oob/tests/on_target
197225
run: |
198226
mkdir -p results
@@ -202,6 +230,76 @@ jobs:
202230
env:
203231
SEGGER: ${{ secrets.SEGGER_DUT_1 }}
204232

233+
- name: Run PPK tests
234+
if: ${{ inputs.run_ppk_tests }}
235+
id: ppk_test
236+
working-directory: thingy91x-oob/tests/on_target
237+
run: |
238+
mkdir -p results
239+
pytest -s -v -m dut_ppk \
240+
--junit-xml=results/test-results-ppk.xml \
241+
tests
242+
env:
243+
SEGGER: ${{ secrets.SEGGER_DUT_PPK }}
244+
245+
- name: Commit and Push Badge File to gh-pages Branch
246+
if: always()
247+
working-directory: thingy91x-oob
248+
env:
249+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
250+
run: |
251+
# Define file paths as variables
252+
BADGE_FILE=tests/on_target/power_badge.json
253+
HTML_FILE=tests/on_target/power_measurements_plot.html
254+
CSV_FILE=tests/on_target/power_measurements.csv
255+
256+
# Check if the badge file exists at the specified location
257+
if [ -f $BADGE_FILE ]; then
258+
echo "Badge file found, proceeding to commit."
259+
else
260+
echo "Badge file not found. Exiting..."
261+
exit 1
262+
fi
263+
264+
# Check if the html file exists at the specified location
265+
if [ -f $HTML_FILE ]; then
266+
echo "Html file found, proceeding to commit."
267+
else
268+
echo "Html file not found. Exiting..."
269+
exit 1
270+
fi
271+
272+
# Check if the csv file exists at the specified location
273+
if [ -f $CSV_FILE ]; then
274+
echo "Csv file found, proceeding to commit."
275+
else
276+
echo "Csv file not found. Exiting..."
277+
exit 1
278+
fi
279+
280+
# Configure Git to trust the current working directory
281+
git config --global --add safe.directory /__w/firmware/firmware
282+
283+
# Set Git user name and email for commits in the GitHub Actions environment
284+
git config --global user.email "[email protected]"
285+
git config --global user.name "GitHub Actions"
286+
287+
# Ensure the gh-pages branch exists and switch to it
288+
git fetch origin gh-pages || git checkout -b gh-pages
289+
git checkout gh-pages
290+
291+
# Stage, commit, and push changes to the branch
292+
echo ls tests/on_target/
293+
ls tests/on_target/
294+
echo ls docs/
295+
ls docs/
296+
cp $BADGE_FILE docs/power_badge.json
297+
cp $HTML_FILE docs/power_measurements_plot.html
298+
cp $CSV_FILE docs/power_measurements.csv
299+
git add docs/power_badge.json docs/power_measurements_plot.html docs/power_measurements.csv
300+
git commit -m "Update power badge, html and csv to docs folder"
301+
git push origin gh-pages
302+
205303
- name: Results
206304
if: always()
207305
uses: pmeier/[email protected]

.github/workflows/test.yml

+29
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@ on:
1919
type: boolean
2020
required: true
2121
default: true
22+
run_wifi_location_tests:
23+
type: boolean
24+
required: true
25+
default: true
26+
run_modem_trace_tests:
27+
type: boolean
28+
required: true
29+
default: true
30+
run_ppk_tests:
31+
type: boolean
32+
required: true
33+
default: false
2234
schedule:
2335
- cron: "0 0 * * *"
2436
push:
@@ -67,3 +79,20 @@ jobs:
6779
github.event_name == 'push' ||
6880
(github.event_name == 'workflow_dispatch' && github.event.inputs.run_connectivity_bridge_tests == 'true')
6981
}}
82+
run_wifi_location_tests: >-
83+
${{
84+
github.event_name == 'schedule' ||
85+
github.event_name == 'push' ||
86+
(github.event_name == 'workflow_dispatch' && github.event.inputs.run_wifi_location_tests == 'true')
87+
}}
88+
run_modem_trace_tests: >-
89+
${{
90+
github.event_name == 'schedule' ||
91+
github.event_name == 'push' ||
92+
(github.event_name == 'workflow_dispatch' && github.event.inputs.run_modem_trace_tests == 'true')
93+
}}
94+
run_ppk_tests: >-
95+
${{
96+
github.event_name == 'schedule' ||
97+
(github.event_name == 'workflow_dispatch' && github.event.inputs.run_ppk_tests == 'true')
98+
}}

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#### Nightly:
99
[![Target_tests](https://github.com/hello-nrfcloud/firmware/actions/workflows/test.yml/badge.svg?event=schedule)](https://github.com/hello-nrfcloud/firmware/actions/workflows/test.yml?query=branch%3Amain+event%3Aschedule)
10+
[![Power Consumption Badge](https://img.shields.io/endpoint?url=https://hello-nrfcloud.github.io/firmware/power_badge.json)](https://hello-nrfcloud.github.io/firmware/power_measurements_plot.html)
11+
1012

1113
This project is based on the
1214
[NCS Example Application](https://github.com/nrfconnect/ncs-example-application).

tests/on_target/tests/conftest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def t91x_traces(t91x_board):
102102
def hex_file():
103103
# Search for the firmware hex file in the artifacts folder
104104
artifacts_dir = "artifacts"
105-
hex_pattern = r"hello\.nrfcloud\.com-[a-f0-9]+-thingy91x-nrf91\.hex"
105+
hex_pattern = r"hello\.nrfcloud\.com-[a-z.0-9]+-thingy91x-nrf91\.hex"
106106

107107
for file in os.listdir(artifacts_dir):
108108
if re.match(hex_pattern, file):

0 commit comments

Comments
 (0)