Skip to content

Commit 696d4ee

Browse files
committed
.github: ci: replace shell scripts with Python catalog module
Replace ad-hoc shell scripts (`load-test.sh`, `resolve-matrix.sh`, `nrf-cloud-device.sh`, `run.sh`) with a proper Python module `ci/catalog.py` that handles test catalog loading and matrix resolution. Move nRF Cloud device management from a shell script into `utils/nrf_cloud_device.py`, using Python's `urllib` instead of `curl`. Make hardware env var names configurable via `test_config` rather than hardcoded to nRF54L15-specific names. Add a new `fota-test.yml` reusable workflow and a disabled FOTA test entry in `tests.yml`. Switch `test.yml` to dispatch the correct workflow based on `matrix.type`, and tighten the concurrency group to `github.ref`. Drop the `summary_file` artifact and related `summary_line` helpers; serial log upload is sufficient for failure triage. Signed-off-by: Simen S. Røstad <simen.rostad@nordicsemi.no>
1 parent c30955f commit 696d4ee

16 files changed

Lines changed: 297 additions & 269 deletions

File tree

.github/test/cloud/nrf-cloud-device.sh

Lines changed: 0 additions & 108 deletions
This file was deleted.

.github/test/cloud/run.sh

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/test/scripts/load-test.sh

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/test/scripts/resolve-matrix.sh

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/test/tests.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,16 @@ tests:
1717
api_key_var: NRF_CLOUD_API_KEY
1818
ca_cert_var: NRF_CLOUD_CA_CERT
1919
ca_key_var: NRF_CLOUD_CA_KEY
20+
21+
- id: 91m1-application-fota-nrf54l15
22+
enabled: false
23+
type: fota
24+
app: 91m1
25+
board: nrf54l15dk/nrf54l15/cpuapp/ns
26+
hardware:
27+
segger_sn_var: CI_NRF54L15_SEGGER_SN
28+
serial_port_var: CI_NRF54L15_SERIAL_PORT
29+
device_id_var: CI_NRF54L15_DEVICE_ID
30+
internal_erase_end: "0x16b000"
31+
erase_external_slot: true
32+
erase_credentials: false

.github/workflows/cloud-connect-test.yml

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
#
33
# Provisions credentials on a device with no stored credentials, onboards via
44
# onboard.csv, and verifies "Cloud connected" in the serial log.
5-
#
6-
# When adding tests, update workflow_dispatch options below and .github/test/tests.yml.
75

86
name: Cloud Connect Test
97

@@ -13,15 +11,6 @@ on:
1311
test_id:
1412
required: true
1513
type: string
16-
workflow_dispatch:
17-
inputs:
18-
test:
19-
description: Cloud connect test to run
20-
required: true
21-
type: choice
22-
default: 91m1-cloud-connect-nrf54l15
23-
options:
24-
- 91m1-cloud-connect-nrf54l15
2514

2615
permissions:
2716
contents: read
@@ -51,15 +40,8 @@ jobs:
5140
working-directory: serial-modem-host-applications
5241
run: |
5342
set -eu
54-
pip install --quiet pyyaml
55-
56-
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
57-
TEST_ID="${{ github.event.inputs.test }}"
58-
else
59-
TEST_ID="${{ inputs.test_id }}"
60-
fi
61-
62-
TEST_JSON="$(ROOT=. .github/test/scripts/load-test.sh "$TEST_ID")"
43+
pip install --quiet -r tests/on_target/requirements.txt
44+
TEST_JSON="$(PYTHONPATH=tests/on_target python3 -m ci.catalog load "${{ inputs.test_id }}")"
6345
{
6446
echo "test_json<<EOF"
6547
echo "$TEST_JSON"
@@ -79,16 +61,12 @@ jobs:
7961
REPO_ROOT: ${{ github.workspace }}/serial-modem-host-applications
8062
TEST_JSON: ${{ steps.config.outputs.test_json }}
8163
run: |
82-
chmod +x .github/test/cloud/*.sh .github/test/scripts/*.sh
83-
.github/test/cloud/run.sh
84-
85-
- name: Upload test summary
86-
if: always()
87-
uses: actions/upload-artifact@v4
88-
with:
89-
name: hardware-test-summary-${{ github.run_id }}
90-
path: serial-modem-host-applications/build/hardware-test-summary.txt
91-
if-no-files-found: ignore
64+
PYTHONPATH=tests/on_target python3 -m pytest \
65+
tests/on_target/tests/test_cloud/ \
66+
-c tests/on_target/tests/pytest.ini \
67+
--html=build/hardware-pytest-report.html \
68+
--self-contained-html \
69+
-v
9270
9371
- name: Upload serial log
9472
if: failure()

.github/workflows/fota-test.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Reusable application FOTA hardware test workflow.
2+
#
3+
# Enable the matching entry in .github/test/tests.yml when test_fota is restored.
4+
5+
name: FOTA Test
6+
7+
on:
8+
workflow_call:
9+
inputs:
10+
test_id:
11+
required: true
12+
type: string
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
fota:
19+
runs-on: self-hosted
20+
container:
21+
image: ghcr.io/zephyrproject-rtos/ci:v0.29.2
22+
options: --privileged -v /dev:/dev
23+
env:
24+
CMAKE_PREFIX_PATH: /opt/toolchains
25+
CI_NRF54L15_SEGGER_SN: ${{ vars.CI_NRF54L15_SEGGER_SN }}
26+
CI_NRF54L15_SERIAL_PORT: ${{ vars.CI_NRF54L15_SERIAL_PORT }}
27+
CI_NRF54L15_DEVICE_ID: ${{ vars.CI_NRF54L15_DEVICE_ID }}
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v6
31+
with:
32+
path: serial-modem-host-applications
33+
34+
- name: Load test configuration
35+
id: config
36+
working-directory: serial-modem-host-applications
37+
run: |
38+
set -eu
39+
pip install --quiet -r tests/on_target/requirements.txt
40+
TEST_JSON="$(PYTHONPATH=tests/on_target python3 -m ci.catalog load "${{ inputs.test_id }}")"
41+
{
42+
echo "test_json<<EOF"
43+
echo "$TEST_JSON"
44+
echo "EOF"
45+
} >> "$GITHUB_OUTPUT"
46+
47+
- name: Initialize West workspace
48+
uses: ./serial-modem-host-applications/.github/actions/west-init
49+
50+
- name: Install test dependencies
51+
run: |
52+
nrfutil install device
53+
54+
- name: Run FOTA test
55+
working-directory: serial-modem-host-applications
56+
env:
57+
REPO_ROOT: ${{ github.workspace }}/serial-modem-host-applications
58+
TEST_JSON: ${{ steps.config.outputs.test_json }}
59+
run: |
60+
PYTHONPATH=tests/on_target python3 -m pytest \
61+
tests/on_target/tests/test_fota/ \
62+
-c tests/on_target/tests/pytest.ini \
63+
--html=build/hardware-pytest-report.html \
64+
--self-contained-html \
65+
-v
66+
67+
- name: Upload serial log
68+
if: failure()
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: hardware-serial-log-${{ github.run_id }}
72+
path: serial-modem-host-applications/build/hardware-serial.log
73+
if-no-files-found: ignore
74+
75+
- name: Upload pytest report
76+
if: failure()
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: hardware-pytest-report-${{ github.run_id }}
80+
path: serial-modem-host-applications/build/hardware-pytest-report.html
81+
if-no-files-found: ignore

.github/workflows/test.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,20 @@ on:
3636
options:
3737
- all
3838
- 91m1-cloud-connect-nrf54l15
39+
- 91m1-application-fota-nrf54l15
3940

4041
permissions:
4142
contents: read
4243

4344
concurrency:
44-
group: hardware-test-${{ github.event.pull_request.number || github.run_id }}
45+
group: hardware-test-${{ github.ref }}
4546
cancel-in-progress: false
4647

4748
jobs:
4849
plan:
4950
runs-on: self-hosted
51+
container:
52+
image: ghcr.io/zephyrproject-rtos/ci:v0.29.2
5053
outputs:
5154
matrix: ${{ steps.resolve.outputs.matrix }}
5255
steps:
@@ -61,18 +64,18 @@ jobs:
6164
env:
6265
TEST_FILTER: ${{ github.event_name == 'workflow_dispatch' && inputs.test || 'all' }}
6366
run: |
64-
pip install --quiet pyyaml
65-
ROOT=. .github/test/scripts/resolve-matrix.sh
67+
pip install --quiet -r tests/on_target/requirements.txt
68+
PYTHONPATH=tests/on_target python3 -m ci.catalog matrix --filter "$TEST_FILTER"
6669
67-
cloud_connect:
70+
hardware_test:
6871
needs: plan
6972
if: ${{ needs.plan.outputs.matrix != '[]' && needs.plan.outputs.matrix != '' }}
7073
strategy:
7174
fail-fast: false
7275
max-parallel: 1
7376
matrix:
7477
include: ${{ fromJson(needs.plan.outputs.matrix) }}
75-
uses: ./.github/workflows/cloud-connect-test.yml
78+
uses: ./.github/workflows/${{ matrix.type }}-test.yml
7679
with:
7780
test_id: ${{ matrix.id }}
7881
secrets: inherit

tests/on_target/ci/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause

0 commit comments

Comments
 (0)