azure-pipelines.yml 12.2 KB
Newer Older
cor3ntin's avatar
cor3ntin committed
1
resources:
Corentin Jabot's avatar
Corentin Jabot committed
2
   containers:
cor3ntin's avatar
cor3ntin committed
3
   - container: fpkde
4
     options: '--privileged'
cor3ntin's avatar
cor3ntin committed
5
6
     image: mobsya/flatpak-builders:kde-latest

Corentin Jabot's avatar
Corentin Jabot committed
7
8
9
10
trigger:
  tags:
    include:
    - 2.*
Corentin Jabot's avatar
Corentin Jabot committed
11
12
13
  branches:
    include:
    - '*'
Corentin Jabot's avatar
Corentin Jabot committed
14

15
16
variables:
- group: passwords
Corentin Jabot's avatar
Corentin Jabot committed
17
- name: blockly_version
Michael Bonani's avatar
Michael Bonani committed
18
  value: "v20200416.2"
Corentin Jabot's avatar
Corentin Jabot committed
19
- name: scratch_version
Michael Bonani's avatar
Michael Bonani committed
20
  value: "v20200505.1"
Corentin Jabot's avatar
Corentin Jabot committed
21
22
23
24
25
- 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: vcpkg_commit
26
  value: "c4f0372c638831d8d524feb1039611852eca6512"
cor3ntin's avatar
cor3ntin committed
27
28
29
30
31
32
33
34

jobs:
- job: 'BuildFlatpak'
  pool:
    vmImage: 'Ubuntu-16.04'
  container: fpkde
  steps:
  - script: |
Corentin Jabot's avatar
Corentin Jabot committed
35
      git submodule update --init --recursive
Corentin Jabot's avatar
Corentin Jabot committed
36
      flatpak remote-add --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
Corentin Jabot's avatar
Corentin Jabot committed
37
      flatpak-builder --user --install-deps-from=flathub --force-clean --keep-build-dirs -v --repo=bundle build-dir flatpak/org.mobsya.ThymioSuite.json
38
      flatpak build-bundle --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo bundle $(Build.ArtifactStagingDirectory)/thymio-suite.flatpak org.mobsya.ThymioSuite
39
    displayName: 'Build flatpak bundle'
cor3ntin's avatar
cor3ntin committed
40
41
42
43

  - task: PublishBuildArtifacts@1
    inputs:
      pathtoPublish: '$(Build.ArtifactStagingDirectory)'
44
      artifactName: 'thymio-suite.flatpak'
45

Corentin Jabot's avatar
Corentin Jabot committed
46
- job: 'MSVC'
47
  timeoutInMinutes: 90
Corentin Jabot's avatar
Corentin Jabot committed
48
49
  pool:
      vmImage: windows-2019
Corentin Jabot's avatar
Corentin Jabot committed
50
51
52
53
54
55
56
  strategy:
    matrix:
      x64:
        ARCH: 'x64'
        vcpkgTriplet: 'x64-windows-static'
        QT_URL: "https://github.com/Mobsya/ci-data/releases/download/data/qt-5.12-msvc-x64.7z"
        CMAKE_PREFIX_PATH: $(Build.BinariesDirectory)/Qt/5.12.3/msvc2017_64/
Corentin Jabot's avatar
Corentin Jabot committed
57
58
        cmake_generator: "Visual Studio 16 2019"
        ARCH_CMAKE: "-A x64"
Corentin Jabot's avatar
Corentin Jabot committed
59
        VCINSTALLDIR: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC"
Corentin Jabot's avatar
Corentin Jabot committed
60
61
62
63
64
      x86:
        ARCH: 'x86'
        vcpkgTriplet: 'x86-windows-static'
        QT_URL: "https://github.com/Mobsya/ci-data/releases/download/data/qt-5.12-msvc-x86.7z"
        CMAKE_PREFIX_PATH: $(Build.BinariesDirectory)/Qt/5.12.3/msvc2017
Corentin Jabot's avatar
Corentin Jabot committed
65
66
        cmake_generator: "Visual Studio 16 2019"
        ARCH_CMAKE: "-A Win32"
Corentin Jabot's avatar
Corentin Jabot committed
67
        VCINSTALLDIR: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC"
Corentin Jabot's avatar
Corentin Jabot committed
68
69
70
71
72
73
74
  steps:
  - script: |
       git submodule update --init --recursive
    displayName: Update submodules
  - script: |
       makensis  -VERSION
    displayName: Install NSIS
Michael Bonani's avatar
Michael Bonani committed
75
76
77
78
79
80
  - 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
Corentin Jabot's avatar
Corentin Jabot committed
81
82
83
84
85
    displayName: 'Qt Cache'
    inputs:
      key:  Qt_5_12_3 | "$(QT_URL)" | "2"
      path: $(Build.BinariesDirectory)/Qt/
      cacheHitVar: QT_LIB_CACHE_RESTORED
Corentin Jabot's avatar
Corentin Jabot committed
86
87
88
  - task: lucappa.cmake-ninja-vcpkg-tasks.d855c326-b1c0-4d6f-b1c7-440ade6835fb.run-vcpkg@0
    displayName: 'Run vcpkg'
    inputs:
Corentin Jabot's avatar
Corentin Jabot committed
89
      vcpkgTriplet: '$(vcpkgTriplet)'
Corentin Jabot's avatar
Corentin Jabot committed
90
      vcpkgArguments: '@$(Build.SourcesDirectory)/vcpkg-list.txt'
Corentin Jabot's avatar
Corentin Jabot committed
91
      vcpkgGitCommitId: "$(vcpkg_commit)"
Corentin Jabot's avatar
Corentin Jabot committed
92
93
94
95
96
97
98
99
      vcpkgGitURL: https://github.com/mobsya/vcpkg.git
  - 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()
Corentin Jabot's avatar
Corentin Jabot committed
100
        Invoke-WebRequest -Verbose  -UseBasicParsing -Uri "$(QT_URL)" -OutFile $output
Corentin Jabot's avatar
Corentin Jabot committed
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
        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 and blockly
    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()
Corentin Jabot's avatar
Corentin Jabot committed
117
118
        extract('$(blockly_url)', 'thymio-blockly.tar.gz')
        extract('$(scratch_url)', 'scratch-gui.tar.gz')
Corentin Jabot's avatar
Corentin Jabot committed
119
120
121
122
  - task: DownloadSecureFile@1
    name: wincert
    inputs:
      secureFile: "mobsya-windows.pfx"
Corentin Jabot's avatar
Corentin Jabot committed
123
  - script: |
Corentin Jabot's avatar
Corentin Jabot committed
124
        if exist "C:\Program Files\CMake\bin" set PATH=C:\Program Files\CMake\bin;%PATH%
125
126
        set "PATH=%PATH%;C:\Program Files (x86)\Windows Kits\10\App Certification Kit\\"

Corentin Jabot's avatar
Corentin Jabot committed
127
128
129
        cpack.exe --version
        cmake.exe --version

Corentin Jabot's avatar
Corentin Jabot committed
130
        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)
Corentin Jabot's avatar
Corentin Jabot committed
131
        cmake --build . --config Release --parallel
Corentin Jabot's avatar
Corentin Jabot committed
132
133
        cpack.exe -G NSIS --verbose --debug

Corentin Jabot's avatar
Corentin Jabot committed
134
    workingDirectory: '$(Build.BinariesDirectory)'
Corentin Jabot's avatar
Corentin Jabot committed
135
    displayName: 'Run CMake and CPack'
cor3ntin's avatar
cor3ntin committed
136
    env:
Corentin Jabot's avatar
Corentin Jabot committed
137
      SIGNTOOL_PFX: $(wincert.secureFilePath)
cor3ntin's avatar
cor3ntin committed
138
      SIGNTOOL_PASSPHRASE: $(mobsya-win-p12)
Corentin Jabot's avatar
Corentin Jabot committed
139

Corentin Jabot's avatar
Corentin Jabot committed
140
141
142
143
144
145
146
147
148
149
150
  - task: CopyFiles@2
    inputs:
      sourceFolder: '$(Build.BinariesDirectory)'
      targetFolder: '$(Build.ArtifactStagingDirectory)'
      contents: 'ThymioSuite-*.exe'
  - task: PublishBuildArtifacts@1
    inputs:
      pathtoPublish: '$(Build.ArtifactStagingDirectory)'
      artifactName: 'ThymioSuite.exe'


Corentin Jabot's avatar
Corentin Jabot committed
151
152
153
154
155
156
157
158
- job: 'BuildAndroid_armeabi'
  pool:
    vmImage: 'Ubuntu-16.04'
  strategy:
    matrix:
      armeabi:
        TARGET_ARCH: 'armeabi-v7a'
      aarch64:
Corentin Jabot's avatar
Corentin Jabot committed
159
        TARGET_ARCH: 'arm64-v8a'
Corentin Jabot's avatar
Corentin Jabot committed
160
161
162
163
164
165
      x86_64:
        TARGET_ARCH: 'x86_64'
  steps:
  - script: |
      docker pull mobsya/android-dev-env:$TARGET_ARCH
  - script: |
Corentin Jabot's avatar
Corentin Jabot committed
166
167
      wget -q $(blockly_url) && tar xzf thymio-blockly.tar.gz -C .
      wget -q $(scratch_url) && tar xzf scratch-gui.tar.gz -C .
Corentin Jabot's avatar
Corentin Jabot committed
168
169
170
171
172
173
174
    displayName: 'Extract scratch and blockly'

  - script: |
      git submodule update --init --recursive
    displayName: 'Clone submodules'

  - script: |
Corentin Jabot's avatar
Corentin Jabot committed
175
      sudo docker run --rm -e TARGET_ARCH=${TARGET_ARCH} -v $(pwd):/src:rw -v $(Build.ArtifactStagingDirectory):/build:rw mobsya/android-dev-env:$TARGET_ARCH /bin/bash -c 'cd /src && mkdir build && cd build && export CMAKE_PREFIX_PATH="/Qt/android_${TARGET_ARCH}" && cmake -DANDROID_PLATFORM=android-22 -DANDROID_ABI=${TARGET_ARCH}  -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DCMAKE_FIND_ROOT_PATH=/Qt/android_${TARGET_ARCH} -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF ../ -GNinja && ninja && cp bin/*.apk /build/thymio-suite-${TARGET_ARCH}.apk'
Corentin Jabot's avatar
Corentin Jabot committed
176
177
178
179
180
181
182
    displayName: 'Build Thymio Suite'

  - task: PublishBuildArtifacts@1
    inputs:
      pathtoPublish: '$(Build.ArtifactStagingDirectory)'
      artifactName: 'thymio-suite-android'

183

Michael Bonani's avatar
Michael Bonani committed
184
- job: BuildOnOsX
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
  pool:
    vmImage: 'macOS-10.14'
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '9.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 .
    displayName: 'Extract scratch and blockly'

  - script: |
      brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/224d82c09d0bbeda99b4ee9b5ccdf56773e5d513/Formula/qt.rb 
      brew switch qt 5.13.2 
205
206
207
208
209
210
211
212
213
214
215
    displayName: 'Setting Qt version to 5.13.2'

  - script: |
      brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/ae73ba09216a7f8b2c0503e57221db020bcd3471/Formula/boost.rb
      brew switch boost 1.72.0
    displayName: 'Setting Boost version to 1.72.0'

  - script: |
      brew uninstall openssl; brew uninstall openssl; brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb
      brew info openssl
    displayName: 'Setting openssl version to 1.0.0'
216
217
218
219
220
221
222
223
224
225
226
227
228

  - script: |
      brew update
      brew bundle
    displayName: 'Install dependencies with HomeBrew'

  - script: |
      git submodule update --init --recursive
    displayName: 'Clone submodules'

  - script: |
      sudo xcode-select -s /Applications/Xcode_10.1.app/Contents/Developer
      export CMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}:$(brew --prefix qt)"
229
      (mkdir build && cd build &&  cmake .. -GNinja -DBoost_DEBUG=OFF -DOPENSSL_LIBRARIES=/usr/local/Cellar/openssl/1.0.2t/lib -DOPENSSL_INCLUDE_DIR=/usr/local/Cellar/openssl/1.0.2t/include -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF && ninja)
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
    displayName: 'Build with cmake'

  - script: |
      osx/createbundle.sh $(Build.ArtifactStagingDirectory)/ThymioSuite.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.dmg build/bin
    displayName: 'Create Unsigned DMG'
    condition: eq(variables['Build.Reason'], 'PullRequest')

  - task: PublishBuildArtifacts@1
    inputs:
      pathtoPublish: '$(Build.ArtifactStagingDirectory)'
Michael Bonani's avatar
Michael Bonani committed
245
      artifactName: 'ThymioSuite.dmg'
Corentin Jabot's avatar
Corentin Jabot committed
246
247
248
249


- job: BuildForIOs
  pool:
Michael Bonani's avatar
Michael Bonani committed
250
    vmImage: 'macOS-10.14'
Corentin Jabot's avatar
Corentin Jabot committed
251
252
253
254
255
256
257
  steps:
  - task: NodeTool@0
    inputs:
      versionSpec: '9.x'

  - task: InstallAppleCertificate@2
    inputs:
258
      certSecureFile: 'certificat-IOS.p12'
Corentin Jabot's avatar
Corentin Jabot committed
259
260
      certPwd: $(mobsya-mac-p12)

Corentin Jabot's avatar
Corentin Jabot committed
261
262
263
  - task: InstallAppleProvisioningProfile@1
    inputs:
      provisioningProfileLocation: 'secureFiles'
264
      provProfileSecureFile: 'Ios2019dist.mobileprovision'
Corentin Jabot's avatar
Corentin Jabot committed
265
266
      removeProfile: true

Corentin Jabot's avatar
Corentin Jabot committed
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
  - script: |
      curl -sL $(blockly_url) | tar xzf - -C .
      curl -sL $(scratch_url) | tar xzf - -C .
    displayName: 'Extract scratch and blockly'

    #we need 7z to extract qt so brew needs to run first
  - script: |
      brew update
      brew bundle
    displayName: 'Install dependencies with HomeBrew'

  - script: |
      curl -sL https://github.com/Mobsya/ci-data/releases/download/data/qt-5.13.0-ios.7z --output ios.7z
      7z x ios.7z
    displayName: 'Download Qt 5.13 for ios'

  - script: |
      git submodule update --init --recursive
    displayName: 'Clone submodules'

  - script: |
      sudo xcode-select -s /Applications/Xcode_10.1.app/Contents/Developer
      mkdir build && cd build;
Corentin Jabot's avatar
Corentin Jabot committed
290
291
292
293
294
      mkdir flatc && cd flatc;
      cmake ../../third_party/flatbuffers -GXcode
      cmake --build . --config Release --target flatc
      export FLATC=`pwd`/Release/flatc
      cd ..
Corentin Jabot's avatar
Corentin Jabot committed
295
      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.13.0/ios/" -G Xcode -DIOS_ARCHIVE_BUILD=1 ..
Corentin Jabot's avatar
Corentin Jabot committed
296
297
298
299
300
301
302
303
304
305
306
    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;
Corentin Jabot's avatar
Corentin Jabot committed
307
      cmake --build . --target thymio-launcher --config Release -- -IPHONEOS_DEPLOYMENT_TARGET=11.0
abbet@icare.ch's avatar
abbet@icare.ch committed
308
      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="Ios-2019-dist" CODE_SIGN_IDENTITY="iPhone Distribution" CODE_SIGN_STYLE="Manual"
Michael Bonani's avatar
Michael Bonani committed
309
      xcodebuild -exportArchive -archivePath ./bin/launcher.xcarchive -exportOptionsPlist ../ios/exportOptions.plist -exportPath $(Build.ArtifactStagingDirectory)
Corentin Jabot's avatar
Corentin Jabot committed
310
    displayName: 'Build with cmake - SIGNED'
Michael Bonani's avatar
Michael Bonani committed
311
    condition: ne(variables['Build.Reason'], 'PullRequest')
Michael Bonani's avatar
Michael Bonani committed
312
   
Michael Bonani's avatar
Michael Bonani committed
313
314
315
  - task: PublishBuildArtifacts@1
    inputs:
      pathtoPublish: '$(Build.ArtifactStagingDirectory)'
316
      artifactName: 'ThymioSuite.app'