Skip to content

Commit 8a04ca3

Browse files
committed
feat: add github workflow with semver and release
1 parent 36602d0 commit 8a04ca3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+833
-2
lines changed

.github/workflows/build.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: SemVer Release & Build
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, closed]
6+
branches: main
7+
8+
jobs:
9+
version:
10+
outputs:
11+
next: ${{steps.semver.outputs.next}}
12+
nextStrict: ${{steps.semver.outputs.nextStrict}}
13+
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout Code
17+
uses: actions/checkout@v3
18+
19+
- name: Get Next Version
20+
id: semver
21+
uses: ietf-tools/semver-action@v1
22+
with:
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
branch: main
25+
26+
build:
27+
runs-on: ubuntu-22.04
28+
container: ghcr.io/zephyrproject-rtos/ci:v0.26.2
29+
env:
30+
CMAKE_PREFIX_PATH: /opt/toolchains
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v3
34+
with:
35+
path: example-application
36+
37+
- name: Initialize
38+
working-directory: example-application
39+
run: |
40+
west init -l .
41+
west update
42+
43+
- name: Build firmware
44+
working-directory: example-application
45+
run: |
46+
west twister -T app -v --inline-logs --integration
47+
48+
- name: Twister Tests
49+
working-directory: example-application
50+
run: |
51+
west twister -T tests --integration
52+
53+
release:
54+
runs-on: ubuntu-latest
55+
needs: [version,build]
56+
steps:
57+
- name: Create Release
58+
uses: ncipollo/[email protected]
59+
with:
60+
allowUpdates: true
61+
draft: false
62+
makeLatest: true
63+
generateReleaseNotes: true
64+
name: ${{ needs.version.outputs.next }}
65+
body: Changelog Contents
66+
token: ${{ secrets.GITHUB_TOKEN }}
67+
artifacts: "README.md,LICENSE,app/build/zephyr/${{ github.repository }}-${{ needs.version.outputs.nextStrict }}.uf2"
68+
commit: ${{ github.sha }}
69+
tag: ${{ needs.version.outputs.next }}

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# editors
2+
.vscode
3+
*.swp
4+
*~
5+
6+
# python
7+
.venv
8+
9+
# build
10+
/build*
11+
/twister-out*
12+
13+
__pycache__/

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 2021 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# This CMake file is picked by the Zephyr build system because it is defined
5+
# as the module CMake entry point (see zephyr/module.yml).
6+
7+
zephyr_include_directories(include)
8+
9+
add_subdirectory(drivers)
10+
add_subdirectory(lib)

Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) 2021 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# This Kconfig file is picked by the Zephyr build system because it is defined
5+
# as the module Kconfig entry point (see zephyr/module.yml). You can browse
6+
# module options by going to Zephyr -> Modules in Kconfig.
7+
8+
rsource "drivers/Kconfig"
9+
rsource "lib/Kconfig"

README.md

Lines changed: 80 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,80 @@
1-
# example-application
2-
Example out-of-tree application that is also a module
1+
# Zephyr Example Application
2+
3+
This repository contains a Zephyr example application. The main purpose of this
4+
repository is to serve as a reference on how to structure Zephyr-based
5+
applications. Some of the features demonstrated in this example are:
6+
7+
- Basic [Zephyr application][app_dev] skeleton
8+
- [Zephyr workspace applications][workspace_app]
9+
- [Zephyr modules][modules]
10+
- [West T2 topology][west_t2]
11+
- [Custom boards][board_porting]
12+
- Custom [devicetree bindings][bindings]
13+
- Out-of-tree [drivers][drivers]
14+
- Out-of-tree libraries
15+
- Example CI configuration (using Github Actions)
16+
- Custom [west extension][west_ext]
17+
18+
This repository is versioned together with the [Zephyr main tree][zephyr]. This
19+
means that every time that Zephyr is tagged, this repository is tagged as well
20+
with the same version number, and the [manifest](west.yml) entry for `zephyr`
21+
will point to the corresponding Zephyr tag. For example, the `example-application`
22+
v2.6.0 will point to Zephyr v2.6.0. Note that the `main` branch always
23+
points to the development branch of Zephyr, also `main`.
24+
25+
[app_dev]: https://docs.zephyrproject.org/latest/develop/application/index.html
26+
[workspace_app]: https://docs.zephyrproject.org/latest/develop/application/index.html#zephyr-workspace-app
27+
[modules]: https://docs.zephyrproject.org/latest/develop/modules.html
28+
[west_t2]: https://docs.zephyrproject.org/latest/develop/west/workspaces.html#west-t2
29+
[board_porting]: https://docs.zephyrproject.org/latest/guides/porting/board_porting.html
30+
[bindings]: https://docs.zephyrproject.org/latest/guides/dts/bindings.html
31+
[drivers]: https://docs.zephyrproject.org/latest/reference/drivers/index.html
32+
[zephyr]: https://github.com/zephyrproject-rtos/zephyr
33+
[west_ext]: https://docs.zephyrproject.org/latest/develop/west/extensions.html
34+
35+
## Getting Started
36+
37+
Before getting started, make sure you have a proper Zephyr development
38+
environment. Follow the official
39+
[Zephyr Getting Started Guide](https://docs.zephyrproject.org/latest/getting_started/index.html).
40+
41+
### Initialization
42+
43+
The first step is to initialize the workspace folder (``my-workspace``) where
44+
the ``example-application`` and all Zephyr modules will be cloned. Run the following
45+
command:
46+
47+
```shell
48+
# initialize my-workspace for the example-application (main branch)
49+
west init -m https://github.com/zephyrproject-rtos/example-application --mr main my-workspace
50+
# update Zephyr modules
51+
cd my-workspace
52+
west update
53+
```
54+
55+
### Building and running
56+
57+
To build the application, run the following command:
58+
59+
```shell
60+
west build -b $BOARD app
61+
```
62+
63+
where `$BOARD` is the target board.
64+
65+
You can use the `custom_plank` board found in this
66+
repository. Note that Zephyr sample boards may be used if an
67+
appropriate overlay is provided (see `app/boards`).
68+
69+
A sample debug configuration is also provided. To apply it, run the following
70+
command:
71+
72+
```shell
73+
west build -b $BOARD app -- -DOVERLAY_CONFIG=debug.conf
74+
```
75+
76+
Once you have built the application, run the following command to flash it:
77+
78+
```shell
79+
west flash
80+
```

app/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#-------------------------------------------------------------------------------
2+
# Zephyr Example Application
3+
#
4+
# Copyright (c) 2021 Nordic Semiconductor ASA
5+
# SPDX-License-Identifier: Apache-2.0
6+
7+
cmake_minimum_required(VERSION 3.13.1)
8+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
9+
10+
project(app LANGUAGES C)
11+
12+
target_sources(app PRIVATE src/main.c)

app/Kconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright (c) 2021 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# This file is the application Kconfig entry point. All application Kconfig
5+
# options can be defined here or included via other application Kconfig files.
6+
# You can browse these options using the west targets menuconfig (terminal) or
7+
# guiconfig (GUI).
8+
9+
menu "Zephyr"
10+
source "Kconfig.zephyr"
11+
endmenu
12+
13+
module = APP
14+
module-str = APP
15+
source "subsys/logging/Kconfig.template.log_config"

app/VERSION

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
VERSION_MAJOR = 1
2+
VERSION_MINOR = 0
3+
PATCHLEVEL = 0
4+
VERSION_TWEAK = 0
5+
EXTRAVERSION =

app/boards/nucleo_f302r8.overlay

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright (c) 2021 Nordic Semiconductor ASA
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/* This devicetree overlay file will be automatically picked by the Zephyr
7+
* build system when building the sample for the nucleo_f302r8 board. It shows
8+
* how the example-application can be built on sample boards already provided
9+
* by Zephyr.
10+
*/
11+
12+
/ {
13+
examplesensor0: examplesensor_0 {
14+
compatible = "zephyr,examplesensor";
15+
input-gpios = <&gpioc 13 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
16+
};
17+
};
18+
19+
&gpioc {
20+
status = "okay";
21+
};

app/debug.conf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright (c) 2021 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# This is a Kconfig fragment which can be used to enable debug-related options
5+
# in the application. See the README for more details.
6+
7+
# compiler
8+
CONFIG_DEBUG_OPTIMIZATIONS=y
9+
10+
# console
11+
CONFIG_CONSOLE=y
12+
13+
# UART console
14+
CONFIG_SERIAL=y
15+
CONFIG_UART_CONSOLE=y
16+
17+
# logging
18+
CONFIG_LOG=y
19+
CONFIG_APP_LOG_LEVEL_DBG=y

0 commit comments

Comments
 (0)