-
Notifications
You must be signed in to change notification settings - Fork 1
284 lines (238 loc) · 8.06 KB
/
main.yml
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
name: desktop_build
on:
push:
branches: ["main"]
tags:
- "*"
pull_request:
branches: ["main"]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
lint:
runs-on: ubuntu-latest
name: "Lint job"
steps:
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: clang-format-11 git python3 python3-venv
version: 1.0
- uses: actions/checkout@v3
with:
submodules: "recursive"
- name: Install things
working-directory: ${{github.workspace}}
run: |
python3 --version
python3 -m venv .venv/
source .venv/bin/activate
python -m pip install --upgrade pip
pip install cpplint
- name: Run lint
working-directory: ${{github.workspace}}
run: |
source .venv/bin/activate
chmod -R +x ./ci/run_lint.sh
./ci/run_lint.sh
build-linux:
runs-on: ubuntu-latest
name: "Build desktop flight software"
steps:
- name: Setup cmake
uses: jwlawson/[email protected]
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: make g++ gcc
version: 1.0
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: "recursive"
# Fetch tags.
- name: Fetch tags
working-directory: ${{github.workspace}}
run: git fetch --tags --force
- name: Configure CMake
working-directory: ${{github.workspace}}
run: |
touch CMakeListsPrivate.txt
chmod -R +x ci/build_desktop.sh
- name: Build desktop
working-directory: ${{github.workspace}}
run: ./ci/build_desktop.sh
- uses: actions/upload-artifact@v4
with:
name: desktop_sim
path: ${{github.workspace}}/build/desktop_projects/desktop_sim/desktop_sim
build-platformio:
strategy:
fail-fast: false
matrix:
include:
- env-name: "feather_m0_lora"
- env-name: "feather_m0_lora_groundstation"
- env-name: "feather_m4_hacky_lora_groundstation"
runs-on: ubuntu-latest
name: "Build PlatformIO flight software for ${{ matrix.env-name }}"
steps:
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/.cache
.pio/libdeps
key: ${{ runner.os }}-pio
- uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install PlatformIO Core
run: pip install --upgrade platformio
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: "recursive"
- name: Fetch tags
working-directory: ${{github.workspace}}
run: |
git fetch --tags --force
- name: Build PlatformIO project
run: |
pio run -e ${{ matrix.env-name }}
find .pio/build
- name: Rename artifact
working-directory: ${{github.workspace}}/.pio/build/${{ matrix.env-name }}
run: |
mv firmware.bin ${{ matrix.env-name }}-pio.bin
mv firmware.elf ${{ matrix.env-name }}-pio.elf
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.env-name }}
if-no-files-found: error
path: |
.pio/build/${{ matrix.env-name }}/**/*.elf
.pio/build/${{ matrix.env-name }}/**/*.bin
build-stm32-cmake:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-12]
prj-target:
[
"fcb_v0",
"fcb_v1",
"fcb_v2",
"groundstation",
"amazon-stm32-arduino",
"prop_adcboard_v2",
]
runs-on: ${{ matrix.os }}
name: "CMake ${{ matrix.os}}: Build STM32 flight software for ${{ matrix.prj-target }}"
steps:
- uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: 12.3.Rel1
- uses: jwlawson/[email protected]
- uses: actions/cache@v3
with:
path: |
build/_deps
key: ${{ runner.os }}-cmake_deps
# We need to use Ninja on Windows for builds -- install it here
- name: Install Ninja
if: startsWith(matrix.os, 'windows-latest')
run: |
choco install ninja
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: "recursive"
- name: Fetch tags
working-directory: ${{github.workspace}}
run: |
git config --global --add safe.directory /__w/stm32-avionics/stm32-avionics
git fetch --tags --force
- name: Configure CMake
working-directory: ${{github.workspace}}
run: |
touch CMakeListsPrivate.txt
cmake . -B build -DPROJECT_BUILD_TYPE="stm32" -DCMAKE_TOOLCHAIN_FILE="cmake/stm32-cmake/cmake/stm32_gcc.cmake" ${{ (startsWith(matrix.os, 'windows-latest') && '-DCMAKE_GENERATOR=Ninja') || '' }}
cmake --build build --target ${{ matrix.prj-target }} -j
- name: Rename artifact
working-directory: ${{github.workspace}}/build/stm32_projects/${{ matrix.prj-target }}
run: |
mv ${{ matrix.prj-target }}.elf ${{ matrix.prj-target }}-cmake-${{ matrix.os }}.elf
mv ${{ matrix.prj-target }}.hex ${{ matrix.prj-target }}-cmake-${{ matrix.os }}.hex
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.prj-target }}-${{ matrix.os }}
path: |
build/stm32_projects/${{ matrix.prj-target }}/**/*.elf
build/stm32_projects/${{ matrix.prj-target }}/**/*.hex
build-stm32-cube:
strategy:
fail-fast: false
matrix:
include:
- prj-rel-path: "stm32_projects/fcb_v0"
prj-target: "fcb_v0"
- prj-rel-path: "stm32_projects/fcb_v1"
prj-target: "fcb_v1"
- prj-rel-path: "stm32_projects/fcb_v2"
prj-target: "fcb_v2"
- prj-rel-path: "stm32_projects/groundstation"
prj-target: "groundstation"
- prj-rel-path: "stm32_projects/prop_adcboard_v2"
prj-target: "prop_adcboard_v2"
runs-on: ubuntu-latest
container:
image: mcm001/stm-actions:v1.0.1
options: --user 1001
name: "Cube: Build STM32 flight software for ${{ matrix.prj-target }}"
steps:
- name: Check for dockerenv file
run: (ls /.dockerenv && echo Found dockerenv) || (echo No dockerenv)
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: "recursive"
- name: Fetch tags
working-directory: ${{github.workspace}}
run: |
git config --global --add safe.directory /__w/stm32-avionics/stm32-avionics
git fetch --tags --force
- name: Run build
run: /entrypoint.sh ${{ matrix.prj-rel-path }} ${{ matrix.prj-target }}
- name: Rename artifact
run: |
cd ${{ matrix.prj-rel-path }}
for f in **/*.elf; do mv "$f" "$(echo "$f" | sed s/.elf/-cube.elf/)"; done
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.prj-target }}
path: ${{ matrix.prj-rel-path }}/**/*.elf
release:
needs: [build-linux, lint, build-stm32-cmake, build-stm32-cube]
runs-on: ubuntu-latest
steps:
# Download literally every single artifact. This also downloads client and docs,
# but the filtering below won't pick these up (I hope)
- uses: actions/download-artifact@v4
- run: find
# Push to dev release on pushes to master
- uses: pyTooling/Actions/releaser@r0
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: "Dev"
rm: true
files: |
**/*
if: github.event_name == 'push'
# Push to actual release, if tagged
- uses: softprops/action-gh-release@v1
with:
files: |
**/*
if: startsWith(github.ref, 'refs/tags/v')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}