diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c614ce10..9c15ac23 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -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 @@ -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 @@ -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 }} diff --git a/.github/workflows/on_target.yml b/.github/workflows/on_target.yml index f5213cbf..8d45b66d 100644 --- a/.github/workflows/on_target.yml +++ b/.github/workflows/on_target.yml @@ -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: @@ -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 @@ -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 @@ -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 @@ -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" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..4f506cc0 --- /dev/null +++ b/.github/workflows/test.yml @@ -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 }}