Skip to content

Commit

Permalink
GHA: add action to run functional tests
Browse files Browse the repository at this point in the history
action to run pytest for functional tests on sid_dut

Signed-off-by: Robert Gałat <[email protected]>
  • Loading branch information
RobertGalatNordic committed Jul 16, 2024
1 parent ec5b68d commit 04288c8
Showing 1 changed file with 106 additions and 0 deletions.
106 changes: 106 additions & 0 deletions .github/workflows/run_tests_cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Build and run CLI tests
on:
workflow_call:
inputs:
nrf_revision:
type: string
required: false
default: "main"
target_board:
description: "target board for tests"
type: string
required: true

jobs:
run_dut_ut:
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;
cd sidewalk && git rev-parse HEAD > /workdir/sidewalk_hash && cd ..
west init -m https://github.com/nrfconnect/sdk-nrf --mr main . &&
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 tests
run: |
git clone ssh://[email protected]:7999/ama-things/pytest-sidewalk.git
cd pytest-sidewalk
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cd utils
git clone ssh://[email protected]:7999/ama-things/sidewalk-fuota.git
cd sidewalk-fuota
./setup.sh
- name: Build dut sample
run: |
source zephyr/zephyr-env.sh
cd sidewalk/sample/sid_end_device
west build -b ${{ inputs.target_board }} -DOVERLAY_CONFIG="overlay-dut.conf"
- name: Flash dut sample
run: |
source zephyr/zephyr-env.sh
cd sidewalk/sample/sid_end_device
west flash
- name: Flash mfg_hex
if: ${{ inputs.target_board }} == "nrf54l15pdk/nrf54l15/cpuapp"
run: |
nrfjprog --program pytest-sidewalk/test_objects/mfg/BFFFEA01CA/PCA10156/mfg_v8.hex --sectorerase --verify -r
- name: Flash mfg_hex
if: ${{ inputs.target_board }} != "nrf54l15pdk/nrf54l15/cpuapp"
run: |
nrfjprog --program pytest-sidewalk/test_objects/mfg/BFFFEA01CA/mfg_v8.hex --sectorerase --verify -r
- name: Run Tests
run: |
source zephyr/zephyr-env.sh
cd pytest-sidewalk
source .venv/bin/activate
pytest tests/test_sid_dut.py --segger=$(yq '.[0].id' /__w/hardware_map.yaml | tr -d \") --sid-device BFFFEA01CA --html=report.html --self-contained-html
- name: clean artifacts
if: always()
run: |
rm -rf pytest-sidewalk
cd nrf; git checkout main; git branch -D branch_to_run;
rm -rf PACKAGE_ARTIFACTS_* twister-out

0 comments on commit 04288c8

Please sign in to comment.