-
Notifications
You must be signed in to change notification settings - Fork 14
451 lines (380 loc) · 16.7 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
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
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
# Copyright (c) 2023, DyssolTEC.
# All rights reserved. This file is part of Dyssol. See LICENSE file for license information.
# A workflow for testing on Windows
name: Windows
on: [push]
env:
# Path to the solution/project files relative to the root of the project.
SOLUTION_FILE_PATH: .
SOLUTION_FILE_NAME: Dyssol.sln
TESTS_PROJECT_PATH: ./DyssolInstallers/Tests/
DOCS_PROJECT_PATH: ./DyssolInstallers/Documentation/
INSTALLER_PROJECT_PATH: ./DyssolInstallers/Installer/
# Configuration type to build.
BUILD_CONFIGURATION: Release
BUILD_PLATFORM: x64
# Versions
QT_VERSION: 5.15.2
QT_VS_VERSION: msvc2019_64
QT_VS_ADDIN_VERSION: 3.3.1
ZLIB_VERSION: 1.3
SUNDIALS_VERSION: 6.4.1
HDF5_VERSION: 1.12.2
GRAPHVIZ_VERSION: 7.0.4
MIKTEX_VERSION: 23.5
jobs:
build:
runs-on: windows-2019
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
# Whether to cache Qt automatically.
cache: 'true'
# If cached, only install essential build tools and set environmental variables.
cache-key-prefix: 'cache-qt'
# Version of Qt to install.
version: ${{env.QT_VERSION}}
# Architecture.
arch: win64_${{env.QT_VS_VERSION}}
# Directory to install.
dir: ${{github.workspace}}/ExternalLibraries/qt
# Whether or not to automatically run setup-python to find a valid python version.
setup-python: 'false'
- name: Cache QtMsBuild tools
id: cache-qt-ms-build-tools
uses: actions/cache@v4
with:
path: ${{github.workspace}}/ExternalLibraries/qtvsaddin
key: ${{runner.os}}-QtMsBuildCache-${{env.QT_VS_ADDIN_VERSION}}
- name: Get QtMsBuild tools
if: steps.cache-qt-ms-build-tools.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}
# Get additional project files to build Qt solution with MSBuild. This work is usually done in Visual Studio with Qt VS Tools extension.
# Also, it installs them to %LOCALAPPDATA%\QtMsBuild, so they can not be used by other Windows users.
# Download the extension and extract requited files to the project directory.
run: |
Invoke-WebRequest -Uri https://ftp.fau.de/qtproject/archive/vsaddin/${{env.QT_VS_ADDIN_VERSION}}/qt-vsaddin-msvc2019-x86-${{env.QT_VS_ADDIN_VERSION}}.vsix -MaximumRetryCount 10 -RetryIntervalSec 30 -OutFile vspackage.vsix
Expand-Archive vspackage.vsix -DestinationPath ${{github.workspace}}/ExternalLibraries/qtvsaddin
- name: Cache ZLib
id: cache-zlib
uses: actions/cache@v4
with:
path: ${{github.workspace}}/ExternalLibraries/zlib
key: ${{runner.os}}-ZLibCache-${{env.ZLIB_VERSION}}
- name: Build ZLib
if: steps.cache-zlib.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/ExternalLibraries
shell: pwsh
# Run the script to build zlib.
run: .\CompileZLib.ps1
- name: Cache SUNDIALS
id: cache-sundials
uses: actions/cache@v4
with:
path: ${{github.workspace}}/ExternalLibraries/sundials
key: ${{runner.os}}-SundialsCache-${{env.SUNDIALS_VERSION}}
- name: Build SUNDIALS
if: steps.cache-sundials.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/ExternalLibraries
shell: pwsh
# Run the script to build sundials.
run: .\CompileSundials.ps1
- name: Cache HDF5
id: cache-hdf5
uses: actions/cache@v4
with:
path: ${{github.workspace}}/ExternalLibraries/hdf5
key: ${{runner.os}}-Hdf5Cache-${{env.HDF5_VERSION}}
- name: Build HDF5
if: steps.cache-hdf5.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/ExternalLibraries
shell: pwsh
# Run the script to build hdf5.
run: .\CompileHDF5.ps1
- name: Cache Graphviz
id: cache-graphviz
uses: actions/cache@v4
with:
path: ${{github.workspace}}/ExternalLibraries/graphviz
key: ${{runner.os}}-GraphvizCache-${{env.GRAPHVIZ_VERSION}}
- name: Build Graphviz
if: steps.cache-graphviz.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/ExternalLibraries
shell: pwsh
# Run the script to build graphviz.
run: .\CompileGraphviz.ps1
- name: Build
working-directory: ${{github.workspace}}
env:
QtToolsPath: ${{env.QT_ROOT_DIR}}/bin
QtMsBuild: ${{github.workspace}}/ExternalLibraries/qtvsaddin/QtMsBuild
# Add additional options to the MSBuild command line here: see https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference.
run: msbuild -maxCpuCount -verbosity:minimal -property:Configuration=${{env.BUILD_CONFIGURATION}} -property:Platform=${{env.BUILD_PLATFORM}} ${{env.SOLUTION_FILE_PATH}}/${{env.SOLUTION_FILE_NAME}}
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: build-artifact
if-no-files-found: error
retention-days: 1
compression-level: 1
path: |
${{github.workspace}}/${{env.BUILD_PLATFORM}}/${{env.BUILD_CONFIGURATION}}/*.exe
${{github.workspace}}/${{env.BUILD_PLATFORM}}/${{env.BUILD_CONFIGURATION}}/*.dll
tests:
runs-on: windows-2019
needs: build
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Download Build Artifact
uses: actions/download-artifact@v4
with:
name: build-artifact
path: ${{github.workspace}}/${{env.BUILD_PLATFORM}}/${{env.BUILD_CONFIGURATION}}
- name: Run Tests
working-directory: ${{github.workspace}}
# Add additional options to the MSBuild command line here: see https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference.
run: msbuild -maxCpuCount -verbosity:minimal -property:Configuration=${{env.BUILD_CONFIGURATION}} -property:Platform=${{env.BUILD_PLATFORM}} -property:SolutionDir=${{github.workspace}}/ -property:SolutionPath=${{github.workspace}}/${{env.SOLUTION_FILE_NAME}} -property:TestsPreBuild=false ${{env.TESTS_PROJECT_PATH}}
docs:
runs-on: windows-2019
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Install Doxygen
run: choco install doxygen.install
- name: Install Sphinx
run: pip install -U sphinx sphinx-rtd-theme breathe
- name: Cache MiKTeX
id: cache-miktex
uses: actions/cache@v4
with:
path: C:/Program Files/MiKTeX
key: ${{runner.os}}-MiKTeXCache-${{env.MIKTEX_VERSION}}
- name: Install MiKTeX
if: steps.cache-miktex.outputs.cache-hit != 'true'
run: choco install miktex.install --version ${{env.MIKTEX_VERSION}} -y
- name: Add MiKTeX to PATH
run: Add-Content $env:GITHUB_PATH "C:\Program Files\MiKTeX\miktex\bin\x64"
- name: Configure MiKTeX
run: |
initexmf --admin --verbose --set-config-value=[MPM]AutoInstall=1
miktex --admin --verbose packages update-package-database
miktex --admin --verbose packages update
miktex --admin --verbose packages install amscls, anyfontsize, preview, zhmetrics
miktex --admin --verbose fndb refresh
initexmf --admin --verbose --update-fndb
initexmf --admin --verbose --mklinks --force
updmap --admin
- name: Build Docs
working-directory: ${{github.workspace}}
# Add additional options to the MSBuild command line here: see https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference.
run: msbuild -maxCpuCount -verbosity:minimal -property:Configuration=${{env.BUILD_CONFIGURATION}} -property:Platform=${{env.BUILD_PLATFORM}} -property:SolutionDir=${{github.workspace}}/ ${{env.DOCS_PROJECT_PATH}}
- name: Upload Docs Artifact
uses: actions/upload-artifact@v4
with:
name: docs-artifact
if-no-files-found: error
retention-days: 1
compression-level: 2
path: ${{github.workspace}}/install/windows
installer:
runs-on: windows-2019
needs: [build, docs]
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get LocalAppData Directory
run: echo ("LOCALAPPDATA_DIR=" + $env:LOCALAPPDATA) >> $env:GITHUB_ENV
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
# Whether to cache Qt automatically.
cache: 'true'
# If cached, only install essential build tools and set environmental variables.
cache-key-prefix: 'cache-qt'
# Version of Qt to install.
version: ${{env.QT_VERSION}}
# Architecture.
arch: win64_${{env.QT_VS_VERSION}}
# Directory to install.
dir: ${{github.workspace}}/ExternalLibraries/qt
# Whether or not to automatically run setup-python to find a valid python version.
setup-python: 'false'
- name: Cache QtMsBuild tools
id: cache-qt-ms-build-tools
uses: actions/cache@v4
with:
path: ${{github.workspace}}/ExternalLibraries/qtvsaddin
key: ${{runner.os}}-QtMsBuildCache-${{env.QT_VS_ADDIN_VERSION}}
- name: Get QtMsBuild tools
if: steps.cache-qt-ms-build-tools.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}
# Get additional project files to build Qt solution with MSBuild. This work is usually done in Visual Studio with Qt VS Tools extension.
# Also, it installs them to %LOCALAPPDATA%\QtMsBuild, so they can not be used by other Windows users.
# Download the extension and extract requited files to the project directory.
run: |
Invoke-WebRequest -Uri https://ftp.fau.de/qtproject/archive/vsaddin/${{env.QT_VS_ADDIN_VERSION}}/qt-vsaddin-msvc2019-x86-${{env.QT_VS_ADDIN_VERSION}}.vsix -MaximumRetryCount 10 -RetryIntervalSec 30 -OutFile vspackage.vsix
Expand-Archive vspackage.vsix -DestinationPath ${{github.workspace}}/ExternalLibraries/qtvsaddin
- name: Cache ZLib
id: cache-zlib
uses: actions/cache@v4
with:
path: ${{github.workspace}}/ExternalLibraries/zlib
key: ${{runner.os}}-ZLibCache-${{env.ZLIB_VERSION}}
- name: Build ZLib
if: steps.cache-zlib.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/ExternalLibraries
shell: pwsh
# Run the script to build zlib.
run: .\CompileZLib.ps1
- name: Cache SUNDIALS
id: cache-sundials
uses: actions/cache@v4
with:
path: ${{github.workspace}}/ExternalLibraries/sundials
key: ${{runner.os}}-SundialsCache-${{env.SUNDIALS_VERSION}}
- name: Build SUNDIALS
if: steps.cache-sundials.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/ExternalLibraries
shell: pwsh
# Run the script to build sundials.
run: .\CompileSundials.ps1
- name: Cache HDF5
id: cache-hdf5
uses: actions/cache@v4
with:
path: ${{github.workspace}}/ExternalLibraries/hdf5
key: ${{runner.os}}-Hdf5Cache-${{env.HDF5_VERSION}}
- name: Build HDF5
if: steps.cache-hdf5.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/ExternalLibraries
shell: pwsh
# Run the script to build hdf5.
run: .\CompileHDF5.ps1
- name: Cache Graphviz
id: cache-graphviz
uses: actions/cache@v4
with:
path: ${{github.workspace}}/ExternalLibraries/graphviz
key: ${{runner.os}}-GraphvizCache-${{env.GRAPHVIZ_VERSION}}
- name: Build Graphviz
if: steps.cache-graphviz.outputs.cache-hit != 'true'
working-directory: ${{github.workspace}}/ExternalLibraries
shell: pwsh
# Run the script to build graphviz.
run: .\CompileGraphviz.ps1
- name: Download Docs Artifact
uses: actions/download-artifact@v4
with:
name: docs-artifact
path: ${{github.workspace}}/install/windows
- name: Build
working-directory: ${{github.workspace}}
env:
QtToolsPath: ${{env.QT_ROOT_DIR}}/../${{env.QT_VS_VERSION}}/bin
QtMsBuild: ${{github.workspace}}/ExternalLibraries/qtvsaddin/QtMsBuild
run: |
msbuild -maxCpuCount -verbosity:minimal -property:Configuration=Debug -property:Platform=${{env.BUILD_PLATFORM}} ${{env.SOLUTION_FILE_PATH}}/${{env.SOLUTION_FILE_NAME}}
msbuild -maxCpuCount -verbosity:minimal -property:Configuration=Release -property:Platform=${{env.BUILD_PLATFORM}} ${{env.SOLUTION_FILE_PATH}}/${{env.SOLUTION_FILE_NAME}}
- name: Build Installer
working-directory: ${{github.workspace}}
env:
QtToolsPath: ${{env.QT_ROOT_DIR}}/bin
QtMsBuild: ${{github.workspace}}/ExternalLibraries/qtvsaddin/QtMsBuild
run: msbuild -maxCpuCount -verbosity:minimal -property:Configuration=${{env.BUILD_CONFIGURATION}} -property:Platform=${{env.BUILD_PLATFORM}} -property:SolutionDir=${{github.workspace}}/ -property:SolutionPath=${{github.workspace}}/${{env.SOLUTION_FILE_NAME}} -property:QtInstallDir=${{github.workspace}}/ExternalLibraries/qt/Qt/${{env.QT_VERSION}}/${{env.QT_VS_VERSION}}/ -property:InstallerDocumentation=true -property:InstallerSDK=true -property:InstallerSDKLibs=Sources -property:InstallerPreBuild=false -property:InstallerPreDocs=false ${{env.INSTALLER_PROJECT_PATH}}
- name: Run Installer
shell: pwsh
run: |
$InstallerFile = Resolve-Path "${{github.workspace}}\DyssolInstallers\Installers\Dyssol*.exe"
Start-Process -FilePath $InstallerFile -ArgumentList "/SP- /SILENT /SUPPRESSMSGBOXES /CURRENTUSER" -Wait
- name: Upload Installer Artifact
uses: actions/upload-artifact@v4
with:
name: installer-artifact
if-no-files-found: error
retention-days: 7
compression-level: 0
path: ${{github.workspace}}/DyssolInstallers/Installers/*.exe
- name: Upload Portable Installer Artifact
uses: actions/upload-artifact@v4
with:
name: portable-installer-artifact
if-no-files-found: error
retention-days: 7
compression-level: 9
path: ${{ env.LOCALAPPDATA_DIR }}/Programs/Dyssol
- name: Uninstall Dyssol
shell: pwsh
run: |
$UnInstallerFile = Resolve-Path "${{ env.LOCALAPPDATA_DIR }}/Programs/Dyssol/unins000.exe"
Start-Process -FilePath $UnInstallerFile -ArgumentList "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /skipaskconfig=yes" -Wait
release:
runs-on: windows-2019
needs: [tests, installer]
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download Installer Artifact
uses: actions/download-artifact@v4
with:
name: installer-artifact
path: ${{github.workspace}}/DyssolInstallers/Installers/
- name: Download Portable Installer Artifact
uses: actions/download-artifact@v4
with:
name: portable-installer-artifact
path: C:/Program Files/Dyssol
- name: Get Version
id: get-version
shell: pwsh
run: |
$TAG='${{github.ref_name}}'
$VERSION=$TAG.TrimStart('v')
echo "VERSION=$VERSION" >> $env:GITHUB_OUTPUT
- name: Rename Installer
working-directory: ${{github.workspace}}/DyssolInstallers/Installers/
shell: pwsh
run: |
Get-ChildItem -Path "." | Rename-Item -NewName "Dyssol.${{steps.get-version.outputs.VERSION}}.open.setup.exe"
Move-Item -Path "Dyssol.${{steps.get-version.outputs.VERSION}}.open.setup.exe" -Destination "${{github.workspace}}/Dyssol.${{steps.get-version.outputs.VERSION}}.open.setup.exe"
- name: Zip Portable Installer
shell: pwsh
run: |
Compress-Archive -Path 'C:/Program Files/Dyssol' -DestinationPath ${{github.workspace}}/Dyssol.${{steps.get-version.outputs.VERSION}}.open.portable.zip
- name: Release
uses: softprops/action-gh-release@v2
with:
name: 'Dyssol ${{github.ref_name}}'
draft: 'true'
body_path: CHANGELOG
files: |
Dyssol.${{steps.get-version.outputs.VERSION}}.open.setup.exe
Dyssol.${{steps.get-version.outputs.VERSION}}.open.portable.zip
cleanup:
runs-on: windows-2019
needs: [tests, installer, release]
if: ${{always()}}
steps:
- name: Delete Build Artifact
uses: geekyeggo/delete-artifact@v4
with:
name: build-artifact
failOnError: false
- name: Delete Docs Artifact
uses: geekyeggo/delete-artifact@v4
with:
name: docs-artifact
failOnError: false