forked from XCSoar/XCSoar
-
Notifications
You must be signed in to change notification settings - Fork 1
278 lines (257 loc) · 11.6 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
---
on:
workflow_dispatch:
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 XCSoar 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: xcsoar_${{ needs.release.outputs.version }}_amd64
target_bin_path: ''
target_final: xcsoar_
target_ext: .deb
target_upload: true
target_container: debian:bookworm-slim
- os: ubuntu-22.04
target: ANDROID
target_bin: XCSoar
target_bin_path: bin
target_final: XCSoar
target_ext: .apk
target_upload: true
ndk: r26d
target_container: debian:bookworm-slim
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=y" >> $GITHUB_ENV
if [ ${{ matrix.target }} = "xcsoar" ]; then
echo "TARGET_FINAL=xcsoar" >> $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
./ide/provisioning/install-debian-packages.sh JET
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
./ide/provisioning/install-android-tools.sh JET
fi
./ide/provisioning/install-debian-packages.sh CLEAN
elif [ ${{ matrix.os }} = 'macos-12' ]; then
brew install \
make \
quilt \
librsvg \
imagemagick gettext sox \
fmt \
sdl2 \
libsodium \
freetype \
libpng libjpeg-turbo \
libtiff libgeotiff proj \
c-ares \
curl \
lua
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.XCSOAR_UPLOAD_KEY_JKS_BASE64 }}" ]; then
mkdir -p ~/.android/
echo "${{ secrets.XCSOAR_UPLOAD_KEY_JKS_BASE64 }}" | base64 -d > ~/.android/signing-key.jks
md5sum ~/.android/signing-key.jks
fi
- name: Compile XCSoar - PR
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: |
if [ ${{ matrix.target }} = 'ANDROID' ]; then
make -j$(nproc) TARGET=ANDROID DEBUG=${{ env.DEBUG }} USE_CCACHE=y V=2 \
output/ANDROID/bin/${{ matrix.target_bin }}-debug${{ matrix.target_ext }}
elif [ ${{ matrix.target }} = "WIN64" ]; 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"
fi
- name: Compile XCSoar - 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 XCSoar - Release
if: startsWith(github.ref, 'refs/tags/v')
run: |
if [ ${{ matrix.target }} = 'ANDROID' ]; then
if [ -n "${{ secrets.XCSOAR_UPLOAD_KEY_JKS_PASSWORD }}" ] && [ -n "${{ secrets.XCSOAR_UPLOAD_KEY_JKS_KEY_ALIAS }}" ]; then
ANDROID_KEYSTORE_PASS=${{ secrets.XCSOAR_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.XCSOAR_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"
fi
- name: Create UNIX dpkg
if: ${{ matrix.target == 'UNIX' && startsWith(github.ref, 'refs/tags/v') }}
run: |
mkdir -p output/UNIX/DPKG
rsync -apt . output/UNIX/DPKG --exclude=output/UNIX/DPKG
cd output/UNIX/DPKG
dpkg-buildpackage --jobs-force=$(nproc) --no-sign
cp *.dpkg ../
- 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 == 'XCSoar/XCSoar' && 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 }}/
- name: Deploy to Download server - release
if: ${{ github.repository == 'XCSoar/XCSoar' && 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 }}/