-
Notifications
You must be signed in to change notification settings - Fork 22
/
azure-pipelines.yml
435 lines (387 loc) · 17.7 KB
/
azure-pipelines.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
resources:
containers:
- container: fpkde
options: '--privileged'
image: mobsya/flatpak-builders:kde-latest
trigger:
tags:
include:
- 2.*
branches:
include:
- '*'
variables:
- group: passwords
- name: blockly_version
value: "v20210908.3"
- name: scratch_version
value: "v20220921.1"
- name: vpl3_version
value: "v20221017.1"
- name: packet_version
value: "2.4.0"
- name: blockly_url
value: "https://github.com/Mobsya/thymio-blockly-standalone/releases/download/$(blockly_version)/thymio-blockly.tar.gz"
- name: scratch_url
value: "https://github.com/Mobsya/scratch-gui/releases/download/$(scratch_version)/scratch-gui.tar.gz"
- name: vpl3_url
value: "https://github.com/Mobsya/vpl-web/releases/download/$(vpl3_version)/vpl3-thymio-suite.tar.gz"
- name: vcpkg_commit
value: "456b97564391c78f0c61d8e8b617042aa7ae77bf"
- name: visual_bootstrapper
value: "https://github.com/Mobsya/ci-data/releases/download/data/vs_enterprise.exe"
- name: thonny_url
value: "https://github.com/Mobsya/ci-data/releases/download/data/thonny-3.3.13.tar.gz"
parameters:
- name: 'architectures'
type: object
default:
- armeabi-v7a
- arm64-v8a
- x86
- x86_64
jobs:
- job: 'BuildFlatpak'
pool:
vmImage: 'Ubuntu-18.04'
container: fpkde
steps:
- script: |
git submodule update --init --recursive
flatpak remote-add --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak-builder --user --install-deps-from=flathub --force-clean --keep-build-dirs -v --repo=bundle build-dir flatpak/org.mobsya.ThymioSuite.json
flatpak build-bundle --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo bundle $(Build.ArtifactStagingDirectory)/ThymioSuite-$(packet_version).flatpak org.mobsya.ThymioSuite
displayName: 'Build flatpak bundle'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'thymio-suite.flatpak'
- job: 'BuildFlatpak515'
pool:
vmImage: 'Ubuntu-20.04'
container: fpkde
steps:
- script: |
git submodule update --init --recursive
flatpak remote-add --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak-builder --user --install-deps-from=flathub --force-clean --keep-build-dirs -v --repo=bundle build-dir flatpak/org.mobsya.ThymioSuite515.json
flatpak build-bundle --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo bundle $(Build.ArtifactStagingDirectory)/ThymioSuite515-$(packet_version).flatpak org.mobsya.ThymioSuite
displayName: 'Build flatpak bundle'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'thymio-suite.flatpak'
- job: 'MSVC'
timeoutInMinutes: 90
pool:
vmImage: windows-2019
strategy:
matrix:
x64:
ARCH: 'x64'
vcpkgTriplet: 'x64-windows-static'
QT_URL: "https://github.com/Mobsya/ci-data/releases/download/data/qt-5.15.2-msvc-x64.7z"
CMAKE_PREFIX_PATH: $(Build.BinariesDirectory)/Qt/5.15.2/msvc2019_64/
cmake_generator: "Visual Studio 16 2019"
ARCH_CMAKE: "-A x64 -T version=14.25"
VCINSTALLDIR: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC"
x86:
ARCH: 'x86'
vcpkgTriplet: 'x86-windows-static'
QT_URL: "https://github.com/Mobsya/ci-data/releases/download/data/qt-5.15.2-msvc-x86.7z"
CMAKE_PREFIX_PATH: $(Build.BinariesDirectory)/Qt/5.15.2/msvc2019
cmake_generator: "Visual Studio 16 2019"
ARCH_CMAKE: "-A Win32 -T version=14.25"
VCINSTALLDIR: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC"
steps:
- task: NodeTool@0
displayName: Pin Node.js version
inputs:
versionSpec: '14.17.0'
- script: |
git submodule update --init --recursive
displayName: Update submodules
- script: |
makensis -VERSION
displayName: Install NSIS
- task: Cache@2
displayName: Cache vcpkg
inputs:
key: $(Build.SourcesDirectory)/vcpkg-list.txt| "$(vcpkg_commit)" | "windows-2019" | "6" | $(vcpkgTriplet)
path: '$(Build.BinariesDirectory)/vcpkg'
- task: Cache@2
displayName: 'Qt Cache'
inputs:
key: Qt_5_12_3 | "$(QT_URL)" | "2"
path: $(Build.BinariesDirectory)/Qt/
cacheHitVar: QT_LIB_CACHE_RESTORED
- task: run-vcpkg@0
displayName: 'Run vcpkg'
inputs:
vcpkgTriplet: '$(vcpkgTriplet)'
vcpkgArguments: '@$(Build.SourcesDirectory)/vcpkg-list.txt'
vcpkgGitCommitId: "$(vcpkg_commit)"
vcpkgGitURL: https://github.com/mobsya/vcpkg.git
vcpkgSetupOnly: true
- script: |
vcpkg --feature-flags="manifests,versions" install --triplet $(vcpkgTriplet) --clean-after-build --vcpkg-root "D:\a\1\b/vcpkg"
displayName: RerunVcpk install
- powershell: |
Get-ChildItem $(Build.BinariesDirectory)/vcpkg -recurse -include *.o | remove-item
Remove-Item -Recurse -Force $(Build.BinariesDirectory)/vcpkg/buildtrees -ErrorAction Ignore
Remove-Item -Recurse -Force $(Build.BinariesDirectory)/vcpkg/downloads -ErrorAction Ignore
displayName: 'Remove vcpkg object files'
- powershell: |
$output = [System.IO.Path]::GetTempFileName()
Invoke-WebRequest -Verbose -UseBasicParsing -Uri "$(QT_URL)" -OutFile $output
7z -bb -y x $output -o$(Build.BinariesDirectory)
condition: ne(variables.QT_LIB_CACHE_RESTORED, 'true')
displayName: Fetch Qt
- task: PythonScript@0
displayName: Fetch scratch, blockly and vpl3
inputs:
scriptSource: 'inline'
script: |
from urllib.request import urlretrieve
import tarfile
def extract(url, file):
print("{} -> {}".format(url, file))
urlretrieve(url, file)
tar = tarfile.open(file, "r:gz")
tar.extractall()
tar.close()
extract('$(blockly_url)', 'thymio-blockly.tar.gz')
extract('$(scratch_url)', 'scratch-gui.tar.gz')
extract('$(vpl3_url)', 'vpl3-thymio-suite.tar.gz')
extract('$(thonny_url)', 'thonny-3.3.13.tar.gz')
- task: DownloadSecureFile@1
name: wincert
inputs:
secureFile: "mobsya-windows.pfx"
- script: |
if exist "C:\Program Files\CMake\bin" set PATH=C:\Program Files\CMake\bin;%PATH%
set "PATH=%PATH%;C:\Program Files (x86)\Windows Kits\10\App Certification Kit\\"
cpack.exe --version
cmake.exe --version
cmake -G "$(cmake_generator)" $(ARCH_CMAKE) -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$(Build.BinariesDirectory)/vcpkg/scripts/buildsystems/vcpkg.cmake "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=$(Build.SourcesDirectory)/windows/cl-toolchain.cmake" "-DVCPKG_TARGET_TRIPLET=$(vcpkgTriplet)" -DFLATBUFFERS_BUILD_TESTS=OFF -DCREATE_QT_CONF_FILE=ON $(Build.SourcesDirectory)
cmake --build . --config Release --parallel
cpack.exe -G NSIS --verbose --debug
workingDirectory: '$(Build.BinariesDirectory)'
displayName: 'Run CMake and CPack'
env:
SIGNTOOL_PFX: $(wincert.secureFilePath)
SIGNTOOL_PASSPHRASE: $(mobsya-win-p12)
- task: CopyFiles@2
inputs:
sourceFolder: '$(Build.BinariesDirectory)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
contents: 'ThymioSuite-*.exe'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'ThymioSuite.exe'
- job: 'BuildAndroid'
pool:
vmImage: 'Ubuntu-18.04'
# strategy:
# matrix:
# armeabi:
# TARGET_ARCH: 'armeabi-v7a'
# aarch64:
# TARGET_ARCH: 'arm64-v8a'
# x86_64:
# TARGET_ARCH: 'x86_64'
variables:
- group: passport
- name: THYMIO_BUILD_API_LEVEL
value: '24'
- name: THYMIO_DEPLOYMENT_TARGET_API_LEVEL
value: '29'
- name: NDK_VERSION
value: '21'
- name: QT_VERSION
value: '5.15.2'
- name: CMAKE_VERSION
value: '3.19.7'
- name: BUILD_MULTI_DIR
- name: DEV_ENVIRONMENT_TAG
value: "android$(THYMIO_BUILD_API_LEVEL)and$(THYMIO_DEPLOYMENT_TARGET_API_LEVEL)-ndk$(NDK_VERSION)-qt$(QT_VERSION)-cmake$(CMAKE_VERSION)"
steps:
- task: DownloadSecureFile@1
name: keystore
displayName: 'Download android keystore'
inputs:
secureFile: 'thymio_suite_mobile.p12'
- script: |
mv $(keystore.secureFilePath) .
displayName: 'Move secure file'
condition: ne(variables['Build.Reason'], 'PullRequest')
- script: |
docker pull mobsya/thymio-dev-env:${DEV_ENVIRONMENT_TAG}
displayName: 'Pull docker image'
- script: |
git submodule update --init --recursive
displayName: 'Clone submodules'
- script: |
wget -q $(scratch_url) && tar xzf scratch-gui.tar.gz -C .
wget -q $(vpl3_url) && tar xzf vpl3-thymio-suite.tar.gz -C .
displayName: 'Fetch VPL3 & Scratch'
- script: |
BUILD_MULTI_DIR=$(pwd)/build/Release/multi/android-${THYMIO_BUILD_API_LEVEL}
mkdir -p ${BUILD_MULTI_DIR}/android-build/assets ${BUILD_MULTI_DIR}/android-build/libs ${BUILD_MULTI_DIR}/aseba
cp -R $(pwd)/vpl3-thymio-suite $(pwd)/scratch ${BUILD_MULTI_DIR}/android-build/assets
displayName: 'Prepare CI environment'
- ${{ each arch in parameters.architectures}}:
- script: |
build_multi=$(pwd)/build/Release/multi/android-${THYMIO_BUILD_API_LEVEL}
build_dir=$(pwd)/build/Release/${{ arch }}/android-${THYMIO_BUILD_API_LEVEL}
mkdir -p ${build_dir}
docker run --rm \
-v $(pwd):/src:rw \
-v ${build_dir}:/build:rw \
mobsya/thymio-dev-env:${DEV_ENVIRONMENT_TAG} \
"cmake -DANDROID_PLATFORM=android-${THYMIO_BUILD_API_LEVEL} -DANDROID_ABI=${{ arch }} -DCMAKE_TOOLCHAIN_FILE=/android/ndk/android-ndk-r$NDK_VERSION/build/cmake/android.toolchain.cmake -DCMAKE_FIND_ROOT_PATH=/qt -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -GNinja -S /src -B /build && cd /build && ninja -j $(nproc)"
sudo cp -r ${build_dir}/android-build/* ${build_multi}/android-build/
sudo cp -r ${build_dir}/aseba/* ${build_multi}/aseba/
displayName: 'Build ${{ arch }}'
- script: |
build_multi=$(pwd)/build/Release/multi/android-${THYMIO_BUILD_API_LEVEL}
android_target_platform="--android-platform android-${THYMIO_DEPLOYMENT_TARGET_API_LEVEL}"
build_type_option="--release"
sign_options="--sign thymio_suite_mobile.p12 thymio_suite_mobile --storepass $(keystore_pass)"
sudo cp ${build_multi}/aseba/launcher/src/AndroidManifest.xml ${build_multi}/android-build/
sudo cp $(pwd)/android/qt-android-cmake/build.gradle.in ${build_multi}/android-build/build.gradle
sed -i "s/@ANDROID_PLATFORM_LEVEL@/${THYMIO_DEPLOYMENT_TARGET_API_LEVEL}/" ${build_multi}/android-build/build.gradle
docker run --rm \
-v $(pwd):/src:ro \
-v ${build_multi}:/build:rw \
-e ANDROID_TARGET_SDK_VERSION=${THYMIO_DEPLOYMENT_TARGET_API_LEVEL} \
mobsya/thymio-dev-env:${DEV_ENVIRONMENT_TAG} \
"jq '.architectures = { \"arm64-v8a\":\"arm64-v8a\", \"armeabi-v7a\":\"armeabi-v7a\", \"x86\":\"x86\", \"x86_64\":\"x86_64\" }' /build/aseba/launcher/src/qtdeploy.json > /build/aseba/launcher/src/qtdeploy.json.tmp && mv /build/aseba/launcher/src/qtdeploy.json.tmp /build/aseba/launcher/src/qtdeploy.json && /qt/bin/androiddeployqt --input /build/aseba/launcher/src/qtdeploy.json --output /build/android-build --verbose --gradle --aab ${build_type_option} ${android_target_platform} ${sign_options}"
sudo cp -r ${build_multi}/android-build/build/outputs/bundle/release ${build_multi}/android-build/build/outputs/apk/release $(Build.ArtifactStagingDirectory)
displayName: 'Package app'
condition: ne(variables['Build.Reason'], 'PullRequest')
- script: |
curl -sL https://firebase.tools | bash
firebase appdistribution:distribute $(Build.ArtifactStagingDirectory)/release/android-build-release-signed.apk --app 1:1076253646123:android:91d4d8e3a0ef626bb5396e --token $(FIREBASE_TOKEN) --release-notes "Build $(Build.BuildNumber) Version $(packet_version) of Thymio Suite"
displayName: 'Deploy to firebase'
condition: ne(variables['Build.Reason'], 'PullRequest')
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'thymio-suite-android'
- job: BuildOnOsX
pool:
vmImage: 'macOS-10.15'
steps:
- task: NodeTool@0
inputs:
versionSpec: '14.x'
- task: InstallAppleCertificate@2
inputs:
certSecureFile: 'Mobsya.p12'
certPwd: $(mobsya-mac-p12)
- script: |
curl -sL $(blockly_url) | tar xzf - -C .
curl -sL $(scratch_url) | tar xzf - -C .
curl -sL $(vpl3_url) | tar xzf - -C .
displayName: 'Extract scratch, blockly and vpl3'
- script: |
curl -sL https://github.com/Mobsya/ci-data/releases/download/data/qt-5.15.2-mac.7z --output mac.7z
7z x mac.7z
displayName: 'Setting Qt version to 5.15.2'
- script: |
curl -sL https://github.com/Mobsya/ci-data/releases/download/data/thonny-3.3.13.pkg --output thonny-3.3.13.pkg
displayName: 'Get Thonny'
#workaround until devops deploy
- script: |
brew bundle
displayName: 'Install dependencies with HomeBrew'
- script: |
curl -sL http://www.openssl.org/source/openssl-1.0.2t.tar.gz | tar xzf - -C .
cd openssl-1.0.2t
perl ./Configure --prefix=/usr/local/Cellar/openssl@1.0.2t/1.0.2t --openssldir=/usr/local/etc/openssl no-ssl2 no-ssl3 no-zlib shared enable-cms darwin64-x86_64-cc enable-ec_nistp_64_gcc_128
make depend
make
make test
make install MANDIR=/usr/local/Cellar/openssl@1.0.2t/1.0.2t/share/man MANSUFFIX=ssl
displayName: 'Setting openssl version to 1.0.2'
- script: |
git submodule update --init --recursive
displayName: 'Clone submodules'
- script: |
sudo xcode-select -s /Applications/Xcode_11.4.1.app/Contents/Developer
(mkdir build && cd build && cmake .. -GNinja -DBoost_DEBUG=OFF -DOPENSSL_ROOT_DIR=/usr/local/Cellar/openssl@1.0.2t/1.0.2t/ -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DQt5Core_DIR="`pwd`/../Qt/5.15.2/clang_64/lib/cmake/Qt5Core" -DCMAKE_PREFIX_PATH="`pwd`/../Qt/5.15.2/clang_64/" && ninja)
displayName: 'Build with cmake'
- script: |
osx/createbundle.sh $(Build.ArtifactStagingDirectory)/ThymioSuite-$(packet_version)-OsX-13-15.dmg build/bin '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
displayName: 'Signing and create dmg'
condition: ne(variables['Build.Reason'], 'PullRequest')
- script: |
osx/createbundle.sh $(Build.ArtifactStagingDirectory)/ThymioSuite-$(packet_version)-OsX-13-15.dmg build/bin
displayName: 'Create Unsigned DMG'
condition: eq(variables['Build.Reason'], 'PullRequest')
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'ThymioSuite.dmg'
- job: BuildForIOs
pool:
vmImage: 'macOS-11'
steps:
- task: NodeTool@0
inputs:
versionSpec: '14.x'
- task: InstallAppleCertificate@2
inputs:
certSecureFile: 'certificat-IOS.p12'
certPwd: $(mobsya-mac-p12)
- task: InstallAppleProvisioningProfile@1
inputs:
provisioningProfileLocation: 'secureFiles'
provProfileSecureFile: 'Ios2022dist.mobileprovision'
removeProfile: true
- script: |
curl -sL $(blockly_url) | tar xzf - -C .
curl -sL $(scratch_url) | tar xzf - -C .
curl -sL $(vpl3_url) | tar xzf - -C .
displayName: 'Extract scratch, blockly and vpl3'
#we need 7z to extract qt so brew needs to run first
#workaround until devops deploy
- script: |
brew bundle
displayName: 'Install dependencies with HomeBrew'
- script: |
curl -sL https://github.com/Mobsya/ci-data/releases/download/data/qt-5.15.2-ios.7z --output ios.7z
7z x ios.7z
displayName: 'Download Qt 5.15.2 for ios'
- script: |
git submodule update --init --recursive
displayName: 'Clone submodules'
- script: |
sudo xcode-select -s /Applications/Xcode_13.2.1.app/Contents/Developer
mkdir build && cd build;
mkdir flatc && cd flatc;
cmake ../../third_party/flatbuffers -G Xcode -T buildsystem=1
cmake --build . --config Release --target flatc
export FLATC=`pwd`/Release/flatc
cd ..
cmake -DIOS_ARCH="arm64" -DENABLE_BITCODE=NO -DIOS_DEPLOYMENT_TARGET=11.0 -DCMAKE_TOOLCHAIN_FILE=../ios/ios-cmake/ios.toolchain.cmake -DCMAKE_PREFIX_PATH="`pwd`/../Qt/5.15.2/ios/" -G Xcode -T buildsystem=1 -DIOS_ARCHIVE_BUILD=1 ..
displayName: 'CONFIGURE with cmake'
- script: |
cd build;
cmake --build . --target thymio-launcher --config Release -- -IPHONEOS_DEPLOYMENT_TARGET=11.0 CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO;
xcodebuild -scheme thymio-launcher -configuration Release -derivedDataPath ./bin/datas/libraries -sdk iphoneos clean archive -archivePath ./bin/launcher.xcarchive -IPHONEOS_DEPLOYMENT_TARGET=11.0 -allowProvisioningUpdates CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO;
displayName: 'Build with cmake - Unsigned'
condition: eq(variables['Build.Reason'], 'PullRequest')
- script: |
cd build;
cmake --build . --target thymio-launcher --config Release -- -IPHONEOS_DEPLOYMENT_TARGET=11.0
xcodebuild -scheme thymio-launcher -configuration Release -derivedDataPath ./bin/datas/libraries -sdk iphoneos clean archive -archivePath ./bin/launcher.xcarchive -IPHONEOS_DEPLOYMENT_TARGET=11.0 PROVISIONING_PROFILE_SPECIFIER="Ios2022dist" CODE_SIGN_IDENTITY="iPhone Distribution" CODE_SIGN_STYLE="Manual"
xcodebuild -exportArchive -archivePath ./bin/launcher.xcarchive -exportOptionsPlist ../ios/exportOptions.plist -exportPath $(Build.ArtifactStagingDirectory)
displayName: 'Build with cmake - SIGNED'
condition: ne(variables['Build.Reason'], 'PullRequest')
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'ThymioSuite.app'