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

Commit

Permalink
workflows: add USB hub control to workflows
Browse files Browse the repository at this point in the history
By default, USB hubs are turned off after tests. Update workflows that run
on HIL to turn on the hub at the start of the test, and erase and turn off
the hub after it runs.

Signed-off-by: Mike Szczys <[email protected]>
  • Loading branch information
szczys committed Mar 26, 2024
1 parent 4f1538d commit 3185ac5
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 6 deletions.
32 changes: 29 additions & 3 deletions .github/workflows/test_nrf52840dk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,24 @@ jobs:
run:
working-directory: connection_tests

container:
image: golioth/golioth-twister-base:8307b9c
env:
ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.16.3
volumes:
- /dev:/dev
- /home/golioth/credentials:/opt/credentials
options: --privileged

steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
path: connection_tests

- name: Power On USB Hub
run: python3 /opt/golioth-scripts/usb_hub_power.py on

- name: Download build tarball
uses: actions/download-artifact@v3
with:
Expand All @@ -117,15 +129,29 @@ jobs:
- name: Copy credentials to samples/test
run: |
cp $HOME/credentials_nrf52840dk.yml samples/test/credentials.yml
cp /opt/credentials/credentials_nrf52840dk.yml samples/test/credentials.yml
- name: Flash and Verify Test Results
shell: bash
run: |
cd samples/test
source $HOME/runner_env.sh
source /opt/credentials/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
python3 verify.py $CI_NRF52840DK_PORT
- name: Erase flash
if: always()
shell: bash
env:
hil_board: ${{ inputs.hil_board }}
run: |
SNR_VAR=CI_${hil_board^^}_SNR
nrfjprog --recover --snr ${!SNR_VAR}
- name: Power Off USB Hub
if: always()
run: python3 /opt/golioth-scripts/usb_hub_power.py off
32 changes: 29 additions & 3 deletions .github/workflows/test_nrf9160dk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ jobs:
needs: build_for_hw_test
runs-on: [is_active, has_nrf9160dk]

container:
image: golioth/golioth-twister-base:8307b9c
env:
ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-0.16.3
volumes:
- /dev:/dev
- /home/golioth/credentials:/opt/credentials
options: --privileged

defaults:
run:
working-directory: connection_tests
Expand All @@ -109,6 +118,9 @@ jobs:
with:
path: connection_tests

- name: Power On USB Hub
run: python3 /opt/golioth-scripts/usb_hub_power.py on

- name: Download build tarball
uses: actions/download-artifact@v3
with:
Expand All @@ -122,16 +134,30 @@ jobs:
- name: Copy credentials to samples/test
run: |
cp $HOME/credentials_nrf9160dk.yml samples/test/credentials.yml
cp /opt/credentials/credentials_nrf9160dk.yml samples/test/credentials.yml
- name: Flash and Verify Test Results
shell: bash
run: |
cd samples/test
source $HOME/runner_env.sh
source /opt/credentials/runner_env.sh
nrfjprog --recover -f NRF91 --snr $CI_NRF9160DK_SNR
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
python3 verify.py $CI_NRF9160DK_PORT --timeout 300
- name: Erase flash
if: always()
shell: bash
env:
hil_board: ${{ inputs.hil_board }}
run: |
SNR_VAR=CI_${hil_board^^}_SNR
nrfjprog --recover --snr ${!SNR_VAR}
- name: Power Off USB Hub
if: always()
run: python3 /opt/golioth-scripts/usb_hub_power.py off

0 comments on commit 3185ac5

Please sign in to comment.