Skip to content

workflows: skip building for test changes #1827

workflows: skip building for test changes

workflows: skip building for test changes #1827

Workflow file for this run

name: Build
on:
workflow_dispatch:
inputs:
build_bl_update:
description: Build bootloader update
type: boolean
required: false
default: false
build_debug:
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"
build_debug:
type: boolean
required: false
default: false
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
paths-ignore:
- "tests/on_target/**"
- ".github/workflows/test.yml"
- ".github/workflows/on_target.yml"
pull_request:
paths-ignore:
- "tests/on_target/**"
- ".github/workflows/test.yml"
- ".github/workflows/on_target.yml"
schedule:
- cron: "0 0 * * *"
jobs:
build:
runs-on: ubuntu-24.04
container: ghcr.io/zephyrproject-rtos/ci:v0.27.4
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
west blobs fetch hal_nordic
- uses: robinraju/release-downloader@v1
with:
tag: 'v2.0.0-preview58'
fileName: 'nrf53-bl-v3-*.hex'
- uses: robinraju/release-downloader@v1
with:
tag: 'v2.0.0-preview58'
fileName: 'nrf91-bl-v2.hex'
- 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
# Out-of-box firmware build
- name: Build nrf91 firmware
working-directory: thingy91x-oob/app
run: |
cp overlay-memfault.conf overlay-memfault-oob.conf
echo "CONFIG_MEMFAULT_NCS_PROJECT_KEY=\"${{ secrets.MEMFAULT_PROJECT_KEY }}\"" >> overlay-memfault-oob.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION_STATIC=y >> overlay-memfault-oob.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION=\"${{ env.VERSION }}\" >> overlay-memfault-oob.conf
echo CONFIG_MEMFAULT_NCS_FW_TYPE=\"${{ env.MEMFAULT_SW_TYPE }}\" >> overlay-memfault-oob.conf
west build -b thingy91x/nrf9151/ns -p --sysbuild -- -DEXTRA_CONF_FILE="overlay-memfault-oob.conf"
- name: Rename artifacts
working-directory: thingy91x-oob/app/build
run: |
cp ../../../nrf91-bl-*.hex .
# Overwrite the bootloader part with the frozen version
python3 ../../../zephyr/scripts/build/mergehex.py -o \
hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91.hex \
merged.hex \
nrf91-bl-*.hex \
--overlap replace
cp app/zephyr/.config hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91.config
cp app/zephyr/zephyr.signed.bin hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91-update-signed.bin
cp app/zephyr/zephyr.signed.hex hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91-update-signed.hex
cp app/zephyr/zephyr.elf hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91.elf
cp dfu_application.zip hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91-dfu.zip
- name: Create partition manager report for nRF91 firmware
working-directory: thingy91x-oob/app/build
run: |
ninja partition_manager_report
ninja partition_manager_report > pmr-nrf91-default-${{ env.VERSION }}.txt
sed -i '1d' pmr-nrf91-default-${{ env.VERSION }}.txt
- name: Upload artifact
uses: actions/upload-artifact@v4
id: artifact-upload-oob
with:
name: firmware-oob
if-no-files-found: error
path: |
thingy91x-oob/app/build/hello.nrfcloud.com-*.*
thingy91x-oob/app/build/nrf91-bl-*.hex
thingy91x-oob/app/build/pmr-nrf91-*.txt
# Out-of-box debug firmware build
- name: Build nrf91 debug firmware
if: ${{ inputs.build_debug }}
working-directory: thingy91x-oob/app
run: |
cp overlay-memfault.conf overlay-memfault-debug.conf
echo "CONFIG_MEMFAULT_NCS_PROJECT_KEY=\"${{ secrets.MEMFAULT_PROJECT_KEY }}\"" >> overlay-memfault-debug.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION_STATIC=y >> overlay-memfault-debug.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION=\"${{ env.VERSION }}+debug\" >> overlay-memfault-debug.conf
echo CONFIG_MEMFAULT_NCS_FW_TYPE=\"${{ env.MEMFAULT_SW_TYPE }}\" >> overlay-memfault-debug.conf
echo CONFIG_APP_MEMFAULT_UPLOAD_METRICS_ON_CLOUD_READY=y >> overlay-memfault-debug.conf
west build -p -b thingy91x/nrf9151/ns -p --sysbuild -- -DEXTRA_CONF_FILE="overlay-memfault-debug.conf;overlay-modemtrace-to-memfault.conf;overlay-etb.conf"
- name: Rename debug artifacts
if: ${{ inputs.build_debug }}
working-directory: thingy91x-oob/app/build
run: |
cp ../../../nrf91-bl-*.hex .
# Overwrite the bootloader part with the frozen version
python3 ../../../zephyr/scripts/build/mergehex.py -o \
hello.nrfcloud.com-${{ env.VERSION }}+debug-thingy91x-nrf91.hex \
merged.hex \
nrf91-bl-*.hex \
--overlap replace
cp app/zephyr/.config hello.nrfcloud.com-${{ env.VERSION }}+debug-thingy91x-nrf91.config
cp app/zephyr/zephyr.signed.bin hello.nrfcloud.com-${{ env.VERSION }}+debug-thingy91x-nrf91-update-signed.bin
cp app/zephyr/zephyr.signed.hex hello.nrfcloud.com-${{ env.VERSION }}+debug-thingy91x-nrf91-update-signed.hex
cp app/zephyr/zephyr.elf hello.nrfcloud.com-${{ env.VERSION }}+debug-thingy91x-nrf91.elf
cp dfu_application.zip hello.nrfcloud.com-${{ env.VERSION }}+debug-thingy91x-nrf91-dfu.zip
- name: Create partition manager report for nRF91 debug firmware
if: ${{ inputs.build_debug }}
working-directory: thingy91x-oob/app/build
run: |
ninja partition_manager_report
ninja partition_manager_report > pmr-nrf91-debug-${{ env.VERSION }}.txt
sed -i '1d' pmr-nrf91-debug-${{ env.VERSION }}.txt
- name: Upload artifact
if: ${{ inputs.build_debug }}
uses: actions/upload-artifact@v4
id: artifact-upload-oob-debug
with:
name: firmware-oob-debug
if-no-files-found: error
path: |
thingy91x-oob/app/build/hello.nrfcloud.com-*.*
thingy91x-oob/app/build/pmr-nrf91-*.txt
# Connectivity Bridge firmware build
- name: Build nrf53 firmware
working-directory: nrf/applications/connectivity_bridge
run: |
west build -b thingy91x/nrf5340/cpuapp -p --sysbuild -- -Dmcuboot_CONFIG_FW_INFO_FIRMWARE_VERSION=3 -DCONFIG_BUILD_S1_VARIANT=y
- name: Create partition manager report for nRF53 firmware
working-directory: nrf/applications/connectivity_bridge/build
run: |
ninja partition_manager_report
ninja partition_manager_report > pmr-nrf53-default-${{ env.VERSION }}.txt
sed -i '1d' pmr-nrf53-default-${{ env.VERSION }}.txt
- name: Create nrf53 merged_domains HEX file
run: |
# check that bootloader hex files are present
ls $(pwd)/nrf53-bl-v*-net.hex $(pwd)/nrf53-bl-v*-app.hex
# merge hex files to app, net and merged variants, enforcing the frozen bootloader
python3 zephyr/scripts/build/mergehex.py -o \
$(pwd)/nrf/applications/connectivity_bridge/build/connectivity-bridge-${{ env.VERSION }}-thingy91x-nrf53-net.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/merged_CPUNET.hex \
$(pwd)/nrf53-bl-v*-net.hex \
--overlap replace
python3 zephyr/scripts/build/mergehex.py -o \
$(pwd)/nrf/applications/connectivity_bridge/build/connectivity-bridge-${{ env.VERSION }}-thingy91x-nrf53-app.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/merged.hex \
$(pwd)/nrf53-bl-v*-app.hex \
--overlap replace
python3 zephyr/scripts/build/mergehex.py -o \
$(pwd)/nrf/applications/connectivity_bridge/build/connectivity-bridge-${{ env.VERSION }}-thingy91x-nrf53-merged.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/connectivity-bridge-${{ env.VERSION }}-thingy91x-nrf53-app.hex \
$(pwd)/nrf/applications/connectivity_bridge/build/connectivity-bridge-${{ env.VERSION }}-thingy91x-nrf53-net.hex
- name: Copy nrf53 DFU file
run: |
cp $(pwd)/nrf/applications/connectivity_bridge/build/dfu_application.zip \
$(pwd)/nrf/applications/connectivity_bridge/build/connectivity-bridge-${{ env.VERSION }}-thingy91x-nrf53-dfu.zip
cp nrf53-bl-*.hex $(pwd)/nrf/applications/connectivity_bridge/build/
- name: Upload artifact
uses: actions/upload-artifact@v4
id: artifact-upload-connectivity-bridge
with:
name: firmware-connectivity-bridge
if-no-files-found: error
path: |
nrf/applications/connectivity_bridge/build/connectivity-bridge-*.*
nrf/applications/connectivity_bridge/build/nrf53-bl-*.hex
nrf/applications/connectivity_bridge/build/pmr-nrf53-*.txt
# Bootloader update build
- 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 \
hello.nrfcloud.com-${{ env.VERSION }}-thingy91x-nrf91-bootloader.zip
rm -rf twister-out
west build -b thingy91x/nrf5340/cpuapp -p --sysbuild -d ../nrf/applications/connectivity_bridge/build-bl-update ../nrf/applications/connectivity_bridge -- -Dmcuboot_CONFIG_FW_INFO_FIRMWARE_VERSION=4 -DCONFIG_BUILD_S1_VARIANT=y
cp ../nrf/applications/connectivity_bridge/build-bl-update/dfu_mcuboot.zip \
connectivity-bridge-${{ env.VERSION }}-thingy91x-nrf53-bootloader.zip
- name: Upload artifact
if: ${{ inputs.build_bl_update }}
uses: actions/upload-artifact@v4
id: artifact-upload-bl-update
with:
name: firmware-bl-update
if-no-files-found: error
path: |
thingy91x-oob/hello.nrfcloud.com-*.*
thingy91x-oob/connectivity-bridge-*.*
- name: Print run-id and fw version
run: |
echo Run id: ${{ github.run_id }}
echo Version: ${{ env.VERSION }}