Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Test nrf52840dk

Test nrf52840dk #921

name: Test nrf52840dk
on:
push:
branches: [ main ]
pull_request:
schedule:
# Run workflow at the start of every day (12 AM UTC)
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
build_for_hw_test:
runs-on: ubuntu-latest
container:
image: zephyrprojectrtos/ci:v0.26.4
env:
ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.16.1
steps:
- uses: actions/checkout@v3
with:
path: modules/lib/golioth
- name: Init and update west
run: |
mkdir -p .west
cat <<EOF > .west/config
[manifest]
path = modules/lib/golioth
file = .ci-west-zephyr.yml
EOF
west update -o=--depth=1 -n
git config --global user.email [email protected]
git config --global user.name "Git User"
west patch
- name: Build samples/test
run: |
cd modules/lib/golioth/samples/test
west build -b nrf52840dk_nrf52840 . -p
- name: Create build tarball
run: |
cd modules/lib/golioth/samples/test
tar czf build.tar.gz build/zephyr/zephyr.hex
- name: Upload tarball
uses: actions/upload-artifact@v3
with:
name: build.tar.gz
path: modules/lib/golioth/samples/test/build.tar.gz
# Assumptions made about the self-hosted runner:
#
# 1. Has installed the GitHub Actions self-hosted runner service
# 2. Has nrfjprog already installed
# 3. Has an environment variable defined for the serial port: CI_NRF52840DK_PORT
# 4. Has credentials defined in the file $HOME/credentials_nrf52840dk.yml
# 5. Has an environment variabled defined for the JTAG serial number of the nRF52.
#
# It is the responsibility of the self-hosted runner admin to ensure
# these pre-conditions are met.
#
# For item 1, GitHub provides instructions when you add a new self-hosted runner
# in Settings -> Actions -> Runners.
#
# For item 2, you'll need to install jlink and nrf-command-line-tools:
# https://www.segger.com/downloads/jlink/
# https://www.nordicsemi.com/Products/Development-tools/nrf-command-line-tools/download
#
# For item 3, this environment variable can be added to $HOME/runner_env.sh:
# export CI_NRF52840DK_PORT=/dev/ttyACM0
#
# For item 4, the file needs to have contents like:
#
# settings:
# wifi/ssid: mywifissid
# wifi/psk: mywifipassword
# golioth/psk-id: device@project
# golioth/psk: supersecret
#
# The golioth credentials need to match a device on coap.golioth.dev
#
# For item 5, you can discover the serial number of the nRF52 using this command:
# nrfjprog --ids
# Once you know the serial number, you can add this to $HOME/runner_env.sh:
# export CI_NRF52840DK_SNR=723769314
hw_flash_and_test:
needs: build_for_hw_test
runs-on: [self-hosted, has_nrf52840dk]
defaults:
run:
working-directory: connection_tests
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
path: connection_tests
- name: Download build tarball
uses: actions/download-artifact@v3
with:
name: build.tar.gz
path: connection_tests/samples/test
- name: Untar
run: |
cd samples/test
tar xvf build.tar.gz
- name: Copy credentials to samples/test
run: |
cp $HOME/credentials_nrf52840dk.yml samples/test/credentials.yml
- name: Flash and Verify Test Results
run: |
cd samples/test
source $HOME/runner_env.sh
nrfjprog --recover -f NRF52 --snr $CI_NRF52840DK_SNR
nrfjprog --program build/zephyr/zephyr.hex --sectoranduicrerase --verify -f NRF52 --snr $CI_NRF52840DK_SNR
nrfjprog --pinresetenable -f NRF52 --snr $CI_NRF52840DK_SNR
nrfjprog --pinreset -f NRF52 --snr $CI_NRF52840DK_SNR
sleep 3
python verify.py $CI_NRF52840DK_PORT