Skip to content

Commit 8bf53af

Browse files
davidbuzzclaude
andcommitted
.github: build and exercise SITL clustering in CI
Build arduplane alongside arducopter, run the multi-instance lock-step test, and fly the cluster follow test (two copters following a plane). The follow job requests 50x speedup but does not assert on achieving it: a 2-core runner gets nowhere near, which is why the test times its phases in simulated seconds and reports the rate it actually achieves. ArduPlane is dropped from paths-ignore since the workflow now exercises plane code. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 43da132 commit 8bf53af

1 file changed

Lines changed: 173 additions & 0 deletions

File tree

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
name: test SITL cluster clock sync
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
# remove other vehicles
7+
- 'AntennaTracker/**'
8+
- 'ArduSub/**'
9+
- 'Blimp/**'
10+
- 'Rover/**'
11+
# remove non SITL HAL
12+
- 'libraries/AP_HAL_ChibiOS/**'
13+
- 'libraries/AP_HAL_ESP32/**'
14+
- 'libraries/AP_HAL_QURT/**'
15+
# Remove markdown files as irrelevant
16+
- '**.md'
17+
18+
pull_request:
19+
paths-ignore:
20+
# remove other vehicles
21+
- 'AntennaTracker/**'
22+
- 'ArduSub/**'
23+
- 'Blimp/**'
24+
- 'Rover/**'
25+
# remove non SITL HAL
26+
- 'libraries/AP_HAL_ChibiOS/**'
27+
- 'libraries/AP_HAL_ESP32/**'
28+
- 'libraries/AP_HAL_QURT/**'
29+
# Remove markdown files as irrelevant
30+
- '**.md'
31+
32+
concurrency:
33+
group: ci-${{github.workflow}}-${{github.ref}}
34+
cancel-in-progress: true
35+
36+
jobs:
37+
build:
38+
runs-on: ubuntu-22.04
39+
permissions:
40+
contents: read
41+
container:
42+
image: ardupilot/ardupilot-dev-base:v0.1.3
43+
options: --privileged --cap-add=SYS_PTRACE --security-opt apparmor=unconfined --security-opt seccomp=unconfined
44+
45+
steps:
46+
- uses: actions/checkout@v6
47+
with:
48+
submodules: 'recursive'
49+
50+
- name: get timestamp for ccache
51+
id: ccache_cache_timestamp
52+
run: |
53+
NOW=$(date -u +"%F-%T")
54+
echo "timestamp=${NOW}" >> $GITHUB_OUTPUT
55+
56+
- name: ccache cache files
57+
uses: actions/cache@v5
58+
with:
59+
path: ~/.ccache
60+
key: ${{github.workflow}}-ccache-base-${{steps.ccache_cache_timestamp.outputs.timestamp}}
61+
restore-keys: ${{github.workflow}}-ccache-base-
62+
63+
- name: setup ccache
64+
run: |
65+
. .github/workflows/ccache.env
66+
67+
- name: build arducopter and arduplane
68+
shell: bash
69+
run: |
70+
git config --global --add safe.directory ${GITHUB_WORKSPACE}
71+
PATH="/github/home/.local/bin:$PATH"
72+
pip install empy==3.3.4
73+
./waf configure --board sitl
74+
./waf copter plane
75+
ccache -s
76+
77+
- name: upload SITL binaries
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: sitl-cluster-binaries
81+
path: |
82+
build/sitl/bin/arducopter
83+
build/sitl/bin/arduplane
84+
retention-days: 1
85+
86+
test-multi-instance-sync:
87+
needs: build
88+
runs-on: ubuntu-22.04
89+
permissions:
90+
contents: read
91+
container:
92+
image: ardupilot/ardupilot-dev-base:v0.1.3
93+
options: --privileged --cap-add=SYS_PTRACE --security-opt apparmor=unconfined --security-opt seccomp=unconfined
94+
95+
steps:
96+
- uses: actions/checkout@v6
97+
with:
98+
submodules: 'recursive'
99+
100+
- name: download SITL binaries
101+
uses: actions/download-artifact@v4.1.3
102+
with:
103+
name: sitl-cluster-binaries
104+
path: build/sitl/bin/
105+
106+
- name: make binaries executable
107+
run: chmod +x build/sitl/bin/arducopter build/sitl/bin/arduplane
108+
109+
- name: run 5x SITL instances at speedup=100 and verify clock sync
110+
shell: bash
111+
timeout-minutes: 5
112+
run: |
113+
git config --global --add safe.directory ${GITHUB_WORKSPACE}
114+
PATH="/github/home/.local/bin:$PATH"
115+
Tools/scripts/test_sitl_multi_instance.sh build/sitl/bin/arducopter
116+
117+
- name: archive logs on failure
118+
if: failure()
119+
uses: actions/upload-artifact@v4
120+
with:
121+
name: multi-instance-logs
122+
path: /tmp/sitl_multi_*
123+
retention-days: 7
124+
125+
test-cluster-follow:
126+
needs: build
127+
runs-on: ubuntu-22.04
128+
permissions:
129+
contents: read
130+
container:
131+
image: ardupilot/ardupilot-dev-base:v0.1.3
132+
options: --privileged --cap-add=SYS_PTRACE --security-opt apparmor=unconfined --security-opt seccomp=unconfined
133+
134+
steps:
135+
- uses: actions/checkout@v6
136+
with:
137+
submodules: 'recursive'
138+
139+
- name: download SITL binaries
140+
uses: actions/download-artifact@v4.1.3
141+
with:
142+
name: sitl-cluster-binaries
143+
path: build/sitl/bin/
144+
145+
- name: make binaries executable
146+
run: chmod +x build/sitl/bin/arducopter build/sitl/bin/arduplane
147+
148+
- name: fly 2 copters following a plane in one cluster
149+
shell: bash
150+
timeout-minutes: 30
151+
run: |
152+
git config --global --add safe.directory ${GITHUB_WORKSPACE}
153+
PATH="/github/home/.local/bin:$PATH"
154+
pip install pymavlink
155+
# A 2-core runner gets nowhere near 50x - locally, three vehicles
156+
# in lock-step manage about 3x - which is exactly why every phase
157+
# is timed in simulated seconds rather than wall seconds, and why
158+
# the achieved rate is reported rather than asserted on. The wall
159+
# limit is only a backstop for a wedged run, so it is raised well
160+
# above the local figure to leave room for a slow runner.
161+
python3 Tools/autotest/test_cluster_follow.py \
162+
--speedup 50 \
163+
--follow-time 250 \
164+
--min-hold-time 90 \
165+
--wall-limit 1500
166+
167+
- name: archive logs on failure
168+
if: failure()
169+
uses: actions/upload-artifact@v4
170+
with:
171+
name: cluster-follow-logs
172+
path: /tmp/sitl_cluster_follow_*
173+
retention-days: 7

0 commit comments

Comments
 (0)