Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/actions/build-step/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: "Buildstep"
description: "Build ATT firmware"
inputs:
memfault_project_key:
type: string
required: false
default: "fookey"
memfault_fw_type:
type: string
required: false
default: "asset-tracker-template-dev"
memfault_fw_version_prefix:
type: string
required: false
default: "0.0.0-dev"
board:
type: string
required: true
short_board:
type: string
required: true
version:
type: string
required: false
default: "0.0.0-dev"
path:
type: string
required: true
default: "."
debug:
type: boolean
required: false
default: false

runs:
using: "composite"
steps:
- name: Set up environment
id: setup
shell: bash
run: |
if [[ "${{ inputs.debug }}" == "true" ]]; then
echo "VERSION=${{ inputs.version }}-debug" >> $GITHUB_OUTPUT
echo "UPLOAD_ID=${{ inputs.short_board }}-debug" >> $GITHUB_OUTPUT
else
echo "VERSION=${{ inputs.version }}" >> $GITHUB_OUTPUT
echo "UPLOAD_ID=${{ inputs.short_board }}" >> $GITHUB_OUTPUT
fi
if [[ -z "${{ inputs.memfault_fw_type }}" ]]; then
FW_TYPE=asset-tracker-template-dev
else
FW_TYPE=${{ inputs.memfault_fw_type }}
fi
cd ${{ inputs.path }}
cp overlay-memfault.conf overlay-memfault-att.conf
echo "CONFIG_MEMFAULT_NCS_PROJECT_KEY=\"${{ inputs.memfault_project_key }}\"" >> overlay-memfault-att.conf
echo CONFIG_MEMFAULT_NCS_FW_TYPE=\"$FW_TYPE\" >> overlay-memfault-att.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION_AUTO=y >> overlay-memfault-att.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION_PREFIX=\"${{ inputs.memfault_fw_version_prefix }}+\" >> overlay-memfault-att.conf

- name: Build firmware
shell: bash
run: |
cd ${{ inputs.path }}
west build -b ${{ inputs.board }} -d build -p --sysbuild -- -DEXTRA_CONF_FILE="overlay-memfault-att.conf" > /dev/null

- name: Copy artifacts
shell: bash
run: |
mkdir -p artifacts
cp ${{ inputs.path }}/build/merged.hex \
artifacts/asset-tracker-template-${{ steps.setup.outputs.VERSION }}-${{ inputs.short_board }}-nrf91.hex
cp ${{ inputs.path }}/build/app/zephyr/.config \
artifacts/asset-tracker-template-${{ steps.setup.outputs.VERSION }}-${{ inputs.short_board }}-nrf91.config
cp ${{ inputs.path }}/build/app/zephyr/zephyr.signed.bin \
artifacts/asset-tracker-template-${{ steps.setup.outputs.VERSION }}-${{ inputs.short_board }}-nrf91-update-signed.bin
cp ${{ inputs.path }}/build/app/zephyr/zephyr.signed.hex \
artifacts/asset-tracker-template-${{ steps.setup.outputs.VERSION }}-${{ inputs.short_board }}-nrf91-update-signed.hex
cp ${{ inputs.path }}/build/app/zephyr/zephyr.elf \
artifacts/asset-tracker-template-${{ steps.setup.outputs.VERSION }}-${{ inputs.short_board }}-nrf91.elf
cp ${{ inputs.path }}/build/dfu_application.zip \
artifacts/asset-tracker-template-${{ steps.setup.outputs.VERSION }}-${{ inputs.short_board }}-nrf91-dfu.zip
cd ${{ inputs.path }}/build
ninja partition_manager_report > partition_manager_report.txt

- name: Generate Partition Manager Report
shell: bash
run: |
sed '1d' ${{ inputs.path }}/build/partition_manager_report.txt > artifacts/pmr-${{ inputs.short_board }}-nrf91-default-${{ steps.setup.outputs.VERSION }}.txt
152 changes: 55 additions & 97 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
type: boolean
required: false
default: false
memfault_fw_type:
type: string
required: false
default: "asset-tracker-template-dev"
workflow_call:
inputs:
memfault_fw_type:
Expand All @@ -28,6 +32,9 @@ on:
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:
Expand All @@ -47,6 +54,7 @@ jobs:
outputs:
run_id: ${{ github.run_id }}
version: ${{ env.VERSION }}
ncsupdate_pr: ${{ steps.pr.outputs.pull-request-number }}
permissions:
contents: write
pull-requests: write
Expand Down Expand Up @@ -78,8 +86,8 @@ jobs:
- name: Install dependencies
run: |
pip install -r nrf/scripts/requirements-build.txt
apt update
apt install -y --no-install-recommends gh
rm -rf artifacts
mkdir -p artifacts

- name: Set VERSION environment variable
shell: bash
Expand All @@ -102,8 +110,10 @@ jobs:
run: |
if [[ -z "${{ inputs.memfault_fw_type }}" ]]; then
echo "MEMFAULT_FW_TYPE=asset-tracker-template-dev" >> $GITHUB_ENV
echo "MEMFAULT_FW_TYPE=asset-tracker-template-dev"
else
echo "MEMFAULT_FW_TYPE=${{ inputs.memfault_fw_type }}" >> $GITHUB_ENV
echo "MEMFAULT_FW_TYPE=${{ inputs.memfault_fw_type }}"
fi

if [[ "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then
Expand All @@ -114,116 +124,64 @@ jobs:

# Asset Tracker Template firmware build
- name: Build thingy91x firmware
working-directory: asset-tracker-template/app
run: |
mkdir -p artifacts
cp overlay-memfault.conf overlay-memfault-att.conf
echo "CONFIG_MEMFAULT_NCS_PROJECT_KEY=\"${{ secrets.MEMFAULT_PROJECT_KEY }}\"" >> overlay-memfault-att.conf
echo CONFIG_MEMFAULT_NCS_FW_TYPE=\"${{ env.MEMFAULT_FW_TYPE }}\" >> overlay-memfault-att.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION_AUTO=y >> overlay-memfault-att.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION_PREFIX=\"${{ env.MEMFAULT_FW_VERSION_PREFIX }}+\" >> overlay-memfault-att.conf
west build -b thingy91x/nrf9151/ns -d build -p --sysbuild -- -DEXTRA_CONF_FILE="overlay-memfault-att.conf" 2>&1 | tee artifacts/build_output_thingy91x.log
cp build/merged.hex artifacts/asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91.hex
cp build/app/zephyr/.config artifacts/asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91.config
cp build/app/zephyr/zephyr.signed.bin artifacts/asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91-update-signed.bin
cp build/app/zephyr/zephyr.signed.hex artifacts/asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91-update-signed.hex
cp build/app/zephyr/zephyr.elf artifacts/asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91.elf
cp build/dfu_application.zip artifacts/asset-tracker-template-${{ env.VERSION }}-thingy91x-nrf91-dfu.zip
cd build
ninja partition_manager_report
ninja partition_manager_report > ../artifacts/pmr-thingy91x-nrf91-default-${{ env.VERSION }}.txt
sed -i '1d' ../artifacts/pmr-thingy91x-nrf91-default-${{ env.VERSION }}.txt
uses: ./asset-tracker-template/.github/actions/build-step
with:
memfault_project_key: ${{ secrets.MEMFAULT_PROJECT_KEY }}
memfault_fw_type: ${{ inputs.memfault_fw_type }}
memfault_fw_version_prefix: ${{ env.MEMFAULT_FW_VERSION_PREFIX }}
board: thingy91x/nrf9151/ns
short_board: thingy91x
version: ${{ env.VERSION }}
path: asset-tracker-template/app

- name: Build nrf9151dk firmware
if: ${{ github.event_name != 'pull_request' }}
working-directory: asset-tracker-template/app
run: |
mkdir -p artifacts
cp overlay-memfault.conf overlay-memfault-att.conf
echo "CONFIG_MEMFAULT_NCS_PROJECT_KEY=\"${{ secrets.MEMFAULT_PROJECT_KEY }}\"" >> overlay-memfault-att.conf
echo CONFIG_MEMFAULT_NCS_FW_TYPE=\"${{ env.MEMFAULT_FW_TYPE }}\" >> overlay-memfault-att.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION_AUTO=y >> overlay-memfault-att.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION_PREFIX=\"${{ env.MEMFAULT_FW_VERSION_PREFIX }}+\" >> overlay-memfault-att.conf
west build -b nrf9151dk/nrf9151/ns -d build -p --sysbuild -- -DEXTRA_CONF_FILE="overlay-memfault-att.conf"
cp build/merged.hex artifacts/asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91.hex
cp build/app/zephyr/.config artifacts/asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91.config
cp build/app/zephyr/zephyr.signed.bin artifacts/asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91-update-signed.bin
cp build/app/zephyr/zephyr.signed.hex artifacts/asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91-update-signed.hex
cp build/app/zephyr/zephyr.elf artifacts/asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91.elf
cp build/dfu_application.zip artifacts/asset-tracker-template-${{ env.VERSION }}-nrf9151dk-nrf91-dfu.zip
cd build
ninja partition_manager_report
ninja partition_manager_report > ../artifacts/pmr-nrf9151dk-nrf91-default-${{ env.VERSION }}.txt
sed -i '1d' ../artifacts/pmr-nrf9151dk-nrf91-default-${{ env.VERSION }}.txt

- name: Upload artifact
uses: actions/upload-artifact@v4
id: artifact-upload-att
uses: ./asset-tracker-template/.github/actions/build-step
with:
name: firmware-att
if-no-files-found: error
path: |
asset-tracker-template/app/artifacts/*
memfault_project_key: ${{ secrets.MEMFAULT_PROJECT_KEY }}
memfault_fw_type: ${{ env.MEMFAULT_FW_TYPE }}
memfault_fw_version_prefix: ${{ env.MEMFAULT_FW_VERSION_PREFIX }}
board: nrf9151dk/nrf9151/ns
short_board: nrf9151dk
version: ${{ env.VERSION }}
path: asset-tracker-template/app

# Asset Tracker Template debug firmware build
- name: Build thingy91x debug firmware
if: ${{ inputs.build_debug }}
working-directory: asset-tracker-template/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_TYPE=\"${{ env.MEMFAULT_FW_TYPE }}\" >> overlay-memfault-debug.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION_AUTO=y >> overlay-memfault-debug.conf
echo CONFIG_MEMFAULT_NCS_FW_VERSION_PREFIX=\"${{ env.MEMFAULT_FW_VERSION_PREFIX }}-debug+\" >> overlay-memfault-debug.conf
west build -p -b thingy91x/nrf9151/ns -p --sysbuild -- -DEXTRA_CONF_FILE="overlay-memfault-debug.conf;overlay-etb.conf"

- name: Rename debug artifacts
if: ${{ inputs.build_debug }}
working-directory: asset-tracker-template/app/build
run: |
cp merged.hex asset-tracker-template-${{ env.VERSION }}-debug-thingy91x-nrf91.hex
cp app/zephyr/.config asset-tracker-template-${{ env.VERSION }}-debug-thingy91x-nrf91.config
cp app/zephyr/zephyr.signed.bin asset-tracker-template-${{ env.VERSION }}-debug-thingy91x-nrf91-update-signed.bin
cp app/zephyr/zephyr.signed.hex asset-tracker-template-${{ env.VERSION }}-debug-thingy91x-nrf91-update-signed.hex
cp app/zephyr/zephyr.elf asset-tracker-template-${{ env.VERSION }}-debug-thingy91x-nrf91.elf
cp dfu_application.zip asset-tracker-template-${{ env.VERSION }}-debug-thingy91x-nrf91-dfu.zip

- name: Create partition manager report for nRF91 debug firmware
if: ${{ inputs.build_debug }}
working-directory: asset-tracker-template/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 debug artifact
if: ${{ inputs.build_debug }}
uses: ./asset-tracker-template/.github/actions/build-step
with:
memfault_project_key: ${{ secrets.MEMFAULT_PROJECT_KEY }}
memfault_fw_type: ${{ inputs.memfault_fw_type }}
memfault_fw_version_prefix: ${{ env.MEMFAULT_FW_VERSION_PREFIX }}
board: nrf9151dk/nrf9151/ns
short_board: nrf9151dk
version: ${{ env.VERSION }}
path: asset-tracker-template/app

- name: Upload artifacts
uses: actions/upload-artifact@v4
id: artifact-upload-att-debug
with:
name: firmware-att-debug
if-no-files-found: error
path: |
asset-tracker-template/app/build/asset-tracker-template-*.*
asset-tracker-template/app/build/pmr-nrf91-*.txt
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: Auto PR update NCS reference
- name: Create update PR
if: ${{ inputs.nrfsdk_sha_update }}
working-directory: asset-tracker-template
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: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add west.yml
git commit -m "manifest: auto: Update nrf-sdk SHA"
git push origin HEAD:nrf-manifest-auto-branch --force
gh pr create --title "manifest: auto: Update nrf-sdk SHA" \
--body "Created by GitHub Action" \
--base main \
--head nrf-manifest-auto-branch || true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
echo PR created: ${{ steps.pr.outputs.pull-request-number }}
15 changes: 15 additions & 0 deletions .github/workflows/ncsref-update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,18 @@ jobs:
artifact_run_id: ${{ needs.build.outputs.run_id }}
pytest_marker: not slow
is_scheduled: false
update-pr-state:
needs: [build, test]
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
packages: read
pull-requests: write
steps:
- name: Update PR state
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ needs.build.outputs.ncsupdate_pr }}
body: |
Tests PASSED on latest ncs SHA :white_check_mark:
20 changes: 11 additions & 9 deletions .github/workflows/target-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ on:
type: boolean
required: false
default: false
nrfsdk_sha_update:
type: boolean
required: false
default: false

workflow_dispatch:
inputs:
Expand Down Expand Up @@ -54,12 +58,13 @@ jobs:
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
matrix="${{ github.event.inputs.devices }}"
elif [[ "${{ inputs.is_scheduled }}" == "true" ]]; then
matrix='["thingy91x","nrf9151dk"]'
else
if [[ "${{ inputs.is_scheduled }}" == "true" ]]; then
matrix='["thingy91x","nrf9151dk","ppk_thingy91x"]'
else
matrix='["thingy91x"]'
fi
matrix='["thingy91x"]'
fi
if [[ -z "$matrix" ]]; then
matrix='["thingy91x"]'
fi

echo "Matrix as string: $matrix"
Expand All @@ -80,12 +85,10 @@ jobs:
runs-on: cia-trd-${{ matrix.device }}
environment: ${{ matrix.device }}
name: Target Test - ${{ matrix.device }}

permissions:
actions: read
contents: write
packages: read

container:
image: ghcr.io/nrfconnect/asset-tracker-template:test-docker-v1.0.1
options: --privileged
Expand All @@ -108,8 +111,7 @@ jobs:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: firmware-*
merge-multiple: true
name: firmware-artifacts-att
path: asset-tracker-template/tests/on_target/artifacts
run-id: ${{ inputs.artifact_run_id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down