-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (92 loc) · 3.09 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Build
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
# build in a matrix and upload binary artifacts
# - all environments
# - all profiles
# - all boards
build:
runs-on: ubuntu-latest
# build all environments in a matrix
strategy:
fail-fast: false
matrix:
environment: [ "HC32F460C", "HC32F460E" ]
profile: [ "FULL", "TINY", "SMALL" ]
board: [ "VOXELAB_V101" ]
steps:
# checkout the repository
- uses: actions/checkout@v4
# enable caching of pip and platformio
- uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
# install python
- uses: actions/setup-python@v5
with:
python-version: '3.9'
# install platformio
- name: Install PlatformIO core
run: pip install --upgrade platformio
# print the build environment name
- name: Print matrix configuration
run: echo "environment = ${{ matrix.environment }}; profile = ${{ matrix.profile }}; board = ${{ matrix.board }}"
# build the environment with the given profile and board
- name: Build environment
run: export PLATFORMIO_BUILD_FLAGS="-DCONFIG_PROFILE=CONFIG_PROFILE_${{ matrix.profile }} -DBOARD=BOARD_${{ matrix.board }}" ; pio run --environment ${{ matrix.environment }}
# upload the firmware binary
- name: Upload firmware binary
uses: actions/upload-artifact@v4
with:
name: OpenHC32Boot-${{ matrix.environment }}-${{ matrix.board }}-${{ matrix.profile }}
path: .pio/build/${{ matrix.environment }}/firmware.bin
# dummy job after all environments were build
all_build:
runs-on: ubuntu-latest
needs: [build]
if: always()
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
# check all environments in one go
check:
runs-on: ubuntu-latest
# only run checks if all builds succeeded
# no sense in checking for potentially small defects
# if the project doesn't even build
needs: [all_build]
steps:
# checkout the repository
- uses: actions/checkout@v4
# enable caching of pip and platformio
- uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
# install python
- uses: actions/setup-python@v5
with:
python-version: '3.9'
# install platformio
- name: Install PlatformIO core
run: pip install --upgrade platformio
# print the build environment name
- name: Print matrix value for 'environment'
run: echo ${{ matrix.environment }}
# check all environments in one go
# fail even on low defects - all defects should be fixed or at least acknowledged
- name: Check all environments
run: pio check --fail-on-defect=low