-
-
Notifications
You must be signed in to change notification settings - Fork 510
670 lines (654 loc) · 28.8 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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
name: Build and Test
on:
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:
branches:
- '*'
jobs:
coverage:
name: Coverage (ubuntu-22.04)
runs-on: ubuntu-22.04
env:
NODE_OPTIONS: --max_old_space_size=4096
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/cache@v4
id: cache
with:
path: ./build/third_party/install
key: ${{ github.job }}-${{ hashFiles('./third_party/**') }}
- name: disable superbuild on cache hit
if: steps.cache.outputs.cache-hit == 'true'
run: echo "superbuild=-DSUPERBUILD=OFF" >> $GITHUB_ENV && echo "cmake_prefix_path=-DCMAKE_PREFIX_PATH=$(pwd)/build/third_party/install" >> $GITHUB_ENV
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y lcov python3-future
- name: configure
run: cmake $superbuild $cmake_prefix_path -DCMAKE_BUILD_TYPE=Coverage -DASAN=ON -DWERROR=ON -DENABLE_CPPTRACE=On -Bbuild -H.
- name: build
run: cmake --build build -j2
- name: unit tests
run: ./build/src/unit_tests/unit_tests_runner
- name: system tests
run: ./build/src/system_tests/system_tests_runner
- name: run lcov
run: lcov --capture --directory . --no-external --exclude "*/third_party/*" --output-file lcov.info
- name: check size of lcov.info
run: |
ls -l lcov.info
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: "./lcov.info"
ubuntu-non-superbuild:
name: ${{ matrix.ubuntu_image }} (non-mavsdk_server, non-superbuild)
runs-on: ${{ matrix.ubuntu_image }}
strategy:
matrix:
include:
- ubuntu_image: ubuntu-20.04
- ubuntu_image: ubuntu-22.04
- ubuntu_image: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: install
run: sudo apt-get update && sudo apt-get install -y libjsoncpp-dev libcurl4-openssl-dev libtinyxml2-dev libgtest-dev libgmock-dev liblzma-dev
- name: install mavlink on the system
run: |
cmake -Bthird_party/mavlink/build -Sthird_party/mavlink
sudo cmake --build third_party/mavlink/build
- name: configure
run: cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSUPERBUILD=OFF -DWERROR=ON -DENABLE_CPPTRACE=On -Bbuild/release -H.
- name: build
run: cmake --build build/release -j2
- name: unit tests
run: ./build/release/src/unit_tests/unit_tests_runner
- name: system tests
run: ./build/release/src/system_tests/system_tests_runner
ubuntu-superbuild:
name: ${{ matrix.ubuntu_image }} (mavsdk_server, superbuild)
runs-on: ${{ matrix.ubuntu_image }}
strategy:
fail-fast: false
matrix:
include:
- ubuntu_image: ubuntu-20.04
cc: gcc
cxx: g++
description: Ubuntu 20.04 (GCC)
- ubuntu_image: ubuntu-22.04
cc: gcc
cxx: g++
description: Ubuntu 22.04 (GCC)
- ubuntu_image: ubuntu-24.04
cc: gcc-13
cxx: g++-13
description: Ubuntu 24.04 (GCC 13)
- ubuntu_image: ubuntu-24.04
cc: gcc-14
cxx: g++-14
description: Ubuntu 24.04 (GCC 14)
- ubuntu_image: ubuntu-24.04
cc: clang-18
cxx: clang++-18
description: Ubuntu 24.04 (clang 18)
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/cache@v4
id: cache
with:
path: ./build/release/third_party/install
key: ${{ github.job }}-${{ matrix.ubuntu_image }}-${{ matrix.cc }}-${{ hashFiles('./third_party/**') }}-1
- name: disable superbuild on cache hit
if: steps.cache.outputs.cache-hit == 'true'
run: echo "superbuild=-DSUPERBUILD=OFF" >> $GITHUB_ENV && echo "cmake_prefix_path=-DCMAKE_PREFIX_PATH=$(pwd)/build/release/third_party/install" >> $GITHUB_ENV
- name: configure
run: |
echo "CC=${{ matrix.cc }}" >> $GITHUB_ENV
echo "CXX=${{ matrix.cxx }}" >> $GITHUB_ENV
cmake $superbuild $cmake_prefix_path -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_MAVSDK_SERVER=ON -DWERROR=ON -DENABLE_CPPTRACE=On -DCMAKE_INSTALL_PREFIX=install -Bbuild/release -H.
- name: cleanup to save space
run: |
rm -rf ./build/release/third_party/absl
rm -rf ./build/release/third_party/cares
rm -rf ./build/release/third_party/cpptrace
rm -rf ./build/release/third_party/curl
rm -rf ./build/release/third_party/grpc
rm -rf ./build/release/third_party/gtest
rm -rf ./build/release/third_party/jsoncpp
rm -rf ./build/release/third_party/libevents
rm -rf ./build/release/third_party/liblzma
rm -rf ./build/release/third_party/mavlink
rm -rf ./build/release/third_party/openssl
rm -rf ./build/release/third_party/protobuf
rm -rf ./build/release/third_party/re2
rm -rf ./build/release/third_party/tinyxml2
rm -rf ./build/release/third_party/zlib
rm -rf ./build/release/third_party/zlib-ng
- name: build
run: cmake --build build/release -j2
- name: install
run: cmake --build build/release --target install
- name: temporary workaround for Ubuntu 22.04
if: ${{ matrix.ubuntu_image }} == "ubuntu-22.04"
run: |
echo 'APT::Get::Always-Include-Phased-Updates "true";' | sudo tee -a /etc/apt/apt.conf.d/99-phased-updates
sudo apt-get update
- name: install examples dependencies
run: sudo apt-get install libsdl2-dev ${{ matrix.cc }} ${{ matrix.cxx }}
- name: configure examples
run: cmake -DCMAKE_PREFIX_PATH="$(pwd)/install;$(pwd)/build/release/third_party/install" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWERROR=ON -Bexamples/build -Hexamples
- name: build examples
run: cmake --build examples/build -j2
- name: unit tests
run: ./build/release/src/unit_tests/unit_tests_runner
# - name: system tests
# run: ./build/release/src/system_tests/system_tests_runner
- name: test (mavsdk_server)
run: ./build/release/src/mavsdk_server/test/unit_tests_mavsdk_server
ubuntu-hunter:
name: ${{ matrix.ubuntu_image }} (non-mavsdk_server, hunter)
runs-on: ${{ matrix.ubuntu_image }}
strategy:
matrix:
include:
- ubuntu_image: ubuntu-20.04
- ubuntu_image: ubuntu-22.04
- ubuntu_image: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/cache@v4
id: cache
with:
path: ~/.hunter
key: ${{ github.job }}-${{ matrix.ubuntu_image }}-${{ hashFiles('~/.hunter/**') }}-2
- name: install mavlink on the system
run: |
cmake -Bthird_party/mavlink/build -Sthird_party/mavlink
sudo cmake --build third_party/mavlink/build
- name: configure
run: cmake -DSUPERBUILD=OFF -DHUNTER_ENABLED=ON -DCMAKE_TOOLCHAIN_FILE=$(pwd)/src/cmake/fpic_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_MAVSDK_SERVER=OFF -DBUILD_SHARED_LIBS=OFF -DENABLE_CPPTRACE=On -Bbuild -H.
- name: build
run: cmake --build build -j2
- name: unit tests
run: ./build/src/unit_tests/unit_tests_runner
#- name: system tests
# run: ./build/src/system_tests/system_tests_runner
ubuntu24-style-and-proto-check:
name: ubuntu-24.04 (style and proto check)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: install dependencies
run: sudo apt-get update && sudo apt-get install -y clang-format-18
- uses: actions/cache@v4
id: cache
with:
path: ./build/default/third_party/install
key: ${{ github.job }}-${{ hashFiles('./third_party/**') }}
- name: disable superbuild on cache hit
if: steps.cache.outputs.cache-hit == 'true'
run: echo "superbuild=-DSUPERBUILD=OFF" >> $GITHUB_ENV && echo "cmake_prefix_path=-DCMAKE_PREFIX_PATH=$(pwd)/build/default/third_party/install" >> $GITHUB_ENV
- name: build necessary protoc tooling
run: cmake $superbuild $cmake_prefix_path -DCMAKE_BUILD_TYPE=Debug -DBUILD_MAVSDK_SERVER=ON -DENABLE_CPPTRACE=On -Bbuild/default -H.
- name: generate code from protos
run: PATH="$PATH:$HOME/.local/bin" tools/generate_from_protos.sh
- name: fix style
run: tools/fix_style.sh . || true
- name: check for diff
run: git diff --exit-code
deb-package:
name: ${{ matrix.container_name }} (package, non-mavsdk_server)
runs-on: ${{ matrix.container_name }}
strategy:
fail-fast: false
matrix:
container_name: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: git permission workaround
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git config --global --add safe.directory /github/workspace
- name: Install ruby, gem, and fpm
run: |
sudo apt-get update
sudo apt-get install -y ruby-dev
sudo gem install --no-document fpm
- name: configure
run: cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_MAVSDK_SERVER=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=install -DWERROR=ON -Bbuild/release -H.
- name: build
run: cmake --build build/release --target install -- -j2
- name: Package
if: startsWith(github.ref, 'refs/tags/v')
run: tools/create_packages.sh ./install . amd64 libmavsdk-dev
- name: Publish artefacts
if: startsWith(github.ref, 'refs/tags/v')
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file_glob: true
file: '*.deb'
tag: ${{ github.ref }}
overwrite: true
dockcross-linux-arm:
name: linux-${{ matrix.docker_name }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- docker_name: armv6
arch_name: armv6
- docker_name: armv7
arch_name: armv7
- docker_name: arm64
arch_name: arm64
- docker_name: arm64-lts
arch_name: arm64
rename_distro: true
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: setup dockcross
run: docker run --rm docker.io/mavsdk/mavsdk-dockcross-linux-${{ matrix.docker_name }}-custom > ./dockcross-linux-${{ matrix.docker_name }}-custom; chmod +x ./dockcross-linux-${{ matrix.docker_name }}-custom
- uses: actions/cache@v4
id: cache
with:
path: ./build/linux-${{ matrix.docker_name }}/third_party/install
key: ${{ github.job }}-linux-${{ matrix.docker_name }}-${{ hashFiles('./third_party/**') }}-6
- name: disable superbuild on cache hit
if: steps.cache.outputs.cache-hit == 'true'
run: echo "superbuild=-DSUPERBUILD=OFF" >> $GITHUB_ENV && echo "cmake_prefix_path=-DCMAKE_PREFIX_PATH=/work/build/linux-${{ matrix.docker_name }}/third_party/install" >> $GITHUB_ENV
- name: configure
run: ./dockcross-linux-${{ matrix.docker_name }}-custom /bin/bash -c "cmake $superbuild $cmake_prefix_path -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=build/linux-${{ matrix.docker_name }}/install -DBUILD_MAVSDK_SERVER=OFF -DBUILD_SHARED_LIBS=ON -DWERROR=ON -Bbuild/linux-${{ matrix.docker_name }} -H."
- name: build
run: ./dockcross-linux-${{ matrix.docker_name }}-custom cmake --build build/linux-${{ matrix.docker_name }} -j2 --target install
- name: create deb packages
run: ./dockcross-linux-${{ matrix.docker_name }}-custom tools/create_packages.sh ./build/linux-${{ matrix.docker_name }}/install . ${{ matrix.arch_name }} libmavsdk-dev
- if: ${{ matrix.rename_distro }}
name: Rename LTS versions from debian12 to debian11
run: |
sudo apt update && sudo apt install -y rename
rename 's/debian12_arm64/debian11_arm64/' *.deb
- name: Publish artefacts
if: startsWith(github.ref, 'refs/tags/v')
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file_glob: true
file: '*.deb'
tag: ${{ github.ref }}
overwrite: true
alpine-linux:
name: alpine 3.19.0 (musl)
runs-on: ubuntu-20.04
container: alpine:3.19.0
steps:
- name: install tools
run: apk update && apk add build-base cmake git linux-headers perl tar python3 py3-pip rust cargo
- uses: actions/checkout@v4
with:
submodules: recursive
- name: git permission workaround
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git config --global --add safe.directory /github/workspace
- uses: actions/cache@v4
id: cache
with:
path: ./build/release/third_party/install
key: ${{ github.job }}-${{ hashFiles('./third_party/**') }}-1
- name: disable superbuild on cache hit
if: steps.cache.outputs.cache-hit == 'true'
run: echo "superbuild=-DSUPERBUILD=OFF" >> $GITHUB_ENV && echo "cmake_prefix_path=-DCMAKE_PREFIX_PATH=$(pwd)/build/release/third_party/install" >> $GITHUB_ENV
- name: configure
run: cmake $superbuild $cmake_prefix_path -DCMAKE_BUILD_TYPE=Release -DBUILD_MAVSDK_SERVER=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_MAVSDK_SERVER=ON -DCMAKE_INSTALL_PREFIX=install -DWERROR=ON -DENABLE_CPPTRACE=On -Bbuild/release -H.
- name: build
run: cmake --build build/release --target install -- -j2
- name: unit tests
run: ./build/release/src/unit_tests/unit_tests_runner
- name: system tests
run: ./build/release/src/system_tests/system_tests_runner
- name: test (mavsdk_server)
run: ./build/release/src/mavsdk_server/test/unit_tests_mavsdk_server
- name: Upload as artefact
uses: actions/upload-artifact@v4
with:
name: mavsdk_server_musl_x86_64
path: ./install/bin/mavsdk_server
retention-days: 2
- name: Publish artefacts
if: startsWith(github.ref, 'refs/tags/v')
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: 'install/bin/mavsdk_server'
asset_name: 'mavsdk_server_musl_x86_64'
tag: ${{ github.ref }}
overwrite: true
dockcross-linux-musl:
name: ${{ matrix.arch_name }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
arch_name: [linux-armv6-musl, linux-armv7l-musl, linux-arm64-musl]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: setup dockcross
run: docker run --rm dockcross/${{ matrix.arch_name }} > ./dockcross-${{ matrix.arch_name }}; chmod +x ./dockcross-${{ matrix.arch_name }}
- uses: actions/cache@v4
id: cache
with:
path: ./build/${{ matrix.arch_name }}/third_party/install
key: ${{ github.job }}-${{ matrix.arch_name }}-${{ hashFiles('./third_party/**') }}
- name: disable superbuild on cache hit
if: steps.cache.outputs.cache-hit == 'true'
run: echo "superbuild=-DSUPERBUILD=OFF" >> $GITHUB_ENV && echo "cmake_prefix_path=-DCMAKE_PREFIX_PATH=/work/build/${{ matrix.arch_name }}/third_party/install" >> $GITHUB_ENV
- name: configure
run: ./dockcross-${{ matrix.arch_name }} /bin/bash -c "cmake $superbuild $cmake_prefix_path -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=build/${{ matrix.arch_name }}/install -DBUILD_MAVSDK_SERVER=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_MAVSDK_SERVER=ON -DWERROR=ON -Bbuild/${{ matrix.arch_name }} -H."
- name: build
run: ./dockcross-${{ matrix.arch_name }} cmake --build build/${{ matrix.arch_name }} -j2 --target install
- name: Publish artefacts
if: startsWith(github.ref, 'refs/tags/v')
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: 'build/${{ matrix.arch_name }}/install/bin/mavsdk_server'
asset_name: 'mavsdk_server_${{ matrix.arch_name }}'
tag: ${{ github.ref }}
overwrite: true
dockcross-android:
name: ${{ matrix.name }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- name: android-arm
arch: armeabi-v7a
- name: android-arm64
arch: arm64-v8a
- name: android-x86
arch: x86
- name: android-x86_64
arch: x86_64
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: setup dockcross
run: docker run --rm dockcross/${{ matrix.name }} > ./dockcross-${{ matrix.name }}; chmod +x ./dockcross-${{ matrix.name }}
- uses: actions/cache@v4
id: cache
with:
path: ./build/${{ matrix.name }}/third_party/install
key: ${{ github.job }}-${{ matrix.name }}-${{ hashFiles('./third_party/**') }}
- name: disable superbuild on cache hit
if: steps.cache.outputs.cache-hit == 'true'
run: echo "superbuild=-DSUPERBUILD=OFF" >> $GITHUB_ENV && echo "cmake_prefix_path=-DCMAKE_PREFIX_PATH=/work/build/${{ matrix.name }}/third_party/install" >> $GITHUB_ENV
- name: configure
run: ./dockcross-${{ matrix.name }} /bin/bash -c "cmake $superbuild $cmake_prefix_path -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=build/${{ matrix.name }}/install -DBUILD_MAVSDK_SERVER=ON -DBUILD_SHARED_LIBS=OFF -DWERROR=ON -Bbuild/${{ matrix.name }} -H."
- name: build
run: ./dockcross-${{ matrix.name }} cmake --build build/${{ matrix.name }} -j2 --target install
- name: create tar with header and library
run: mkdir -p build/${{ matrix.name }}/export/include; cp build/${{ matrix.name }}/install/include/mavsdk/mavsdk_server/mavsdk_server_api.h build/${{ matrix.name }}/export/include; mkdir -p build/${{ matrix.name }}/export/${{ matrix.arch }}; cp build/${{ matrix.name }}/install/lib/libmavsdk_server.so build/${{ matrix.name }}/export/${{ matrix.arch }}; tar -C build/${{ matrix.name }}/export -cf build/${{ matrix.name }}/export/mavsdk_server_${{ matrix.name }}.tar ${{ matrix.arch }} include;
- name: Publish artefacts
if: startsWith(github.ref, 'refs/tags/v')
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: 'build/${{ matrix.name }}/export/mavsdk_server_${{ matrix.name }}.tar'
asset_name: 'mavsdk_server_${{ matrix.name }}.tar'
tag: ${{ github.ref }}
overwrite: true
macOS:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- name: macOS x64
build-framework: OFF
runner: macos-13
architecture: 'x64'
- name: macOS arm64
build-framework: OFF
runner: macos-14
architecture: 'arm64'
- name: macOS framework x64
build-framework: ON
runner: macos-13
architecture: 'x64'
- name: macOS framework arm64
build-framework: ON
runner: macos-14
architecture: 'arm64'
steps:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- uses: actions/cache@v4
id: cache
with:
path: ./build/macos/third_party/install
key: ${{ github.job }}-${{ matrix.name }}-${{ hashFiles('./third_party/**') }}-1
- name: disable superbuild on cache hit
if: steps.cache.outputs.cache-hit == 'true'
run: echo "superbuild=-DSUPERBUILD=OFF" >> $GITHUB_ENV && echo "cmake_prefix_path=-DCMAKE_PREFIX_PATH=$(pwd)/build/macos/third_party/install" >> $GITHUB_ENV
- name: set SDKROOT value
run: echo "SDKROOT=$(xcrun --sdk macosx --show-sdk-path)" >> $GITHUB_ENV
- name: configure
run: cmake $superbuild $cmake_prefix_path -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=build/macos/install -DBUILD_MAVSDK_SERVER=ON -DBUILD_SHARED_LIBS=OFF -DMACOS_FRAMEWORK=${{ matrix.build-framework }} -DWERROR=ON -DENABLE_CPPTRACE=On -Bbuild/macos -H.
- name: build
run: cmake --build build/macos -j2 --target install
- name: unit tests
run: ./build/macos/src/unit_tests/unit_tests_runner
- name: system tests
run: ./build/macos/src/system_tests/system_tests_runner
- name: test (mavsdk_server)
run: ./build/macos/src/mavsdk_server/test/unit_tests_mavsdk_server
- name: Upload framework as artefact
if: ${{ matrix.build-framework == 'ON' }}
uses: actions/upload-artifact@v4
with:
name: mavsdk_server_macos_${{ matrix.architecture }}.framework
path: ./build/macos/src/mavsdk_server/src/mavsdk_server.framework
retention-days: 2
- name: Upload binary as artefact
if: ${{ matrix.build-framework == 'OFF' }}
uses: actions/upload-artifact@v4
with:
name: mavsdk_server_macos_${{ matrix.architecture }}
path: build/macos/install/bin/mavsdk_server
retention-days: 2
- name: Publish mavsdk_server_macos to github release
if: ${{ startsWith(github.ref, 'refs/tags/v') && matrix.build-framework == 'OFF' }}
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/macos/install/bin/mavsdk_server
asset_name: mavsdk_server_macos_${{ matrix.architecture }}
tag: ${{ github.ref }}
overwrite: true
iOS:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- name: ios
platform: OS64
sdk: iphoneos
runner: macos-14
- name: ios_simulator_x64
platform: SIMULATOR64
sdk: iphonesimulator
runner: macos-13
- name: ios_simulator_arm64
platform: SIMULATORARM64
sdk: iphonesimulator
runner: macos-14
steps:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
architecture: 'x64'
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- uses: actions/cache@v4
id: cache
with:
path: ./build/${{ matrix.name }}/third_party/install
key: ${{ github.job }}-${{ matrix.name }}-${{ hashFiles('./third_party/**', './tools/ios.toolchain.cmake') }}-1
- name: disable superbuild on cache hit
if: steps.cache.outputs.cache-hit == 'true'
run: echo "superbuild=-DSUPERBUILD=OFF" >> $GITHUB_ENV && echo "cmake_prefix_path=-DCMAKE_PREFIX_PATH=$(pwd)/build/${{ matrix.name }}/third_party/install" >> $GITHUB_ENV
- name: set SDK-related environment variables (for non-cmake deps)
run: |
echo "SDKROOT=$(xcrun --sdk ${{ matrix.sdk }} --show-sdk-path)" >> $GITHUB_ENV
- name: install pymavlink dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install wheel
python3 -m pip install future
- name: configure
run: cmake $superbuild $cmake_prefix_path -DENABLE_STRICT_TRY_COMPILE=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=$(pwd)/tools/ios.toolchain.cmake -DENABLE_BITCODE=Off -DPLATFORM=${{ matrix.platform }} -DDEPLOYMENT_TARGET=14.0 -DBUILD_MAVSDK_SERVER=ON -DBUILD_SHARED_LIBS=OFF -DWERROR=ON -Bbuild/${{ matrix.name }} -H.
- name: build
run: cmake --build build/${{ matrix.name }} -j$(nproc)
- uses: actions/upload-artifact@v4
with:
name: mavsdk_server_${{ matrix.name }}.framework
path: ./build/${{ matrix.name }}/src/mavsdk_server/src/mavsdk_server.framework
retention-days: 2
iOS-XCFramework:
name: iOS XCFramework
needs: [macOS, iOS]
runs-on: macos-13
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/download-artifact@v4
with:
name: mavsdk_server_ios.framework
path: ./build/ios/src/mavsdk_server/src/mavsdk_server.framework
- uses: actions/download-artifact@v4
with:
name: mavsdk_server_ios_simulator_x64.framework
path: ./build/ios_simulator_x64/src/mavsdk_server/src/mavsdk_server.framework
- uses: actions/download-artifact@v4
with:
name: mavsdk_server_ios_simulator_arm64.framework
path: ./build/ios_simulator_arm64/src/mavsdk_server/src/mavsdk_server.framework
- uses: actions/download-artifact@v4
with:
name: mavsdk_server_macos_x64.framework
path: ./build/macos_x64/src/mavsdk_server/src/mavsdk_server.framework
- uses: actions/download-artifact@v4
with:
name: mavsdk_server_macos_arm64.framework
path: ./build/macos_arm64/src/mavsdk_server/src/mavsdk_server.framework
- name: Install tree
run: brew install tree
- name: Package
run: bash ./src/mavsdk_server/tools/package_mavsdk_server_framework.bash
- uses: actions/upload-artifact@v4
with:
name: mavsdk_server.xcframework
path: ./build/mavsdk_server.xcframework
retention-days: 2
- name: Publish xcframework
if: startsWith(github.ref, 'refs/tags/v')
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: 'build/mavsdk_server.xcframework.zip'
asset_name: 'mavsdk_server.xcframework.zip'
tag: ${{ github.ref }}
overwrite: true
- name: Publish xcframework checksum
if: startsWith(github.ref, 'refs/tags/v')
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: 'build/mavsdk_server.xcframework.zip.sha256'
asset_name: 'mavsdk_server.xcframework.zip.sha256'
tag: ${{ github.ref }}
overwrite: true
Windows:
name: Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/cache@v4
id: cache
with:
path: ./build/release/third_party/install
key: ${{ github.job }}-${{ hashFiles('./third_party/**') }}-4
- name: disable superbuild on cache hit
if: steps.cache.outputs.cache-hit == 'true'
run: |
echo "superbuild=-DSUPERBUILD=OFF" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "cmake_prefix_path=-DCMAKE_PREFIX_PATH=$(pwd)/build/release/third_party/install" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: install packages
run: |
choco install nasm
echo "C:\Program Files\NASM" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: configure
run: cmake -G "Visual Studio 17 2022" $env:superbuild $env:cmake_prefix_path -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=build/release/install -DBUILD_MAVSDK_SERVER=ON -DBUILD_SHARED_LIBS=OFF -DWERROR=ON -Bbuild/release -S.
- name: build
run: cmake --build build/release -j2 --config RelWithDebInfo --target install
- name: Create zip file mavsdk libraries
if: startsWith(github.ref, 'refs/tags/v')
run: cd build/release/install && 7z.exe a -tzip ../../../mavsdk-windows-x64-release.zip . && cd ../../..
- name: Publish mavsdk libraries
if: startsWith(github.ref, 'refs/tags/v')
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: 'mavsdk-windows-x64-release.zip'
asset_name: 'mavsdk-windows-x64-release.zip'
tag: ${{ github.ref }}
overwrite: true
- name: Publish mavsdk_server binary
if: startsWith(github.ref, 'refs/tags/v')
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: 'build/release/install/bin/mavsdk_server_bin.exe'
asset_name: 'mavsdk_server_win32.exe'
tag: ${{ github.ref }}
overwrite: true