-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workflows: add GitHub actions for build and release
Signed-off-by: Mike Szczys <mike@golioth.io>
- Loading branch information
Showing
3 changed files
with
167 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Copyright (c) 2024 Golioth, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Build Zephyr binaries | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
ZEPHYR_SDK: | ||
required: true | ||
type: string | ||
default: 0.16.3 | ||
BOARD: | ||
required: true | ||
type: string | ||
default: nrf9160dk/nr9160/ns | ||
ARTIFACT: | ||
required: true | ||
type: boolean | ||
default: false | ||
TAG: | ||
type: string | ||
|
||
workflow_call: | ||
inputs: | ||
ZEPHYR_SDK: | ||
required: true | ||
type: string | ||
BOARD: | ||
required: true | ||
type: string | ||
ARTIFACT: | ||
required: true | ||
type: boolean | ||
TAG: | ||
type: string | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
container: golioth/golioth-zephyr-base:${{ inputs.ZEPHYR_SDK }}-SDK-v0 | ||
|
||
env: | ||
ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-${{ inputs.ZEPHYR_SDK }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
path: app | ||
|
||
- name: Process Board name | ||
id: nicename | ||
shell: bash | ||
run: | | ||
BOARD_NICENAME=${{ inputs.BOARD }} | ||
BOARD_NICENAME=$(echo $BOARD_NICENAME | cut -d) | ||
echo "BOARD_NICENAME=${BOARD_NICENAME}" >> $GITHUB_OUTPUT | ||
- name: Setup West workspace | ||
run: | | ||
west init -l app | ||
west update --narrow -o=--depth=1 | ||
west zephyr-export | ||
pip3 install -r deps/zephyr/scripts/requirements-base.txt | ||
# Needed for TF-M | ||
pip3 install cryptography pyasn1 pyyaml cbor>=1.0.0 imgtool>=1.9.0 jinja2 click | ||
- name: Build with West | ||
run: | | ||
west build -p -b ${{ inputs.BOARD }} app/01_IOT | ||
- name: Prepare artifacts | ||
shell: bash | ||
if: inputs.ARTIFACT == true && inputs.TAG != '' | ||
|
||
run: | | ||
cd build | ||
mkdir -p artifacts | ||
mv zephyr/merged.hex ./artifacts/Golioth_${{ steps.nicename.outputs.BOARD_NICENAME }}_kitchen_sink_${{ inputs.TAG }}.hex | ||
# Run IDs are unique per repo but are reused on re-runs | ||
- name: Save artifact | ||
if: inputs.ARTIFACT == true | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build_artifacts_${{ github.run_id }}_${{ steps.nicename.outputs.BOARD_NICENAME }} | ||
path: | | ||
build/artifacts/* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Copyright (c) 2023 Golioth, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Create Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Release Version.' | ||
required: true | ||
default: 'v0.0.0' | ||
type: string | ||
|
||
jobs: | ||
build-binaries: | ||
strategy: | ||
matrix: | ||
ZEPHYR_SDK: [0.16.3] | ||
BOARD: ["nrf9160dk/nrf9160/ns","nrf7002dk/nrf5340/cpuapp"] | ||
|
||
uses: ./.github/workflows/build_zephyr.yml | ||
with: | ||
ZEPHYR_SDK: ${{ matrix.ZEPHYR_SDK }} | ||
BOARD: ${{ matrix.BOARD }} | ||
ARTIFACT: true | ||
TAG: ${{ inputs.version }} | ||
|
||
upload-binaries: | ||
needs: build-binaries | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: build_artifacts_* | ||
path: ~/artifacts | ||
merge-multiple: true | ||
|
||
- name: Create Release manually with GH CLI | ||
run: gh release create --title ${{ inputs.version }} --draft ${{ inputs.version }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload artifacts to release | ||
run: gh release upload --clobber ${{ inputs.version }} ~/artifacts/*.* | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright (c) 2023 Golioth, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Test firmware | ||
|
||
on: | ||
pull_request: | ||
|
||
push: | ||
#branches: [ main ] | ||
|
||
jobs: | ||
test_build_nrf9160dk: | ||
uses: ./.github/workflows/build_zephyr.yml | ||
with: | ||
ZEPHYR_SDK: 0.16.3 | ||
BOARD: nrf9160dk/nrf9160/ns | ||
ARTIFACT: false | ||
test_build_nrf7002: | ||
uses: ./.github/workflows/build_zephyr.yml | ||
with: | ||
ZEPHYR_SDK: 0.16.3 | ||
BOARD: nrf7002dk/nrf5340/cpuapp | ||
ARTIFACT: false |