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 c1f1f5d
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 33 deletions.
29 changes: 23 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Build

on:
workflow_dispatch:
workflow_call:
inputs:
build_bl_update:
Expand All @@ -20,6 +21,10 @@ jobs:
container: ghcr.io/zephyrproject-rtos/ci:v0.26.13
env:
CMAKE_PREFIX_PATH: /opt/toolchains
outputs:
artifact-id: ${{ steps.artifact-upload-step.outputs.artifact-id }}
run-id: ${{ github.run_id }}
version: ${{ env.VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -63,23 +68,28 @@ 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
- 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
- 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
- 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
Expand All @@ -101,17 +111,24 @@ jobs:
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 artifact-id: ${{ steps.artifact-upload-step.outputs.artifact-id }}
echo Run id: ${{ github.run_id }}
echo Version: ${{ env.VERSION }}
80 changes: 53 additions & 27 deletions .github/workflows/on_target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,56 @@ name: Target tests

on:
workflow_call:
inputs:
artifact_fw_version:
type: string
required: true
artifact_run_id:
type: number
required: true
artifact_id:
type: string
required: true
run_fota_tests:
type: boolean
required: false
default: true
run_dfu_tests:
type: boolean
required: false
default: true
run_connectivity_bridge_tests:
type: boolean
required: false
default: true
workflow_dispatch:
inputs:
build:
artifact_fw_version:
type: string
required: true
artifact_run_id:
type: number
required: true
artifact_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 +68,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 +107,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 +117,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 +133,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: 684d337a99f57cefe0b32a6dd987f8a8a2cea3fb # ${{ needs.build.outputs.VERSION }}
artifact_run_id: 1057686145410576861454 # ${{ needs.build.outputs.RUNID_FIRMWARE }}
artifact_id: 1859151267 # ${{ needs.build.outputs.ARTIFACT_ID_FIRMWARE }}

0 comments on commit c1f1f5d

Please sign in to comment.