Why is expansion so hard #14
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: | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
ZEPHYR_SDK_INSTALL_PATH: /opt/toolchains | |
ZSDK_VERSION: 0.16.5 | |
container: | |
image: ghcr.io/zephyrproject-rtos/ci-base:v0.26.7 | |
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 | |
- name: Install curl | |
run: | | |
type -p curl >/dev/null || (sudo apt-get update && sudo apt-get install curl -y) | |
- 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: Tag and compress build files | |
run: | | |
echo "version=v$(awk 'NR<4{printf "%s%s", sep, $3; sep="."} END{print ""}' app/VERSION)" >> "$GITHUB_ENV" | |
cd build/zephyr/ | |
tar cfJ merged-${version}.hex.tar.xz merged.hex | |
tar cfJ app_update-${version}.bin.tar.xz app_update.bin | |
ls | |
- name: Delete old build cache if present | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
OWNER: ${{ github.repository_owner }} | |
REPO: ${{ github.event.repository.name }} | |
BRANCH: ${{ github.ref_name }} | |
run: | | |
curl -L \ | |
-X DELETE \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer $GH_TOKEN" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
"https://api.github.com/repos/'$OWNER'/'$REPO'/actions/caches?key=build-'$version'" | |
- name: Cache build tarball | |
uses: actions/cache/save@v4 | |
with: | |
path: build/zephyr/*${{ env.version }}*.tar.xz | |
key: build-${{ env.version }} |