Skip to content

Commit 3b0d619

Browse files
amathamkamathamk
authored andcommitted
.github: simulink support for ArduCopter
Glue code to enable Simulink-generated controller with ArduCopter
1 parent c9d406c commit 3b0d619

File tree

1 file changed

+384
-0
lines changed

1 file changed

+384
-0
lines changed
Lines changed: 384 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,384 @@
1+
name: test copter Simulink
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
# remove other vehicles
7+
- 'AntennaTracker/**'
8+
- 'ArduPlane/**'
9+
- 'ArduSub/**'
10+
- 'Blimp/**'
11+
- 'Rover/**'
12+
# remove non SITL HAL
13+
- 'libraries/AP_HAL_ChibiOS/**'
14+
- 'libraries/AP_HAL_ESP32/**'
15+
- 'libraries/AP_HAL_QURT/**'
16+
# remove non SITL directories
17+
- 'Tools/AP_Bootloader/**'
18+
- 'Tools/AP_Periph/**'
19+
- 'Tools/bootloaders/**'
20+
- 'Tools/CHDK-Script/**'
21+
- 'Tools/CodeStyle/**'
22+
- 'Tools/completion/**'
23+
- 'Tools/CPUInfo/**'
24+
- 'Tools/debug/**'
25+
- 'Tools/environment_install/**'
26+
- 'Tools/FilterTestTool/**'
27+
- 'Tools/Frame_params/**'
28+
- 'Tools/geotag/**'
29+
- 'Tools/GIT_Test/**'
30+
- 'Tools/gittools/**'
31+
- 'Tools/Hello/**'
32+
- 'Tools/IO_Firmware/**'
33+
- 'Tools/Linux_HAL_Essentials/**'
34+
- 'Tools/Pozyx/**'
35+
- 'Tools/PrintVersion.py'
36+
- 'Tools/simulink/**'
37+
- 'Tools/UDP_Proxy/**'
38+
- 'Tools/vagrant/**'
39+
- 'Tools/Vicon/**'
40+
# Discard python file from Tools/scripts as not used
41+
- 'Tools/scripts/**.py'
42+
- 'Tools/scripts/build_sizes/**'
43+
- 'Tools/scripts/build_tests/**'
44+
- 'Tools/scripts/CAN/**'
45+
- 'Tools/scripts/signing/**'
46+
# Remove other vehicles autotest
47+
- 'Tools/autotest/antennatracker.py'
48+
- 'Tools/autotest/arduplane.py'
49+
- 'Tools/autotest/ardusub.py'
50+
- 'Tools/autotest/balancebot.py'
51+
- 'Tools/autotest/location.txt'
52+
- 'Tools/autotest/quadplane.py'
53+
- 'Tools/autotest/rover.py'
54+
- 'Tools/autotest/sailboat.py'
55+
- 'Tools/autotest/swarminit.txt'
56+
# Remove markdown files as irrelevant
57+
- '**.md'
58+
# Remove dotfile at root directory
59+
- './.dir-locals.el'
60+
- './.dockerignore'
61+
- './.editorconfig'
62+
- './.flake8'
63+
- './.gitattributes'
64+
- './.github'
65+
- './.gitignore'
66+
- './.pre-commit-config.yaml'
67+
- './.pydevproject'
68+
- './.valgrind-suppressions'
69+
- './.valgrindrc'
70+
- 'Dockerfile'
71+
- 'Vagrantfile'
72+
- 'Makefile'
73+
# Remove some directories check
74+
- '.vscode/**'
75+
- '.github/ISSUE_TEMPLATE/**'
76+
# Remove change on other workflows
77+
- '.github/workflows/test_environment.yml'
78+
79+
80+
pull_request:
81+
paths-ignore:
82+
# remove other vehicles
83+
- 'AntennaTracker/**'
84+
- 'ArduPlane/**'
85+
- 'ArduSub/**'
86+
- 'Blimp/**'
87+
- 'Rover/**'
88+
# remove non SITL HAL
89+
- 'libraries/AP_HAL_ChibiOS/**'
90+
- 'libraries/AP_HAL_ESP32/**'
91+
- 'libraries/AP_HAL_QURT/**'
92+
# remove non SITL directories
93+
- 'Tools/AP_Bootloader/**'
94+
- 'Tools/AP_Periph/**'
95+
- 'Tools/bootloaders/**'
96+
- 'Tools/CHDK-Script/**'
97+
- 'Tools/CodeStyle/**'
98+
- 'Tools/completion/**'
99+
- 'Tools/CPUInfo/**'
100+
- 'Tools/debug/**'
101+
- 'Tools/environment_install/**'
102+
- 'Tools/FilterTestTool/**'
103+
- 'Tools/Frame_params/**'
104+
- 'Tools/geotag/**'
105+
- 'Tools/GIT_Test/**'
106+
- 'Tools/gittools/**'
107+
- 'Tools/Hello/**'
108+
- 'Tools/IO_Firmware/**'
109+
- 'Tools/Linux_HAL_Essentials/**'
110+
- 'Tools/LogAnalyzer/**'
111+
- 'Tools/Pozyx/**'
112+
- 'Tools/PrintVersion.py'
113+
- 'Tools/simulink/**'
114+
- 'Tools/UDP_Proxy/**'
115+
- 'Tools/vagrant/**'
116+
- 'Tools/Vicon/**'
117+
# Discard python file from Tools/scripts as not used
118+
- 'Tools/scripts/**.py'
119+
- 'Tools/scripts/build_sizes/**'
120+
- 'Tools/scripts/build_tests/**'
121+
- 'Tools/scripts/CAN/**'
122+
- 'Tools/scripts/signing/**'
123+
# Remove other vehicles autotest
124+
- 'Tools/autotest/antennatracker.py'
125+
- 'Tools/autotest/arduplane.py'
126+
- 'Tools/autotest/ardusub.py'
127+
- 'Tools/autotest/balancebot.py'
128+
- 'Tools/autotest/location.txt'
129+
- 'Tools/autotest/quadplane.py'
130+
- 'Tools/autotest/rover.py'
131+
- 'Tools/autotest/sailboat.py'
132+
- 'Tools/autotest/swarminit.txt'
133+
# Remove markdown files as irrelevant
134+
- '**.md'
135+
# Remove dotfile at root directory
136+
- './.dir-locals.el'
137+
- './.dockerignore'
138+
- './.editorconfig'
139+
- './.flake8'
140+
- './.gitattributes'
141+
- './.github'
142+
- './.gitignore'
143+
- './.pre-commit-config.yaml'
144+
- './.pydevproject'
145+
- './.valgrind-suppressions'
146+
- './.valgrindrc'
147+
- 'Dockerfile'
148+
- 'Vagrantfile'
149+
- 'Makefile'
150+
# Remove some directories check
151+
- '.vscode/**'
152+
- '.github/ISSUE_TEMPLATE/**'
153+
# Remove change on other workflows
154+
- '.github/workflows/test_environment.yml'
155+
156+
workflow_dispatch:
157+
158+
concurrency:
159+
group: ci-${{github.workflow}}-${{ github.ref }}
160+
cancel-in-progress: true
161+
162+
jobs:
163+
build:
164+
runs-on: ubuntu-22.04
165+
container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.3
166+
strategy:
167+
fail-fast: false # don't cancel if a job from the matrix fails
168+
matrix:
169+
toolchain: [
170+
base, # GCC
171+
clang,
172+
]
173+
steps:
174+
# git checkout the PR
175+
- uses: actions/checkout@v4
176+
with:
177+
submodules: 'recursive'
178+
179+
# Put ccache into github cache for faster build
180+
- name: Prepare ccache timestamp
181+
id: ccache_cache_timestamp
182+
run: |
183+
NOW=$(date -u +"%F-%T")
184+
echo "timestamp=${NOW}" >> $GITHUB_OUTPUT
185+
- name: ccache cache files
186+
uses: actions/cache@v4
187+
with:
188+
path: ~/.ccache
189+
key: ${{github.workflow}}-ccache-${{ matrix.toolchain }}-${{steps.ccache_cache_timestamp.outputs.timestamp}}
190+
restore-keys: ${{github.workflow}}-ccache-${{ matrix.toolchain }}- # restore ccache from either previous build on this branch or on master
191+
- name: setup ccache
192+
run: |
193+
. .github/workflows/ccache.env
194+
- name: build copter ${{ matrix.toolchain }}
195+
shell: bash
196+
run: |
197+
git config --global --add safe.directory ${GITHUB_WORKSPACE}
198+
if [[ ${{ matrix.toolchain }} == "clang" ]]; then
199+
export CC=clang
200+
export CXX=clang++
201+
fi
202+
PATH="/github/home/.local/bin:$PATH"
203+
./waf configure --board sitl --debug --enable-simulink-app
204+
./waf build --target bin/arducopter
205+
ccache -s
206+
ccache -z
207+
208+
autotest:
209+
needs: build # don't try to launch the tests matrix if it doesn't build first, profit from caching for fast build
210+
runs-on: ubuntu-22.04
211+
container:
212+
image: ardupilot/ardupilot-dev-base:v0.1.3
213+
options: --privileged --cap-add=SYS_PTRACE --security-opt apparmor=unconfined --security-opt seccomp=unconfined
214+
strategy:
215+
fail-fast: false # don't cancel if a job from the matrix fails
216+
matrix:
217+
config: [
218+
sitltest-copter-tests1a,
219+
sitltest-copter-tests1b,
220+
sitltest-copter-tests1c,
221+
sitltest-copter-tests1d,
222+
sitltest-copter-tests1e,
223+
sitltest-copter-tests2a,
224+
sitltest-copter-tests2b,
225+
]
226+
227+
steps:
228+
# git checkout the PR
229+
- uses: actions/checkout@v4
230+
with:
231+
submodules: 'recursive'
232+
233+
- name: Register gcc problem matcher
234+
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
235+
236+
- name: Register python problem matcher
237+
run: echo "::add-matcher::.github/problem-matchers/python.json"
238+
239+
- name: Register autotest warn matcher
240+
run: echo "::add-matcher::.github/problem-matchers/autotestwarn.json"
241+
242+
- name: Register autotest fail matcher
243+
run: echo "::add-matcher::.github/problem-matchers/autotestfail.json"
244+
245+
# Put ccache into github cache for faster build
246+
- name: Prepare ccache timestamp
247+
id: ccache_cache_timestamp
248+
run: |
249+
NOW=$(date -u +"%F-%T")
250+
echo "timestamp=${NOW}" >> $GITHUB_OUTPUT
251+
- name: ccache cache files
252+
uses: actions/cache/restore@v4
253+
with:
254+
path: ~/.ccache
255+
key: ${{github.workflow}}-ccache-base-${{steps.ccache_cache_timestamp.outputs.timestamp}}
256+
restore-keys: ${{github.workflow}}-ccache-base- # restore ccache from either previous build on this branch or on master
257+
- name: setup ccache
258+
run: |
259+
. .github/workflows/ccache.env
260+
- name: test ${{matrix.config}}
261+
env:
262+
CI_BUILD_TARGET: ${{matrix.config}}
263+
shell: bash
264+
run: |
265+
git config --global --add safe.directory ${GITHUB_WORKSPACE}
266+
PATH="/github/home/.local/bin:$PATH"
267+
Tools/scripts/build_ci.sh
268+
269+
- name: Archive buildlog artifacts
270+
uses: actions/upload-artifact@v4
271+
if: failure()
272+
with:
273+
name: fail-${{matrix.config}}
274+
path: |
275+
/tmp/buildlogs
276+
/__w/ardupilot/ardupilot/logs
277+
/__w/ardupilot/ardupilot/ap-*.core
278+
/__w/ardupilot/ardupilot/core.*
279+
/__w/ardupilot/ardupilot/dumpstack.sh_*
280+
/__w/ardupilot/ardupilot/dumpcore.sh_*
281+
retention-days: 14
282+
283+
- name: Archive .bin artifacts
284+
uses: actions/upload-artifact@v4
285+
with:
286+
name: BIN-${{matrix.config}}
287+
path: /__w/ardupilot/ardupilot/logs
288+
retention-days: 7
289+
290+
build-gcc-heli:
291+
runs-on: ubuntu-22.04
292+
container:
293+
image: ardupilot/ardupilot-dev-base:v0.1.3
294+
options: --privileged --cap-add=SYS_PTRACE --security-opt apparmor=unconfined --security-opt seccomp=unconfined
295+
steps:
296+
# git checkout the PR
297+
- uses: actions/checkout@v4
298+
with:
299+
submodules: 'recursive'
300+
# Put ccache into github cache for faster build
301+
- name: Prepare ccache timestamp
302+
id: ccache_cache_timestamp
303+
run: |
304+
NOW=$(date -u +"%F-%T")
305+
echo "timestamp=${NOW}" >> $GITHUB_OUTPUT
306+
- name: ccache cache files
307+
uses: actions/cache@v4
308+
with:
309+
path: ~/.ccache
310+
key: ${{github.workflow}}-ccache-base-${{steps.ccache_cache_timestamp.outputs.timestamp}}
311+
restore-keys: ${{github.workflow}}-ccache-base- # restore ccache from either previous build on this branch or on master
312+
- name: setup ccache
313+
run: |
314+
. .github/workflows/ccache.env
315+
- name: build heli
316+
shell: bash
317+
run: |
318+
git config --global --add safe.directory ${GITHUB_WORKSPACE}
319+
PATH="/github/home/.local/bin:$PATH"
320+
./waf configure --board sitl --enable-simulink-app
321+
./waf build --target bin/arducopter-heli
322+
ccache -s
323+
ccache -z
324+
325+
autotest-heli:
326+
needs: build-gcc-heli # don't try to launch the tests matrix if it doesn't build first, profit from caching for fast build
327+
runs-on: ubuntu-22.04
328+
container: ardupilot/ardupilot-dev-base:v0.1.3
329+
strategy:
330+
fail-fast: false # don't cancel if a job from the matrix fails
331+
matrix:
332+
config: [
333+
sitltest-heli,
334+
]
335+
336+
steps:
337+
# git checkout the PR
338+
- uses: actions/checkout@v4
339+
with:
340+
submodules: 'recursive'
341+
# Put ccache into github cache for faster build
342+
- name: Prepare ccache timestamp
343+
id: ccache_cache_timestamp
344+
run: |
345+
NOW=$(date -u +"%F-%T")
346+
echo "timestamp=${NOW}" >> $GITHUB_OUTPUT
347+
- name: ccache cache files
348+
uses: actions/cache/restore@v4
349+
with:
350+
path: ~/.ccache
351+
key: ${{github.workflow}}-ccache-base-${{steps.ccache_cache_timestamp.outputs.timestamp}}
352+
restore-keys: ${{github.workflow}}-ccache-base- # restore ccache from either previous build on this branch or on master
353+
- name: setup ccache
354+
run: |
355+
. .github/workflows/ccache.env
356+
- name: test ${{matrix.config}}
357+
env:
358+
CI_BUILD_TARGET: ${{matrix.config}}
359+
shell: bash
360+
run: |
361+
git config --global --add safe.directory ${GITHUB_WORKSPACE}
362+
PATH="/github/home/.local/bin:$PATH"
363+
Tools/scripts/build_ci.sh
364+
365+
- name: Archive buildlog artifacts
366+
uses: actions/upload-artifact@v4
367+
if: failure()
368+
with:
369+
name: fail-${{matrix.config}}
370+
path: |
371+
/tmp/buildlogs
372+
/__w/ardupilot/ardupilot/logs
373+
/__w/ardupilot/ardupilot/ap-*.core
374+
/__w/ardupilot/ardupilot/core.*
375+
/__w/ardupilot/ardupilot/dumpstack.sh_*
376+
/__w/ardupilot/ardupilot/dumpcore.sh_*
377+
retention-days: 14
378+
379+
- name: Archive .bin artifacts
380+
uses: actions/upload-artifact@v4
381+
with:
382+
name: BIN-${{matrix.config}}
383+
path: /__w/ardupilot/ardupilot/logs
384+
retention-days: 7

0 commit comments

Comments
 (0)