forked from XCSoar/XCSoar
-
Notifications
You must be signed in to change notification settings - Fork 1
367 lines (346 loc) · 15.2 KB
/
build-native.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
---
on:
workflow_dispatch:
push:
paths-ignore:
- 'cloud/**'
- 'doc/**'
- 'fuzzer/**'
- 'ide/**'
- 'kobo/**'
- 'python/**'
- '.github/workflows/build-container.yml'
- '.github/workflows/build-unix.yml'
- '.readthedocs.yaml'
branches:
- master
- dev-branch
tags:
- 'v*'
pull_request:
paths-ignore:
- 'cloud/**'
- 'doc/**'
- 'fuzzer/**'
- 'ide/**'
- 'kobo/**'
- 'python/**'
- '.github/workflows/build-container.yml'
- '.github/workflows/build-unix.yml'
- '.readthedocs.yaml'
branches:
- master
- dev-branch
env:
DEBUG: y
BOOST: boost_1_85_0
jobs:
release:
name: "Create Release"
runs-on: ubuntu-22.04
permissions:
contents: write
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.get_version.outputs.VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Parse changelog
if: startsWith(github.ref, 'refs/tags/v')
run: |
TAG=$(echo "${{ github.ref }}" | cut -f3 -d '/')
echo "TAG=$TAG" >> $GITHUB_ENV
echo "::set-output name=TAG::$TAG"
echo 'CHANGELOGENTRY<<EOF' >> $GITHUB_ENV
./tools/changelog.sh "$TAG" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
case "$TAG" in
*-rc*)
echo "PRERELEASE=true" >> $GITHUB_ENV
;;
*)
echo "PRERELEASE=false" >> $GITHUB_ENV
;;
esac
id: changelogentry
- name: get OpenSoar Version
id: get_version
run: |
VERSION=$(cat VERSION.txt)
echo "$VERSION"
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "::set-output name=VERSION::${VERSION}"
- name: Create release
id: create_release
if: startsWith(github.ref, 'refs/tags/v')
uses: ncipollo/release-action@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
allowUpdates: true
name: Version ${{ github.ref_name }}
body: ${{ env.CHANGELOGENTRY }}
prerelease: ${{ env.PRERELEASE }}
build:
runs-on: ${{ matrix.os }}
needs: release
container: ${{ matrix.target_container }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
target: UNIX
target_bin: opensoar_${{ needs.release.outputs.version }}_amd64
target_bin_path: ''
target_final: opensoar_
target_ext: .deb
target_upload: true
target_container: debian:bookworm-slim
- os: ubuntu-22.04
target: KOBO
target_bin: KoboRoot
target_bin_path: ''
target_final: KoboRoot
target_ext: .tgz
target_upload: true
target_container: debian:bookworm-slim
- os: ubuntu-22.04
target: ANDROID
target_bin: OpenSoar
target_bin_path: bin
target_final: OpenSoar
target_ext: .apk
target_upload: true
ndk: r26d
target_container: debian:bookworm-slim
- os: ubuntu-22.04
target: WIN64
target_bin: OpenSoar
target_bin_path: bin
target_final: OpenSoar
target_ext: .exe
target_upload: true
target_container: debian:bookworm-slim
- os: ubuntu-22.04
target: PC
target_bin: OpenSoar
target_bin_path: bin
target_final: OpenSoar
target_ext: .exe
target_upload: true
target_container: debian:bookworm-slim
- os: macos-12
target: OSX64
target_bin: OpenSoar
target_bin_path: bin
target_final: OpenSoar
target_ext: ''
target_upload: false
target_container: ''
- os: macos-14
target: MACOS
target_bin: XCSoar
target_bin_path: bin
target_final: XCSoar
target_ext: ''
target_upload: false
target_container: ''
- os: macos-14
target: IOS64
target_bin: XCSoar
target_bin_path: bin
target_final: XCSoar
target_ext: ''
target_upload: false
target_container: ''
steps:
- name: Install checkout dependencies
run: |
if [ "${{ matrix.os }}" = 'ubuntu-22.04' ]; then
apt-get update
apt-get install -y --no-install-recommends git \
ca-certificates rsync openssh-client
fi
- name: Set vars for release
if: startsWith(github.ref, 'refs/tags/v')
run: |
echo "DEBUG=n" >> $GITHUB_ENV
if [ ${{ matrix.target }} = "opensoar" ]; then
echo "TARGET_FINAL=opensoar" >> $GITHUB_ENV
fi
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Cache ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ matrix.target }}-ccache
- name: "Cache Boost"
uses: actions/cache@v4
with:
key: ${{ env.BOOST }}-${{ hashFiles('lib/boost/patches/**') }}
path: |
${{ github.workspace }}/output/download/${{ env.BOOST }}.tar.bz2
${{ github.workspace }}/output/src/stamp-${{ env.BOOST }}
${{ github.workspace }}/output/src/${{ env.BOOST }}/boost
- name: Install dependencies
run: |
if [ ${{ matrix.os }} = 'ubuntu-22.04' ]; then
./ide/provisioning/install-debian-packages.sh UPDATE
./ide/provisioning/install-debian-packages.sh BASE
if [ ${{ matrix.target }} = 'UNIX' ]; then
./ide/provisioning/install-debian-packages.sh LINUX
./ide/provisioning/install-debian-packages.sh LIBINPUT_GBM
./ide/provisioning/install-debian-packages.sh DEBIAN
fi
if [ ${{ matrix.target }} = 'KOBO' ]; then
./ide/provisioning/install-debian-packages.sh LINUX
./ide/provisioning/install-debian-packages.sh ARM
./ide/provisioning/install-debian-packages.sh KOBO
fi
if [ ${{ matrix.target }} = 'WIN64' ]; then
./ide/provisioning/install-debian-packages.sh LINUX
./ide/provisioning/install-debian-packages.sh WIN
fi
if [ ${{ matrix.target }} = 'PC' ]; then
./ide/provisioning/install-debian-packages.sh LINUX
./ide/provisioning/install-debian-packages.sh WIN
fi
if [ ${{ matrix.target }} = 'ANDROID' ]; then
./ide/provisioning/install-debian-packages.sh LINUX
./ide/provisioning/install-debian-packages.sh ARM
./ide/provisioning/install-debian-packages.sh LLVM
./ide/provisioning/install-debian-packages.sh ANDROID
./ide/provisioning/install-android-tools.sh NDK
./ide/provisioning/install-android-tools.sh SDK
fi
./ide/provisioning/install-debian-packages.sh CLEAN
elif [ ${{ matrix.os }} = 'macos-12' ] ; then
./ide/provisioning/install-darwin-packages.sh BASE
if [ ${{ matrix.target }} = 'OSX64' ]; then
./ide/provisioning/install-darwin-packages.sh OSX64
fi
elif [ ${{ matrix.os }} = 'macos-14' ] ; then
./ide/provisioning/install-darwin-packages.sh BASE
if [ ${{ matrix.target }} = 'MACOS' ]; then
./ide/provisioning/install-darwin-packages.sh MACOS
elif [ ${{ matrix.target }} = 'IOS64' ]; then
./ide/provisioning/install-darwin-packages.sh IOS
fi
fi
echo "git_hash=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_ENV
- name: Prepare signing key
shell: bash
if: ${{ matrix.target == 'ANDROID' && startsWith(github.ref, 'refs/tags/v') }}
run: |
if [ -n "${{ secrets.OPENSOAR_UPLOAD_KEY_JKS_BASE64 }}" ]; then
mkdir -p ~/.android/
echo "${{ secrets.OPENSOAR_UPLOAD_KEY_JKS_BASE64 }}" | base64 -d > ~/.android/signing-key.jks
md5sum ~/.android/signing-key.jks
fi
- name: Compile OpenSoar - PR
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: |
if [ ${{ matrix.target }} = 'ANDROID' ]; then
echo "make TARGET=ANDROIDFAT..."
make -j$(nproc) TARGET=ANDROIDFAT DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 \
output/ANDROID/bin/${{ matrix.target_bin }}-debug${{ matrix.target_ext }}
mv output/ANDROID/bin/${{ matrix.target_bin }}-debug${{ matrix.target_ext }} \
output/ANDROID/bin/${{ matrix.target_bin }}${{ matrix.target_ext }}
elif [ ${{ matrix.target }} = "WIN64" ]; then
echo "make -j$(nproc) TARGET=${{ matrix.target }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 everything"
make -j$(nproc) TARGET=${{ matrix.target }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 everything
elif [ ${{ matrix.target }} = "PC" ]; then
echo "make -j$(nproc) TARGET=${{ matrix.target }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 everything"
make -j$(nproc) TARGET=${{ matrix.target }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 everything
elif [ ${{ matrix.target }} = "KOBO" ]; then
make -j$(nproc) TARGET=${{ matrix.target }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 output/${{ matrix.target }}/${{ matrix.target_bin }}${{ matrix.target_ext }}
elif [ ${{ matrix.target }} = "OSX64" ]; then
gmake -j$(nproc) TARGET=${{ matrix.target }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 OPTIMIZE="-O0"
elif [ ${{ matrix.target }} = "MACOS" ]; then
gmake -j$(nproc) TARGET=${{ matrix.target }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 OPTIMIZE="-O0"
elif [ ${{ matrix.target }} = "IOS64" ]; then
gmake -j$(nproc) TARGET=${{ matrix.target }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 OPTIMIZE="-O0"
elif [ ${{ matrix.target }} = "UNIX" ]; then
mkdir -p output/UNIX/DPKG
rsync -apt . output/UNIX/DPKG --exclude=output/UNIX/DPKG
cd output/UNIX/DPKG
# DEB_BUILD_OPTIONS=ccache,noopt dpkg-buildpackage --jobs-force=$(nproc) --no-sign
fi
- name: Compile OpenSoar - Sanitizer Check
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: |
if [ ${{ matrix.target }} = "UNIX" ]; then
make -j$(nproc) TARGET=${{ matrix.target }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 everything check VFB=y SANITIZE=y DEBUG_GLIBCXX=y
fi
- name: Compile OpenSoar - Release
if: startsWith(github.ref, 'refs/tags/v')
run: |
if [ ${{ matrix.target }} = 'ANDROID' ]; then
if [ -n "${{ secrets.OPENSOAR_UPLOAD_KEY_JKS_PASSWORD }}" ] && [ -n "${{ secrets.OPENSOAR_UPLOAD_KEY_JKS_KEY_ALIAS }}" ]; then
ANDROID_KEYSTORE_PASS=${{ secrets.OPENSOAR_UPLOAD_KEY_JKS_PASSWORD }} \
make -j$(nproc) TARGET=ANDROIDFAT DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 \
output/ANDROID/bin/${{ matrix.target_bin }}${{ matrix.target_ext }} \
ANDROID_KEYSTORE=~/.android/signing-key.jks ANDROID_KEY_ALIAS=${{ secrets.OPENSOAR_UPLOAD_KEY_JKS_KEY_ALIAS }}
else
make -j$(nproc) TARGET=ANDROIDFAT DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 \
output/ANDROID/bin/${{ matrix.target_bin }}${{ matrix.target_ext }}
fi
elif [ ${{ matrix.target }} = "WIN64" ]; then
make -j$(nproc) TARGET=${{ matrix.target }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 everything
elif [ ${{ matrix.target }} = "PC" ]; then
make -j$(nproc) TARGET=${{ matrix.target }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 everything
elif [ ${{ matrix.target }} = "KOBO" ]; then
make -j$(nproc) TARGET=${{ matrix.target }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 output/${{ matrix.target }}/${{ matrix.target_bin }}${{ matrix.target_ext }}
elif [ ${{ matrix.target }} = "OSX64" ]; then
gmake -j$(nproc) TARGET=${{ matrix.target }} DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 OPTIMIZE="-O0"
elif [ ${{ matrix.target }} = "UNIX" ]; then
mkdir -p output/UNIX/DPKG
rsync -apt . output/UNIX/DPKG --exclude=output/UNIX/DPKG
cd output/UNIX/DPKG
DEB_BUILD_OPTIONS=ccache dpkg-buildpackage --jobs-force=$(nproc) --no-sign
cp *.deb ../
fi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target_final }}-${{ env.git_hash }}${{ matrix.target }}${{ matrix.target_ext }}
path: output/${{ matrix.target }}/${{ matrix.target_bin_path }}/${{ matrix.target_bin }}${{ matrix.target_ext }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
if: ${{ startsWith(github.ref, 'refs/tags/v') && matrix.target_upload == true && needs.release.outputs.upload_url != '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: output/${{ matrix.target }}/${{ matrix.target_bin_path }}/${{ matrix.target_bin }}${{ matrix.target_ext }}
asset_name: ${{ matrix.target_final }}-${{ matrix.target }}${{ matrix.target_ext }}
asset_content_type: application/zip
- name: Deploy to Download server - testing
if: ${{ github.repository == 'OpenSoaring/OpenSoar' && github.ref == 'refs/heads/master' }}
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.REPOSITORY_SSH_KEY }}
ARGS: "-rltgoDzvO"
SOURCE: output/${{ matrix.target }}/${{ matrix.target_bin_path }}/${{ matrix.target_bin }}${{ matrix.target_ext }}
REMOTE_HOST: ${{ secrets.REPOSITORY_HOST }}
REMOTE_USER: ${{ secrets.REPOSITORY_SSH_USER }}
TARGET: ${{ secrets.REPOSITORY_REMOTE_PATH }}/testing/${{ matrix.target }}/
SCRIPT_BEFORE: mkdir -p ${{ secrets.REPOSITORY_REMOTE_PATH }}/testing/${{ matrix.target }}
- name: Deploy to Download server - release
if: ${{ github.repository == 'OpenSoaring/OpenSoar' && startsWith(github.ref, 'refs/tags/v') && matrix.target_upload == true }}
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.REPOSITORY_SSH_KEY }}
ARGS: "-rltgoDzvO"
SOURCE: output/${{ matrix.target }}/${{ matrix.target_bin_path }}/${{ matrix.target_bin }}${{ matrix.target_ext }}
REMOTE_HOST: ${{ secrets.REPOSITORY_HOST }}
REMOTE_USER: ${{ secrets.REPOSITORY_SSH_USER }}
TARGET: ${{ secrets.REPOSITORY_REMOTE_PATH }}/releases/${{ needs.release.outputs.version }}/${{ matrix.target }}/
SCRIPT_BEFORE: mkdir -p ${{ secrets.REPOSITORY_REMOTE_PATH }}/releases/${{ needs.release.outputs.version }}/${{ matrix.target }}/