Skip to content

Commit

Permalink
WIP more
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgenmk committed Aug 27, 2024
1 parent f94bbea commit a0bde15
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 41 deletions.
69 changes: 55 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
name: Build

on:
workflow_dispatch:
workflow_call:
inputs:
build_bl_update:
type: boolean
required: false
default: false
outputs:
run_id: ${{ github.run_id }}
version: ${{ jobs.build.outputs.version }}
version_env: ${{ env.VERSION }}

push:
branches:
- main
Expand All @@ -20,6 +26,9 @@ jobs:
container: ghcr.io/zephyrproject-rtos/ci:v0.26.13
env:
CMAKE_PREFIX_PATH: /opt/toolchains
outputs:
run_id: ${{ github.run_id }}
version: ${{ env.VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -63,25 +72,46 @@ jobs:
west build -b thingy91x/nrf9151/ns -p --sysbuild -- -DEXTRA_CONF_FILE="overlay-memfault.conf"
- name: Create nrf91 Bootloader HEX file
if: false
run: |
python3 zephyr/scripts/build/mergehex.py -o $(pwd)/thingy91x-oob/app/build/b0_s0_s1_merged.hex $(pwd)/thingy91x-oob/app/build/b0_container.hex $(pwd)/thingy91x-oob/app/build/app_provision.hex $(pwd)/thingy91x-oob/app/build/signed_by_b0_mcuboot.hex $(pwd)/thingy91x-oob/app/build/signed_by_b0_s1_image.hex
python3 zephyr/scripts/build/mergehex.py -o
$(pwd)/thingy91x-oob/app/build/b0_s0_s1_merged.hex \
$(pwd)/thingy91x-oob/app/build/b0_container.hex \
$(pwd)/thingy91x-oob/app/build/app_provision.hex \
$(pwd)/thingy91x-oob/app/build/signed_by_b0_mcuboot.hex \
$(pwd)/thingy91x-oob/app/build/signed_by_b0_s1_image.hex
- name: Build nrf53 firmware
if: false
working-directory: nrf/applications/connectivity_bridge
run: |
west build -b thingy91x/nrf5340/cpuapp -p --sysbuild
- name: Create nrf53 merged_domains HEX file
if: false
run: |
python3 zephyr/scripts/build/mergehex.py -o $(pwd)/thingy91x-oob/app/build/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf53-connectivity-bridge.hex $(pwd)/nrf/applications/connectivity_bridge/build/merged_CPUNET.hex $(pwd)/nrf/applications/connectivity_bridge/build/merged.hex
python3 zephyr/scripts/build/mergehex.py -o \
$(pwd)/thingy91x-oob/app/build/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf53-connectivity-bridge.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/merged_CPUNET.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/merged.hex
- name: Create nrf53 Bootloader HEX file
if: false
run: |
python3 zephyr/scripts/build/mergehex.py -o $(pwd)/thingy91x-oob/app/build/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf53-bootloader.hex $(pwd)/nrf/applications/connectivity_bridge/build/b0_container.hex $(pwd)/nrf/applications/connectivity_bridge/build/signed_by_b0_mcuboot.hex $(pwd)/nrf/applications/connectivity_bridge/build/signed_by_b0_s1_image.hex $(pwd)/nrf/applications/connectivity_bridge/build/app_provision.hex $(pwd)/nrf/applications/connectivity_bridge/build/b0n_container.hex $(pwd)/nrf/applications/connectivity_bridge/build/net_provision.hex
python3 zephyr/scripts/build/mergehex.py -o \
$(pwd)/thingy91x-oob/app/build/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf53-bootloader.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/b0_container.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/signed_by_b0_mcuboot.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/signed_by_b0_s1_image.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/app_provision.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/b0n_container.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/net_provision.hex
- name: Copy nrf53 DFU file
if: false
run: |
cp $(pwd)/nrf/applications/connectivity_bridge/build/dfu_application.zip $(pwd)/thingy91x-oob/app/build/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf53-dfu.zip
cp $(pwd)/nrf/applications/connectivity_bridge/build/dfu_application.zip \
$(pwd)/thingy91x-oob/app/build/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf53-dfu.zip
- name: Apply Connectivity Bridge Patch
run: git apply thingy91x-oob/scripts/connectivity_bridge.patch --directory=nrf
Expand All @@ -91,27 +121,38 @@ jobs:
working-directory: thingy91x-oob
run: |
west twister -T . --test app/app.build.bootloader_update -v -p thingy91x/nrf9151/ns --inline-logs
cp twister-out/thingy91x_nrf9151_ns/app/app.build.bootloader_update/dfu_mcuboot.zip app/build/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91-bootloader.zip
cp twister-out/thingy91x_nrf9151_ns/app/app.build.bootloader_update/dfu_mcuboot.zip \
app/build/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91-bootloader.zip
rm -rf twister-out
west twister -T ../nrf/applications/connectivity_bridge --test applications.connectivity_bridge.bootloader_update -v -p thingy91x/nrf5340/cpuapp --inline-logs
cp twister-out/thingy91x_nrf5340_cpuapp/applications.connectivity_bridge.bootloader_update/dfu_mcuboot.zip app/build/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf53-bootloader.zip
cp twister-out/thingy91x_nrf5340_cpuapp/applications.connectivity_bridge.bootloader_update/dfu_application.zip app/build/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf53-connectivity-bridge-verbose.zip
west twister -T ../nrf/applications/connectivity_bridge \
--test applications.connectivity_bridge.bootloader_update -v -p thingy91x/nrf5340/cpuapp --inline-logs
cp twister-out/thingy91x_nrf5340_cpuapp/applications.connectivity_bridge.bootloader_update/dfu_mcuboot.zip \
app/build/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf53-bootloader.zip
cp twister-out/thingy91x_nrf5340_cpuapp/applications.connectivity_bridge.bootloader_update/dfu_application.zip \
app/build/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf53-connectivity-bridge-verbose.zip
- name: Rename artifacts
working-directory: thingy91x-oob/app/build
run: |
cp merged.hex hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-debug-app.hex
cp app/zephyr/.config hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-debug-app.config
cp app/zephyr/zephyr.signed.bin hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-debug-app_update_signed.bin
cp app/zephyr/zephyr.signed.hex hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-debug-app_update_signed.hex
cp app/zephyr/zephyr.elf hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-debug-app.elf
cp b0_s0_s1_merged.hex hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-bootloader.hex
cp dfu_application.zip hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91-dfu.zip
# cp app/zephyr/.config hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-debug-app.config
# cp app/zephyr/zephyr.signed.bin hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-debug-app_update_signed.bin
# cp app/zephyr/zephyr.signed.hex hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-debug-app_update_signed.hex
# cp app/zephyr/zephyr.elf hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-debug-app.elf
# cp b0_s0_s1_merged.hex hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-bootloader.hex
# cp dfu_application.zip hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91-dfu.zip
- name: Upload artifact
uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
name: firmware
if-no-files-found: error
path: |
thingy91x-oob/app/build/hello.nrfcloud.com-*.*
- name: Debug print
run: |
echo "VERSION=${{ env.VERSION }}" >> $GITHUB_OUTPUT
echo Run id: ${{ github.run_id }}
echo Version: ${{ env.VERSION }}
74 changes: 47 additions & 27 deletions .github/workflows/on_target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,50 @@ name: Target tests

on:
workflow_call:
inputs:
artifact_fw_version:
type: string
required: true
artifact_run_id:
type: string
required: true
run_fota_tests:
type: boolean
required: true
default: true
run_dfu_tests:
type: boolean
required: true
default: true
run_connectivity_bridge_tests:
type: boolean
required: true
default: true
workflow_dispatch:
inputs:
build:
artifact_fw_version:
type: string
required: true
artifact_run_id:
type: string
required: true
run_fota_tests:
type: boolean
description: Build the firmware before running tests

schedule:
- cron: "0 0 * * *"
push:
branches:
- main
required: true
default: false
run_dfu_tests:
type: boolean
required: true
default: false
run_connectivity_bridge_tests:
type: boolean
required: true
default: false


jobs:
build:
steps:
- name: Build firmware
if: ${{ github.event.inputs.build == 'true'}}
uses: ./.github/workflows/build.yml
secrets: inherit
with:
build_bl_update: true

test:
name: Test
needs: build
target_test:
name: Target Test
runs-on: self-hosted
environment: production
container:
Expand All @@ -44,18 +62,17 @@ jobs:
path: thingy91x-oob

- name: Download artifact
if: ${{ github.event.inputs.build == 'true' }}
uses: actions/download-artifact@v4
with:
name: firmware
path: thingy91x-oob/tests/on_target/artifacts
run-id: ${{ inputs.artifact_run_id }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Download old artifact
if: ${{ github.event.inputs.build == 'false' }}
run: |
echo ${{ github.event.inputs.build }}
python3 thingy91x-oob/tests/on_target/utils/download_artifacts.py \
${{ secrets.GITHUB_TOKEN }}
# - name: Download artifact
# run: |
# python3 thingy91x-oob/tests/on_target/utils/download_artifacts.py \
# ${{ secrets.GITHUB_TOKEN }}

- name: Set version
shell: bash
Expand Down Expand Up @@ -84,6 +101,7 @@ jobs:
SEGGER: ${{ secrets.SEGGER_DUT_1 }}

- name: Run FOTA tests
if: ${{ inputs.run_fota_tests }}
working-directory: thingy91x-oob/tests/on_target
run: |
pytest -s -v -m "dut1 and fota" tests --firmware-hex artifacts/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-debug-app.hex
Expand All @@ -93,6 +111,7 @@ jobs:
FINGERPRINT: ${{ secrets.FINGERPRINT_DUT_1 }}

- name: Run DFU tests
if: ${{ inputs.run_dfu_tests }}
working-directory: thingy91x-oob/tests/on_target
run: |
pytest -s -v -m dut2 tests
Expand All @@ -108,6 +127,7 @@ jobs:
NRF91_BL_UPDATE_ZIP: artifacts/hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91-bootloader.zip

- name: Check nRF53 connectivity bridge version
if: ${{ inputs.run_connectivity_bridge_tests }}
working-directory: thingy91x-oob
run: |
python3 ./tests/on_target/utils/thingy91x_dfu.py --check-nrf53-version --serial THINGY91X_${{ secrets.UART_DUT_2 }} 2>&1 >/dev/null | grep "S1: 1"
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build and Test

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
push:
branches:
- update-dockerfile-target
jobs:
build:
uses: ./.github/workflows/build.yml
secrets: inherit
with:
build_bl_update: false

test:
uses: ./.github/workflows/on_target.yml
needs: build
secrets: inherit
with:
artifact_fw_version: ${{ needs.build.outputs.version }}
artifact_run_id: ${{ needs.build.outputs.run_id }}

0 comments on commit a0bde15

Please sign in to comment.