This repository has been archived by the owner on Jul 31, 2024. It is now read-only.
Test nrf9160dk #127
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --------------------------------------------------------------- | |
# Workflow is not run on commit/merge due to inconsistent | |
# modem initialization on nRF9160dk, which can cause | |
# the hw_flash_and_test job to fail: | |
# | |
# https://golioth.atlassian.net/browse/DSDK-334 | |
# --------------------------------------------------------------- | |
name: Test nrf9160dk | |
on: | |
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.24.2 | |
env: | |
ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.15.0 | |
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 = west-ncs.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 nrf9160dk_nrf9160_ns . -p | |
- name: Create build tarball | |
run: | | |
cd modules/lib/golioth/samples/test | |
tar czf build.tar.gz build/zephyr/merged.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_NRF9160DK_PORT | |
# 4. Has credentials defined in the file $HOME/credentials_nrf9160dk.yml | |
# 5. Has an environment variabled defined for the JTAG serial number of the nRF91. | |
# | |
# 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_NRF9160DK_PORT=/dev/ttyACM0 | |
# | |
# For item 4, the file needs to have contents like: | |
# | |
# settings: | |
# 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 nRF91 using this command: | |
# nrfjprog --ids | |
# Once you know the serial number, you can add this to $HOME/runner_env.sh: | |
# export CI_NRF9160DK_SNR=723769314 | |
hw_flash_and_test: | |
needs: build_for_hw_test | |
runs-on: [self-hosted, has_nrf9160dk] | |
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_nrf9160dk.yml samples/test/credentials.yml | |
- name: Flash and Verify Test Results | |
run: | | |
cd samples/test | |
source $HOME/runner_env.sh | |
nrfjprog --eraseall -f NRF91 --snr $CI_NRF9160DK_SNR | |
nrfjprog --program build/zephyr/merged.hex --verify -f NRF91 --snr $CI_NRF9160DK_SNR | |
nrfjprog --pinreset -f NRF91 --snr $CI_NRF9160DK_SNR | |
sleep 3 | |
# Add a longer timeout to verify step for LTE connection | |
python verify.py $CI_NRF9160DK_PORT --timeout 300 |