-
Notifications
You must be signed in to change notification settings - Fork 175
392 lines (334 loc) · 14 KB
/
build-windows.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
name: Build Windows
on:
push:
pull_request:
branches:
- master
env:
IS_JENKINS_SIGNING_ALLOWED: true
jobs:
build-windows:
runs-on: windows-2019
env:
# enable starting Qt GUI Applications
QT_QPA_PLATFORM: offscreen
steps:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
setup-python: 'false'
version: '6.6.1'
target: 'desktop'
arch: 'win64_msvc2019_64'
- name: Install Dependencies
# choco install of version 1.9.3 produced a checksum error
run: choco install doxygen.install --version=1.9.2
- name: Uninstall Chocolatey
run: move "$env:PROGRAMDATA\chocolatey" "$env:PROGRAMDATA\_chocolatey"
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'true'
fetch-depth: 0
- name: Create Python virtualenv
run: |
mkdir "${{ runner.workspace }}\_build\complete\.venv\"
# At the moment (2021-10-27) there is no official Python 3.10 lxml package available on pypi. Thus we use python 3.9.
py -3.9 -m venv "${{ runner.workspace }}\.venv"
CALL "${{ runner.workspace }}\.venv\Scripts\activate.bat"
echo Upgrading pip
python -m pip install --upgrade pip
pip install wheel
echo Installing python requirements
pip install -r "%GITHUB_WORKSPACE%\doc\requirements.txt"
shell: cmd
- name: CMake SDK
run: |
mkdir "${{ runner.workspace }}\_build\sdk\"
cd "${{ runner.workspace }}/_build/sdk"
cmake %GITHUB_WORKSPACE% -G "Visual Studio 16 2019" -A x64 -T v142 ^
-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=cmake/submodule_dependencies.cmake ^
-DHAS_HDF5=ON ^
-DHAS_QT=ON ^
-DHAS_CURL=OFF ^
-DHAS_CAPNPROTO=OFF ^
-DHAS_FTXUI=ON ^
-DBUILD_DOCS=OFF ^
-DBUILD_APPS=OFF ^
-DBUILD_SAMPLES=OFF ^
-DBUILD_TIME=ON ^
-DBUILD_PY_BINDING=OFF ^
-DBUILD_CSHARP_BINDING=OFF ^
-DBUILD_ECAL_TESTS=OFF ^
-DECAL_INCLUDE_PY_SAMPLES=OFF ^
-DECAL_INSTALL_SAMPLE_SOURCES=OFF ^
-DECAL_JOIN_MULTICAST_TWICE=OFF ^
-DECAL_NPCAP_SUPPORT=ON ^
-DECAL_THIRDPARTY_BUILD_CMAKE_FUNCTIONS=ON ^
-DECAL_THIRDPARTY_BUILD_PROTOBUF=ON ^
-DECAL_THIRDPARTY_BUILD_SPDLOG=ON ^
-DECAL_THIRDPARTY_BUILD_TINYXML2=ON ^
-DECAL_THIRDPARTY_BUILD_FINEFTP=OFF ^
-DECAL_THIRDPARTY_BUILD_CURL=OFF ^
-DECAL_THIRDPARTY_BUILD_GTEST=OFF ^
-DECAL_THIRDPARTY_BUILD_HDF5=ON ^
-DECAL_THIRDPARTY_BUILD_RECYCLE=ON ^
-DECAL_THIRDPARTY_BUILD_TCP_PUBSUB=ON ^
-DECAL_THIRDPARTY_BUILD_QWT=OFF ^
-DECAL_THIRDPARTY_BUILD_UDPCAP=ON ^
-DBUILD_SHARED_LIBS=OFF ^
-DCMAKE_PREFIX_PATH="%ProgramFiles%/Cap'n Proto/lib/cmake/CapnProto" ^
-DCMAKE_BUILD_TYPE=Debug ^
-DCPACK_PACK_WITH_INNOSETUP=OFF
shell: cmd
- name: CMake Complete
run: |
CALL "${{ runner.workspace }}\.venv\Scripts\activate.bat"
cd "${{ runner.workspace }}/_build/complete"
cmake %GITHUB_WORKSPACE% -G "Visual Studio 16 2019" -A x64 -T v142 ^
-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=cmake/submodule_dependencies.cmake ^
-DHAS_HDF5=ON ^
-DHAS_QT=ON ^
-DHAS_CURL=ON ^
-DHAS_CAPNPROTO=OFF ^
-DHAS_FTXUI=ON ^
-DBUILD_DOCS=ON ^
-DBUILD_APPS=ON ^
-DBUILD_SAMPLES=ON ^
-DBUILD_TIME=ON ^
-DBUILD_PY_BINDING=OFF ^
-DBUILD_CSHARP_BINDING=ON ^
-DBUILD_ECAL_TESTS=ON ^
-DECAL_INCLUDE_PY_SAMPLES=OFF ^
-DECAL_INSTALL_SAMPLE_SOURCES=ON ^
-DECAL_JOIN_MULTICAST_TWICE=OFF ^
-DECAL_NPCAP_SUPPORT=ON ^
-DECAL_THIRDPARTY_BUILD_CMAKE_FUNCTIONS=ON ^
-DECAL_THIRDPARTY_BUILD_PROTOBUF=ON ^
-DECAL_THIRDPARTY_BUILD_SPDLOG=ON ^
-DECAL_THIRDPARTY_BUILD_TINYXML2=ON ^
-DECAL_THIRDPARTY_BUILD_FINEFTP=ON ^
-DECAL_THIRDPARTY_BUILD_CURL=ON ^
-DECAL_THIRDPARTY_BUILD_GTEST=ON ^
-DECAL_THIRDPARTY_BUILD_HDF5=ON ^
-DECAL_THIRDPARTY_BUILD_RECYCLE=ON ^
-DECAL_THIRDPARTY_BUILD_TCP_PUBSUB=ON ^
-DECAL_THIRDPARTY_BUILD_QWT=ON ^
-DECAL_THIRDPARTY_BUILD_UDPCAP=ON ^
-DBUILD_SHARED_LIBS=OFF ^
-DCMAKE_PREFIX_PATH="%ProgramFiles%/Cap'n Proto/lib/cmake/CapnProto" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCPACK_PACK_WITH_INNOSETUP=ON
shell: cmd
- name: Build SDK
run: cmake --build . --config Debug
working-directory: ${{ runner.workspace }}/_build/sdk
- name: Build Release
run: cmake --build . --config Release
working-directory: ${{ runner.workspace }}/_build/complete
- name: Create config path and copy ecal.yaml
run: |
mkdir "%ALLUSERSPROFILE%\eCAL"
copy ".\ecal\core\cfg\gen\ecal.yaml" "%ALLUSERSPROFILE%\eCAL"
working-directory: ${{ runner.workspace }}/_build/complete
shell: cmd
- name: Run Tests
run: ctest -C Release -V
working-directory: ${{ runner.workspace }}/_build/complete
- name: Pack SDK
run: cpack -C Debug
working-directory: ${{ runner.workspace }}/_build/sdk
- name: Pack complete setup
run: cpack -C Release
working-directory: ${{ runner.workspace }}/_build/complete
- name: Get Project version from git tag
shell: powershell
run: |
# Use git describe to get the tag / commit description
$VERSION = git describe --tags --dirty
#remove the leading 'v' from the tag, if it exists
$VERSION = $VERSION -replace '^v', ''
echo "VERSION=$VERSION" >> "$Env:GITHUB_ENV"
- name: Set output binary name
shell: powershell
run: |
$BINARY_NAME = "ecal_${{ env.VERSION }}-win64"
echo "BINARY_NAME=$BINARY_NAME" >> "$Env:GITHUB_ENV"
- name: Rename the setup exe
shell: powershell
run: |
$LS_OUT = ls *.exe
$SETUP_NAME = "$($LS_OUT.Name)"
Rename-Item -Path "$SETUP_NAME" -NewName "${{ env.BINARY_NAME }}.exe"
working-directory: ${{ runner.workspace }}/_build/complete/_deploy/
- name: Upload Windows setup
uses: actions/upload-artifact@v4
with:
name: unsigned-setup
path: ${{ runner.workspace }}/_build/complete/_deploy/*.exe
# --------------------------------------------------------------------------------------------------
sign-windows-installer:
runs-on: windows-2019
needs: build-windows
steps:
# Download the installer from the previous job
- name: Download Windows setup
uses: actions/download-artifact@v4
with:
name: unsigned-setup
path: ${{ runner.workspace }}/_build/complete/_deploy
- name: Sign the installer on Eclipse CI
if: env.IS_JENKINS_SIGNING_ALLOWED == 'true' && env.JENKINS_USERNAME != '' && env.JENKINS_API_TOKEN != '' && env.JENKINS_JOB_TOKEN != ''
run: |
$LS_OUT = ls *.exe
$ASSET_NAME = "$($LS_OUT.Name)"
$ASSET_NAME_OLD = "$($ASSET_NAME).old"
$ASSET_NAME_NEW = "$ASSET_NAME"
$JENKINS_JOB = 'gh_auto_file'
$JENKINS_BASE_URL = "https://ci.eclipse.org/ecal"
$JENKINS_CRUMB_URL = "$JENKINS_BASE_URL/crumbIssuer/api/json"
$JENKINS_JOB_URL = "$JENKINS_BASE_URL/job/$JENKINS_JOB"
$JENKINS_TRIGGER_URL = "$JENKINS_JOB_URL/buildWithParameters?token=$Env:JENKINS_JOB_TOKEN"
$WAIT_FOR_JENKINS_SEC = 10
$COUNTER_LIMIT = 30
$RESPONSE_CODE = 0
$CRUMB_ID = ''
$CRUMB_FIELD = ''
$CRUMB_COOKIE = ''
$COUNTER = 0
$QUEUE_URL = ''
$BUILD_NUM = 0
$BUILD_URL = ''
Write-Output "-- get a Jenkins crumb & cookie"
$AUTH_CREDENTIAL = $Env:JENKINS_USERNAME + ':' + $Env:JENKINS_API_TOKEN
$AUTH_ENCODED = [System.Text.Encoding]::UTF8.GetBytes($AUTH_CREDENTIAL)
$AUTH_INFO = [System.Convert]::ToBase64String($AUTH_ENCODED)
$CRUMB_HEADERS = @{
'Authorization'="Basic $($AUTH_INFO)"
}
$RESPONSE = Invoke-WebRequest -Uri $JENKINS_CRUMB_URL -Method GET -Headers $CRUMB_HEADERS
$RES_CODE = $RESPONSE.StatusCode
Write-Output " ++ Jenkins crumb retrieval - HTTP status code: $RES_CODE"
if ($RES_CODE -ge 200 -and $RES_CODE -lt 300) {
$JSON_CONTENT = $RESPONSE.Content | ConvertFrom-Json
$CRUMB_ID = $JSON_CONTENT.crumb
$CRUMB_FIELD = $JSON_CONTENT.crumbRequestField
$CRUMB_COOKIE = $RESPONSE.Headers['Set-Cookie']
#Write-Output " ++ Jenkins crumb: '$CRUMB_ID'"
#Write-Output " ++ Jenkins cookie: '$CRUMB_COOKIE'"
} else {
Write-Output " ** determination of the Jenkins crumb failed"
Exit 1
}
Write-Output "-- trigger a new build of '$JENKINS_JOB' with installer '$ASSET_NAME'"
$TRIGGER_HEADERS = @{
'Authorization'="Basic $($AUTH_INFO)"
'Cookie'=$CRUMB_COOKIE
$CRUMB_FIELD=$CRUMB_ID
}
$FORM = @{
'GH_FILE_NAME'= $ASSET_NAME
'GH_EXECUTABLE'= Get-Item -Path $ASSET_NAME
}
$RESPONSE = Invoke-WebRequest -Uri $JENKINS_TRIGGER_URL -Method POST -Headers $TRIGGER_HEADERS -Form $FORM
$RES_CODE = $RESPONSE.StatusCode
Write-Output " ++ trigger build - HTTP status code: $RES_CODE"
if ($RES_CODE -ge 200 -and $RES_CODE -lt 300) {
$QUEUE_URL = $RESPONSE.Headers.location
$QUEUE_URL = "$($QUEUE_URL)api/json/"
Write-Output " ++ queue URL: $QUEUE_URL"
} else {
Write-Output " ** trigger failure"
Exit 1
}
Write-Output "-- get the new build number"
while ($true) {
$COUNTER++
if ($COUNTER -gt $COUNTER_LIMIT) {
Write-Output " ** determination of the new build number failed after $COUNTER_LIMIT tries"
Exit 1
}
$RESPONSE = Invoke-WebRequest -Uri $QUEUE_URL
$RES_CODE = $RESPONSE.StatusCode
Write-Output " ++ build number retrieval - HTTP status code: $RES_CODE"
if ($RES_CODE -ge 200 -and $RES_CODE -lt 300) {
$JSON_CONTENT = $RESPONSE.Content | ConvertFrom-Json
$EXECUTABLE = $JSON_CONTENT.executable
$BUILD_NUM = $EXECUTABLE.number
if ($BUILD_NUM) {
Write-Output " ++ #build number: $BUILD_NUM"
$BUILD_URL = $EXECUTABLE.url
Break
} else {
Write-Output " ++ ... pending, wait for $WAIT_FOR_JENKINS_SEC s"
Start-Sleep -s $WAIT_FOR_JENKINS_SEC
}
} else {
Write-Output " ** determination of the build number failed, trying again after $WAIT_FOR_JENKINS_SEC s"
Start-Sleep -s $WAIT_FOR_JENKINS_SEC
}
}
$JENKINS_STATUS_URL = "$($BUILD_URL)api/json"
Write-Output "-- check build status of #Build $BUILD_NUM with $JENKINS_STATUS_URL"
while ($true) {
$RESPONSE = Invoke-WebRequest -Uri $JENKINS_STATUS_URL
$RES_CODE = $RESPONSE.StatusCode
Write-Output " ++ status check - HTTP status code: $RES_CODE"
if ($RES_CODE -ge 200 -and $RES_CODE -lt 300) {
$CONTENT = ConvertFrom-Json $RESPONSE.Content
$NUMBER = $CONTENT | Select-Object -expand 'number'
if ($NUMBER -eq $BUILD_NUM) {
$BUILDING = $CONTENT | Select-Object -expand 'building'
if ($BUILDING) {
Write-Output " ++ ... building, wait for $WAIT_FOR_JENKINS_SEC s"
Start-Sleep -s $WAIT_FOR_JENKINS_SEC
} else {
$RESULT = $CONTENT | Select-Object -expand 'result'
if ($RESULT -eq 'SUCCESS') {
Write-Output " ++ build success, asset name: '$ASSET_NAME'"
Break
} else {
Write-Output " ** build failure"
Exit 1
}
}
} else {
Write-Output " ++ ... pending, wait for $WAIT_FOR_JENKINS_SEC s"
Start-Sleep -s $WAIT_FOR_JENKINS_SEC
}
} else {
Write-Output " ** status check failure"
Exit 1
}
}
$JENKINS_DOWNLOAD_URL = "$JENKINS_JOB_URL/$BUILD_NUM/artifact/$ASSET_NAME"
Write-Output "-- download the newly-signed Windows installer from #Build $BUILD_NUM with $JENKINS_DOWNLOAD_URL"
Rename-Item -Path "$ASSET_NAME" -NewName "$ASSET_NAME_OLD"
$RESPONSE = Invoke-WebRequest -Uri $JENKINS_DOWNLOAD_URL -OutFile $ASSET_NAME_NEW -PassThru
$RES_CODE = $RESPONSE.StatusCode
Write-Output " ++ download installer - HTTP status code: $RES_CODE"
if ($RES_CODE -ge 200 -and $RES_CODE -lt 300) {
Write-Output "IS_DOWNLOAD_AVAILABLE=true" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
Write-Output "ASSET_NAME=$ASSET_NAME" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
Write-Output " ++ downloaded signed installer: '$ASSET_NAME'"
} else {
Write-Output " ** download failure"
Exit 1
}
env:
JENKINS_USERNAME: ${{ secrets.JENKINS_USERNAME }}
JENKINS_API_TOKEN: ${{ secrets.JENKINS_API_TOKEN }}
JENKINS_JOB_TOKEN: ${{ secrets.JENKINS_TOKEN_GH_FILE }}
working-directory: ${{ runner.workspace }}/_build/complete/_deploy
- name: Determine name of the installer for zip file
shell: powershell
run: |
$INSTALLER_NAME = "${{ env.ASSET_NAME }}"
$INSTALLER_NAME_WITHOUT_EXE = $INSTALLER_NAME.Substring(0, $INSTALLER_NAME.Length - 4)
echo "ARTIFACT_NAME=$INSTALLER_NAME_WITHOUT_EXE" >> "$Env:GITHUB_ENV"
- name: Upload Windows setup signed on Eclipse CI
if: env.IS_DOWNLOAD_AVAILABLE == 'true'
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ runner.workspace }}/_build/complete/_deploy/${{ env.ASSET_NAME }}