Skip to content

Storage flash backend #1327

Storage flash backend

Storage flash backend #1327

Workflow file for this run

name: Build
on:
workflow_dispatch:
inputs:
memfault_fw_type:
description: Memfault Firmware Type
type: string
required: false
default: "att-dev"
build_all:
description: Build for all targets
type: boolean
required: false
default: false
push_memory_badges:
description: Whether to parse thingy91x build log and push memory badges
type: boolean
required: false
default: false
workflow_call:
inputs:
memfault_fw_type:
type: string
required: false
default: "att-dev"
nrfsdk_sha_update:
type: boolean
required: false
default: false
build_all:
type: boolean
required: false
default: false
push_memory_badges:
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 }}
ncsupdate_pr:
description: Pull request id for west ncs pointer
value: ${{ jobs.build.outputs.ncsupdate_pr }}
pull_request:
paths-ignore:
- "tests/**"
- "docs/**"
- "scripts/**"
- "README.md"
- ".github/workflows/*.yml"
- "!.github/workflows/build.yml"
jobs:
build:
runs-on: build_self_hosted
container: ghcr.io/zephyrproject-rtos/ci:v0.27.4
env:
CMAKE_PREFIX_PATH: /opt/toolchains
outputs:
run_id: ${{ github.run_id }}
version: ${{ env.VERSION }}
ncsupdate_pr: ${{ steps.pr.outputs.pull-request-number }}
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: asset-tracker-template
- name: Initialize
working-directory: asset-tracker-template
run: |
if [ ! -d "../.west" ]; then
west init -l .
else
echo ".west folder already exists, skipping west init."
fi
if [ "$NRFSDK_SHA_UPDATE" = "true" ]; then
NRFSDK_SHA=$(git ls-remote https://github.com/nrfconnect/sdk-nrf main | awk '{print $1}')
sed -i "/revision:/s/\( *revision: *\).*/\1${NRFSDK_SHA}/" west.yml
echo Configuring build on NCS rev ${NRFSDK_SHA}
echo "NRFSDK_SHA=${NRFSDK_SHA}" >> $GITHUB_ENV
fi
west update -o=--depth=1 -n
west blobs fetch hal_nordic
env:
NRFSDK_SHA_UPDATE: ${{ inputs.nrfsdk_sha_update }}
- name: Install dependencies
run: |
# The Matter IDL is part of requirements-build.txt, but it's not available
# in pypi so we need to install it from the source code
MATTER_IDL_PATH=modules/lib/matter/scripts/py_matter_idl
if [ -d $MATTER_IDL_PATH ]; then
pip install -e $MATTER_IDL_PATH
fi
pip install -r nrf/scripts/requirements-build.txt
rm -rf artifacts
mkdir -p artifacts
- 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: asset-tracker-template
run: |
python3 scripts/app_version.py ${GITHUB_REF_NAME} > app/VERSION
cat app/VERSION
- name: Set MEMFAULT_FW_TYPE and MEMFAULT_FW_VERSION_PREFIX
shell: bash
run: |
if [[ -z "${{ inputs.memfault_fw_type }}" ]]; then
echo "MEMFAULT_FW_TYPE=att-dev" >> $GITHUB_ENV
else
echo "MEMFAULT_FW_TYPE=${{ inputs.memfault_fw_type }}" >> $GITHUB_ENV
fi
if [[ "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then
echo "MEMFAULT_FW_VERSION_PREFIX=${{ github.ref_name }}" >> $GITHUB_ENV
else
echo "MEMFAULT_FW_VERSION_PREFIX=0.0.0-dev" >> $GITHUB_ENV
fi
# Asset Tracker Template firmware build
- name: Build thingy91x firmware
uses: ./asset-tracker-template/.github/actions/build-step
with:
board: thingy91x/nrf9151/ns
short_board: thingy91x
version: ${{ env.VERSION }}
path: asset-tracker-template/app
push_memory_badges: ${{ inputs.push_memory_badges }}
- name: Generate Memory Reports and Visualizations
if: ${{ inputs.push_memory_badges }}
continue-on-error: true
working-directory: asset-tracker-template
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Install required packages
pip install pandas plotly --break-system-packages
# Generate sunburst charts first
python3 scripts/sunburst_from_mem_report.py ../artifacts/rom_report_thingy91x.json
python3 scripts/sunburst_from_mem_report.py ../artifacts/ram_report_thingy91x.json
# Generate badges, history plots, and push everything to gh-pages
./tests/on_target/scripts/update_memory_badges.sh \
../artifacts/build_output_thingy91x.log \
../artifacts/rom_report_thingy91x.html \
../artifacts/ram_report_thingy91x.html
- name: Build (old) thingy91 firmware
if: ${{ inputs.build_all }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
board: thingy91/nrf9160/ns
short_board: thingy91
version: ${{ env.VERSION }}
path: asset-tracker-template/app
- name: Build nrf9151dk firmware
if: ${{ inputs.build_all }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
board: nrf9151dk/nrf9151/ns
short_board: nrf9151dk
version: ${{ env.VERSION }}
path: asset-tracker-template/app
- name: Build nrf9160dk firmware
if: ${{ inputs.build_all }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
board: nrf9160dk/nrf9160/ns
short_board: nrf9160dk
version: ${{ env.VERSION }}
path: asset-tracker-template/app
- name: Build nrf9161dk firmware
if: ${{ inputs.build_all }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
board: nrf9161dk/nrf9161/ns
short_board: nrf9161dk
version: ${{ env.VERSION }}
path: asset-tracker-template/app
# Asset Tracker Template debug firmware build
- name: Build thingy91x debug firmware
if: ${{ inputs.build_all }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
memfault_project_key: ${{ secrets.MEMFAULT_PROJECT_KEY }}
memfault_fw_type: ${{ env.MEMFAULT_FW_TYPE }}
memfault_fw_version_prefix: ${{ env.MEMFAULT_FW_VERSION_PREFIX }}
board: thingy91x/nrf9151/ns
short_board: thingy91x
version: ${{ env.VERSION }}-debug
path: asset-tracker-template/app
debug: true
# Asset Tracker Template firmware build with MQTT cloud moduel for Thingy91x
- name: Build thingy91x firmware with MQTT cloud module
if: ${{ inputs.build_all }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
board: thingy91x/nrf9151/ns
short_board: thingy91x
version: ${{ env.VERSION }}-mqtt
path: asset-tracker-template/app
mqtt: true
- name: Build thingy91x with modem trace on uart
if: ${{ inputs.build_all }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
board: thingy91x/nrf9151/ns
short_board: thingy91x
modem_trace: true
version: ${{ env.VERSION }}-mtrace
path: asset-tracker-template/app
- name: Build nrf9151dk with modem trace on uart
if: ${{ inputs.build_all }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
board: nrf9151dk/nrf9151/ns
short_board: nrf9151dk
modem_trace: true
version: ${{ env.VERSION }}-mtrace
path: asset-tracker-template/app
- name: Build nrf9151dk with external GNSS antenna
if: ${{ inputs.build_all }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
board: nrf9151dk/nrf9151/ns
short_board: nrf9151dk
external_gnss: true
version: ${{ env.VERSION }}-ext-gnss
path: asset-tracker-template/app
- name: Build for nRF9161 DK with modem trace on UART 1
if: ${{ inputs.build_all }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
board: nrf9161dk/nrf9161/ns
short_board: nrf9161dk
modem_trace: true
version: ${{ env.VERSION }}-mtrace
path: asset-tracker-template/app
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: firmware-artifacts-att
path: artifacts/*
- name: Print run-id and fw version
run: |
echo Run id: ${{ github.run_id }}
echo Version: ${{ env.VERSION }}
- name: Create update PR
if: ${{ inputs.nrfsdk_sha_update }}
uses: peter-evans/create-pull-request@v7
id: pr
with:
path: asset-tracker-template
add-paths: west.yml
commit-message: "manifest: auto: Update nrf-sdk SHA"
branch: nrf-manifest-auto-branch
base: main
title: "manifest: auto: Update nrf-sdk SHA"
- name: Check outputs
run: |
echo PR created: ${{ steps.pr.outputs.pull-request-number }}