-
-
Notifications
You must be signed in to change notification settings - Fork 528
161 lines (156 loc) · 6.24 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
name: Build and Test
on:
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:
branches:
- '*'
jobs:
macOS:
name: ${{ matrix.name }}
runs-on: macos-12
strategy:
matrix:
include:
- name: macOS
build-framework: OFF
- name: macOS-framework
build-framework: ON
steps:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
architecture: 'x64'
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- uses: actions/cache@v3
id: cache
with:
path: ./build/macos/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=$(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=OFF -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@v3
with:
name: mavsdk_server_macos.framework
path: ./build/macos/src/mavsdk_server/src/mavsdk_server.framework
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'
tag: ${{ github.ref }}
overwrite: true
iOS:
name: ${{ matrix.name }}
runs-on: macos-12
strategy:
matrix:
include:
- name: ios
platform: OS64COMBINED
sdk: iphoneos
steps:
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
architecture: 'x64'
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- uses: actions/cache@v3
id: cache
with:
path: ./build/${{ matrix.name }}/third_party/install
key: ${{ github.job }}-${{ matrix.name }}-${{ hashFiles('./third_party/**', './tools/ios.toolchain.cmake') }}
- 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 }} -G Xcode -DDEPLOYMENT_TARGET=14.0 -DBUILD_MAVSDK_SERVER=ON -DBUILD_SHARED_LIBS=OFF -DWERROR=OFF -Bbuild/${{ matrix.name }} -H.
- name: build
run: cmake --build build/${{ matrix.name }} -j2
- uses: actions/upload-artifact@v3
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-12
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/download-artifact@v3
with:
name: mavsdk_server_ios.framework
path: ./build/ios/src/mavsdk_server/src/mavsdk_server.framework
- uses: actions/download-artifact@v3
with:
name: mavsdk_server_ios_simulator.framework
path: ./build/ios_simulator/src/mavsdk_server/src/mavsdk_server.framework
- uses: actions/download-artifact@v3
with:
name: mavsdk_server_macos.framework
path: ./build/macos/src/mavsdk_server/src/mavsdk_server.framework
- name: Package
run: bash ./src/mavsdk_server/tools/package_mavsdk_server_framework.bash
- uses: actions/upload-artifact@v3
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