Skip to content

Build

Build #37

Workflow file for this run

name: Build
on:
workflow_call:
inputs:
upload_artifacts:
description: 'Are artifacts required to be uploaded?'
type: boolean
workflow_dispatch:
inputs:
upload_artifacts:
description: 'Are artifacts required to be uploaded?'
type: boolean
jobs:
build:
runs-on: ubuntu-latest
env:
ZEPHYR_SDK_INSTALL_PATH: /opt/toolchains
ZSDK_VERSION: 0.16.8
container:
image: ghcr.io/zephyrproject-rtos/ci-base:v0.26.12
env:
ZEPHYR_TOOLCHAIN_VARIANT: zephyr
ZEPHYR_SDK_INSTALL_DIR: ${ZEPHYR_SDK_INSTALL_PATH}/zephyr-sdk-${ZSDK_VERSION}
PKG_CONFIG_PATH: /usr/lib/i386-linux-gnu/pkgconfig
OVMF_FD_PATH: /usr/share/ovmf/OVMF.fd
steps:
- name: Git checkout
uses: actions/checkout@v4
## The ci-base image now takes care of this, but doesn't allow minimal install ##
- name: Make ZEPHYR_SDK_INSTALL_PATH
run: mkdir -p ${ZEPHYR_SDK_INSTALL_PATH}
- name: Download Zephyr SDK minimal
run: wget -nv https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZSDK_VERSION}/zephyr-sdk-${ZSDK_VERSION}_linux-x86_64_minimal.tar.xz
- name: Extract Zephyr SDK minimal
run: |
tar -xf zephyr-sdk-${ZSDK_VERSION}_linux-x86_64_minimal.tar.xz -C ${ZEPHYR_SDK_INSTALL_PATH}/
rm zephyr-sdk-${ZSDK_VERSION}_linux-x86_64_minimal.tar.xz
- name: Download arm-zephyr-eabi toolchain
run: wget -nv ${WGET_ARGS} https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${ZSDK_VERSION}/toolchain_linux-x86_64_arm-zephyr-eabi.tar.xz
- name: Extract arm-zephyr-eabi toolchain
run: |
tar -xf toolchain_linux-x86_64_arm-zephyr-eabi.tar.xz -C ${ZEPHYR_SDK_INSTALL_PATH}/zephyr-sdk-${ZSDK_VERSION}/
rm toolchain_linux-x86_64_arm-zephyr-eabi.tar.xz
- name: Run Zephyr SDK setup script
run: |
cd ${ZEPHYR_SDK_INSTALL_PATH}
zephyr-sdk-${ZSDK_VERSION}/setup.sh -h -c
- name: Restore west cache
id: west-cache
uses: actions/cache/restore@v4
with:
path: |
bootloader/
modules/
nrf/
nrfxlib/
pcf85063a/
zephyr/
key: ${{ runner.os }}-west-cache-${{ hashFiles('app/west.yml') }}
- name: West update
run: west update
- name: Create west cache
if: steps.west-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
bootloader/
modules/
nrf/
nrfxlib/
pcf85063a/
zephyr/
key: ${{ runner.os }}-west-cache-${{ hashFiles('app/west.yml') }}
- name: Add secret key files
env:
BOOT_ECDSA_P256: ${{ secrets.BOOT_ECDSA_P256 }}
run: |
mkdir ./app/keys/private/
echo "$BOOT_ECDSA_P256" >> ./app/keys/private/boot-ecdsa-p256.pem
- name: Build Zephyr app
env:
BOARD: circuitdojo_feather_nrf9160_ns
run: west build ./app -p
- name: Upload merged.hex
if: ${{ inputs.upload_artifacts }}
uses: actions/upload-artifact@v4
with:
name: merged.hex
path: build/zephyr/merged.hex
- name: Upload app_update.bin
if: ${{ inputs.upload_artifacts }}
uses: actions/upload-artifact@v4
with:
name: app_update.bin
path: build/zephyr/app_update.bin
- name: Upload app_test_update.hex
if: ${{ inputs.upload_artifacts }}
uses: actions/upload-artifact@v4
with:
name: app_test_update.hex
path: build/zephyr/app_test_update.hex