workflow: add build workflow #13
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: Firmware build | |
on: | |
push: | |
schedule: | |
- cron: '0 4 * * *' | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
ZEPHYR_SDK_VERSION: 0.16.1 | |
ZEPHYR_SDK_BASE: https://github.com/zephyrproject-rtos/sdk-ng/releases/download | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cache Zephyr SDK | |
id: cache-toolchain | |
uses: actions/cache@v3 | |
with: | |
path: zephyr-sdk | |
key: zephyr-sdk-v${{ env.ZEPHYR_SDK_VERSION }} | |
- if: ${{ steps.cache-toolchain.outputs.cache-hit != 'true' }} | |
name: Download Zephyr SDK | |
run: | | |
wget --progress=dot:giga ${ZEPHYR_SDK_BASE}/v${ZEPHYR_SDK_VERSION}/zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64_minimal.tar.xz | |
mkdir zephyr-sdk | |
tar xvf zephyr-sdk-${ZEPHYR_SDK_VERSION}_linux-x86_64_minimal.tar.xz -C zephyr-sdk --strip-components=1 | |
- name: Setup Zephyr SDK | |
run: | | |
cd zephyr-sdk | |
./setup.sh -t arm-zephyr-eabi -c | |
- name: Install dependencies | |
run: | | |
pip3 install west | |
sudo apt-get install ninja-build | |
- name: Initialize | |
run: | | |
west init -l firmware | |
west update -o=--depth=1 -n | |
- name: Cache Python packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: pip-${{ hashFiles('zephyr/scripts/requirements*.txt') }} | |
- name: Install Python packages | |
run: | | |
pip3 install -r zephyr/scripts/requirements.txt | |
- name: Build | |
run: | | |
west build firmware -DCONFIG_MCUBOOT_SIGNATURE_KEY_FILE="\"bootloader/mcuboot/root-rsa-2048.pem\"" |