This repository has been archived by the owner on Jul 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
131 lines (113 loc) · 3.92 KB
/
test_nrf52840dk.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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