Skip to content

Commit

Permalink
Merge pull request #10 from golioth/merge/template_v2.4.1
Browse files Browse the repository at this point in the history
Merge template v2.4.1
  • Loading branch information
szczys authored Nov 4, 2024
2 parents 7ac81c7 + 8479aeb commit ad68f13
Show file tree
Hide file tree
Showing 33 changed files with 1,231 additions and 449 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/build_zephyr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Copyright (c) 2023 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: aludel_mini_v1_sparkfun9160_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: 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 }} --sysbuild app
- name: Prepare artifacts
shell: bash
if: inputs.ARTIFACT == true && inputs.TAG != ''

run: |
cd build
mkdir -p artifacts
BOARD_NICENAME=${{ inputs.BOARD }}
BOARD_NICENAME=${BOARD_NICENAME//\//_}
mv merged.hex ./artifacts/golioth-${{ github.event.repository.name }}_${{ inputs.TAG }}_${BOARD_NICENAME}_full.hex
mv app/zephyr/zephyr.signed.bin ./artifacts/golioth-${{ github.event.repository.name }}_${{ inputs.TAG }}_${BOARD_NICENAME}_update.bin
mv app/zephyr/zephyr.elf ./artifacts/golioth-${{ github.event.repository.name }}_${{ inputs.TAG }}_${BOARD_NICENAME}.elf
# Run IDs are unique per repo but are reused on re-runs
- name: Save artifact
if: inputs.ARTIFACT == true
uses: actions/upload-artifact@v3
with:
name: build_artifacts_${{ github.run_id }}
path: |
build/artifacts/*
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# 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: 'template_v0.0.0'
type: string

jobs:
build-binaries:
strategy:
matrix:
ZEPHYR_SDK: [0.16.3]
BOARD: ["nrf9160dk/nrf9160/ns","aludel_mini/nrf9160/ns","aludel_elixir/nrf9160/ns"]

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@v3
with:
name: build_artifacts_${{ github.run_id }}
path: ~/artifacts

- 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 }}
30 changes: 30 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 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_aludel_elixir:
uses: ./.github/workflows/build_zephyr.yml
with:
ZEPHYR_SDK: 0.16.3
BOARD: aludel_elixir/nrf9160/ns
ARTIFACT: false
test_build_aludel_mini:
uses: ./.github/workflows/build_zephyr.yml
with:
ZEPHYR_SDK: 0.16.3
BOARD: aludel_mini/nrf9160/ns
ARTIFACT: false
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright (c) 2023 Golioth, Inc.
# SPDX-License-Identifier: Apache-2.0

build*/
.vscode
.cache
credentials.conf
__pycache__/
golioth-boards
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<!-- SPDX-License-Identifier: Apache-2.0 -->

# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
Expand Down
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ target_sources(app PRIVATE src/main.c)
target_sources(app PRIVATE src/app_rpc.c)
target_sources(app PRIVATE src/app_settings.c)
target_sources(app PRIVATE src/app_state.c)
target_sources(app PRIVATE src/app_work.c)
target_sources(app PRIVATE src/dfu/app_dfu.c)
target_sources_ifdef(CONFIG_BOOTLOADER_MCUBOOT app PRIVATE src/dfu/flash.c)
target_sources(app PRIVATE src/app_sensors.c)

add_subdirectory_ifdef(CONFIG_ALUDEL_BATTERY_MONITOR src/battery_monitor)
3 changes: 3 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<!-- Copyright (c) 2023 Golioth, Inc. -->
<!-- SPDX-License-Identifier: Apache-2.0 -->

# Contributor Covenant Code of Conduct

## Our Pledge
Expand Down
Loading

0 comments on commit ad68f13

Please sign in to comment.