Skip to content

ci: fix build

ci: fix build #1319

Workflow file for this run

name: Build
on:
workflow_dispatch:
inputs:
build_bl_update:
description: Build bootloader update
type: boolean
required: false
default: false
workflow_call:
inputs:
build_bl_update:
type: boolean
required: false
default: false
memfault_sw_type:
type: string
required: false
default: "hello.nrfcloud.com-ci"
outputs:
run_id:
description: The run ID of the workflow to fetch artifacts from
value: ${{ jobs.build.outputs.run_id }}
version:
description: The version of the firmware built on this run_id
value: ${{ jobs.build.outputs.version }}
push:
branches:
- main
pull_request:
schedule:
- cron: "0 0 * * *"
jobs:
build:
runs-on: ubuntu-22.04
container: ghcr.io/zephyrproject-rtos/ci:v0.26.14
env:
CMAKE_PREFIX_PATH: /opt/toolchains
outputs:
run_id: ${{ github.run_id }}
version: ${{ env.VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: thingy91x-oob
- name: Initialize
working-directory: thingy91x-oob
run: |
west init -l .
west config manifest.group-filter +bsec
west config build.sysbuild True
west update -o=--depth=1 -n
- name: Install dependencies
run: |
pip install -r nrf/scripts/requirements-build.txt
- name: Set VERSION environment variable
shell: bash
run: |
if [[ "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then
echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
else
echo "VERSION=${{ github.sha }}" >> $GITHUB_ENV
fi
- name: Update VERSION file for release
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
working-directory: thingy91x-oob
run: |
python3 scripts/app_version.py ${GITHUB_REF_NAME} > app/VERSION
cat app/VERSION
- name: Set MEMFAULT_SW_TYPE from inputs or use default
run: |
if [ -z "${{ inputs.memfault_sw_type }}" ]; then
echo "MEMFAULT_SW_TYPE=hello.nrfcloud.com-ci" >> $GITHUB_ENV
else
echo "MEMFAULT_SW_TYPE=${{ inputs.memfault_sw_type }}" >> $GITHUB_ENV
fi
- name: Apply nrf_wifi HAL patch
run: git apply thingy91x-oob/scripts/nrf_wifi_hal_memory_leak_fix.patch --directory=nrfxlib
- name: Build nrf91 firmware
working-directory: thingy91x-oob/app
run: |
echo "CONFIG_MEMFAULT_NCS_PROJECT_KEY=\"${{ secrets.MEMFAULT_PROJECT_KEY }}\"" >> overlay-memfault.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION_STATIC=y >> overlay-memfault.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION=\"${{ env.VERSION }}\" >> overlay-memfault.conf
echo CONFIG_MEMFAULT_NCS_FW_TYPE=\"${{ env.MEMFAULT_SW_TYPE }}\" >> overlay-memfault.conf
west build -b thingy91x/nrf9151/ns -p --sysbuild -- -DEXTRA_CONF_FILE="overlay-memfault.conf"
- name: Create nrf91 Bootloader HEX file
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: Apply Connectivity Bridge patch for debug feature
run: |
git apply thingy91x-oob/scripts/debug_feature_nrf.patch --directory=nrf
git apply thingy91x-oob/scripts/debug_feature_zephyr.patch --directory=zephyr
- name: Build nrf53 firmware
working-directory: nrf/applications/connectivity_bridge
run: |
west build -b thingy91x/nrf5340/cpuapp -p --sysbuild
- name: Create nrf53 merged_domains HEX file
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
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
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
- name: Apply Connectivity Bridge patch for bootloader update
working-directory: nrf
run: |
git stash --include-untracked
git apply ../thingy91x-oob/scripts/nrf53_bl_update.patch
- name: Build BL Update
if: ${{ inputs.build_bl_update }}
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
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
- 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
- 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: Print run-id and fw version
run: |
echo Run id: ${{ github.run_id }}
echo Version: ${{ env.VERSION }}