Merge pull request #45 from umts/ncs-2.6.1 #58
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
push: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
ZEPHYR_SDK_INSTALL_PATH: /opt/toolchains | |
ZSDK_VERSION: 0.16.9 | |
container: | |
image: ghcr.io/zephyrproject-rtos/ci-base:v0.26-branch | |
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: Update Python dependencies | |
run: | | |
pip install -r zephyr/scripts/requirements.txt | |
pip install -r nrf/scripts/requirements.txt | |
pip install -r bootloader/mcuboot/scripts/requirements.txt | |
- 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: Extract branch name | |
shell: bash | |
run: echo "BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV | |
- name: Upload merged.hex | |
if: ${{ inputs.upload_artifacts }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.BRANCH }}_merged.hex | |
path: build/zephyr/merged.hex | |
- name: Upload app_update.bin | |
if: ${{ inputs.upload_artifacts }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.BRANCH }}_app_update.bin | |
path: build/zephyr/app_update.bin |