Skip to content

Target tests

Target tests #502

Workflow file for this run

name: Target tests
on:
workflow_call:
inputs:
artifact_run_id:
type: string
required: true
artifact_fw_version:
type: string
required: true
pytest_marker:
type: string
required: false
pytest_path:
type: string
required: false
default: tests
workflow_dispatch:
inputs:
artifact_fw_version:
description: The firmware version found under this run_id
type: string
required: true
artifact_run_id:
description: The run ID of the workflow to fetch artifacts from
type: string
required: true
pytest_marker:
description: The pytest marker to run
type: string
required: false
pytest_path:
description: Select test execution path
type: string
required: false
default: tests
jobs:
target_test:
name: Target Test
runs-on: self-hosted
permissions:
contents: write
environment: production
container:
image: ghcr.io/hello-nrfcloud/firmware:docker-v1.0.3
options: --privileged
volumes:
- /dev:/dev:rw
- /run/udev:/run/udev
- /opt/setup-jlink:/opt/setup-jlink
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: thingy91x-oob
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: firmware-*
merge-multiple: true
path: thingy91x-oob/tests/on_target/artifacts
run-id: ${{ inputs.artifact_run_id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Verify artifact path
working-directory: thingy91x-oob
run: |
ls -l tests/on_target/artifacts
- name: Install dependencies
working-directory: thingy91x-oob/tests/on_target
run: |
pip install -r requirements.txt --break-system-packages
- name: Upload symbol file to Memfault
working-directory: thingy91x-oob/tests/on_target/artifacts
run: |
memfault \
--org-token ${{ secrets.MEMFAULT_ORGANIZATION_TOKEN }} \
--org ${{ vars.MEMFAULT_ORGANIZATION_SLUG }} \
--project ${{ vars.MEMFAULT_PROJECT_SLUG }} \
upload-mcu-symbols \
--software-type hello.nrfcloud.com-ci \
--software-version ${{ inputs.artifact_fw_version }} \
hello.nrfcloud.com-${{ inputs.artifact_fw_version }}-thingy91x-nrf91.elf
- name: Target Tests
working-directory: thingy91x-oob/tests/on_target
run: |
mkdir -p results
INPUT_MARKER=${{ inputs.pytest_marker }}
echo "Running tests with marker: ${INPUT_MARKER}"
MARKER=${INPUT_MARKER:-"-m \"not slow\""}
echo "Running tests with marker: ${MARKER}"
echo pytest -v ${MARKER} \
--collect-only \
--junit-xml=results/test-results.xml \
--html=results/test-results.html --self-contained-html \
${{ inputs.pytest_path }}
env:
SEGGER: ${{ secrets.SEGGER_DUT_1 }}
SEGGER_NRF53: ${{ secrets.SEGGER_DUT_2_EXT_DBG }}
SEGGER_NRF91: ${{ secrets.SEGGER_DUT_2_NRF91 }}
IMEI: ${{ secrets.IMEI_DUT_1 }}
UART_ID_DUT_2: ${{ secrets.UART_DUT_2 }}
FINGERPRINT: ${{ secrets.FINGERPRINT_DUT_1 }}
LOG_FILENAME: oob_uart_test_log
TEST_REPORT_NAME: OOB Firwmare Test Report
DUT1_HW_REVISION: ${{ vars.DUT1_HW_REVISION }}
SEGGER_PPK: ${{ secrets.SEGGER_DUT_PPK }}
- name: Commit and Push Badge File to gh-pages Branch
continue-on-error: true
working-directory: thingy91x-oob
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./tests/on_target/scripts/commit_badge.sh
- name: Results
if: always()
uses: pmeier/[email protected]
with:
path: thingy91x-oob/tests/on_target/results/*.xml
summary: true
fail-on-empty: true
title: OOB FW Test Results
- name: Create Report Artifact
if: always()
uses: actions/upload-artifact@v4
id: artifact-report
with:
name: test-report
path: |
thingy91x-oob/tests/on_target/results/*.html
- name: Push log files to artifacts
if: always()
uses: actions/upload-artifact@v4
id: artifact-upload-test-logs
with:
name: test-logs
path: |
thingy91x-oob/tests/on_target/outcomes/logs/*.txt