forked from nuttyartist/notes
-
Notifications
You must be signed in to change notification settings - Fork 1
220 lines (193 loc) · 9.16 KB
/
Copy pathwindows.yml
File metadata and controls
220 lines (193 loc) · 9.16 KB
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
name: Windows
on:
workflow_call:
workflow_dispatch:
jobs:
# NOTE: This job uses a fixed Qt version (set in the 'qt-version' key below)!
# So, remember to keep it updated whenever a new Qt version is available on aqtinstall.
build-aqtinstall:
name: Build (${{ matrix.build-type }}, Qt ${{ matrix.qt-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-2025
qt-version: 6.4.3
build-type: release
outputs:
version: ${{ steps.vars.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup variables
id: vars
run: |
$version = Select-String -Path CMakeLists.txt -CaseSensitive -Pattern '\bAPP_VERSION +([^)]+)' | Select-Object -First 1 | %{$_.Matches.Groups[1].value}
if (!$version) {
throw "Failed to extract app version from CMakeLists.txt."
}
if ('${{ github.ref_type }}' -ne 'tag') {
$version += "+g$($env:GITHUB_SHA.Substring(0,7))"
}
$artifact_name = "Notes_$version-Qt${{ matrix.qt-version }}-x64"
Write-Output "version=$version" >> $env:GITHUB_OUTPUT
Write-Output "artifact_name=$artifact_name" >> $env:GITHUB_OUTPUT
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Install Qt ${{ matrix.qt-version }} (aqtinstall)
uses: jurplel/install-qt-action@v4
with:
version: ${{ matrix.qt-version }}
cache: true
arch: win64_msvc2019_64
# Details about this OpenSSL build: https://kb.firedaemon.com/support/solutions/articles/4000121705
# TODO: Remove/tweak this step if/when we get rid of the x86 build or upgrade to Qt 6.5+.
- name: Download OpenSSL 1.x binaries from FireDaemon
if: startsWith(matrix.qt-version, '6.4.')
run: |
$out_file = "openssl-1.1.1w.zip"
Invoke-WebRequest -Uri https://download.firedaemon.com/FireDaemon-OpenSSL/openssl-1.1.1w.zip -OutFile $env:Temp\$out_file
Expand-Archive -Path $env:Temp\$out_file -DestinationPath $env:Temp
Rename-Item $env:Temp\openssl-1.1 $env:Temp\OpenSSL
- name: Setup MSVC problem matcher
uses: ammaraskar/msvc-problem-matcher@0.3.0
- name: Build (${{ matrix.build-type }})
env:
VERBOSE: 1
run: |
$env:CMAKE_BUILD_PARALLEL_LEVEL = $env:NUMBER_OF_PROCESSORS
cmake . --warn-uninitialized --warn-unused-vars `
-B build -G Ninja `
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} `
-DGIT_REVISION=${{ github.ref_type != 'tag' && 'ON' || 'OFF' }} `
-DPRO_VERSION=OFF
cmake --build build
- name: (FIXME) Run qmllint
run: |
cmake --build build --target all_qmllint || $(exit 0)
- name: Install (${{ matrix.build-type }})
run: |
cmake --install build --prefix build
- name: Deploy (${{ matrix.build-type }})
run: |
windeployqt --qmldir src\qml build\bin
- name: Remove unnecessary Qt plugins and libraries
run: |
Set-Location build\bin
# We ship all required runtime DLLs individually.
Remove-Item -Verbose vc_redist.*.exe
# We only use the SQLite Qt driver, so it's fine to delete others.
Remove-Item -Verbose sqldrivers\qsqlodbc.dll
Remove-Item -Verbose sqldrivers\qsqlpsql.dll
- name: Include required runtime libraries (${{ matrix.build-type }})
run: |
Set-Location build\bin
# Include OpenSSL libraries.
Copy-Item $env:Temp\OpenSSL\x64\bin\libcrypto-1_1-x64.dll
Copy-Item $env:Temp\OpenSSL\x64\bin\libssl-1_1-x64.dll
# Also include OpenSSL debug symbols (when building Notes in debug mode).
if ('${{ matrix.build-type }}' -ieq 'debug') {
Copy-Item $env:Temp\OpenSSL\x64\bin\libcrypto-1_1-x64.pdb
Copy-Item $env:Temp\OpenSSL\x64\bin\libssl-1_1-x64.pdb
}
# Include MSVC 2019 runtime libraries.
if ('${{ matrix.build-type }}' -ieq 'release') {
if ($env:VCToolsRedistDir -eq $null) {
# XXX: Hack to work around this issue: https://github.com/actions/runner-images/issues/10819
$env:VCToolsRedistDir = -join ($env:VCINSTALLDIR, "Redist\MSVC\", $env:VCToolsVersion, "\")
}
Copy-Item $env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\msvcp140.dll
Copy-Item $env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\msvcp140_1.dll
Copy-Item $env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\msvcp140_2.dll
Copy-Item $env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\vcruntime140.dll
Copy-Item $env:VCToolsRedistDir\x64\Microsoft.VC143.CRT\vcruntime140_1.dll
} else {
# On debug builds, the libraries above are included automatically, so we only need 'urtcbased.dll'.
Copy-Item $env:WindowsSdkBinPath\x64\ucrt\ucrtbased.dll
}
- name: Upload artifacts (${{ matrix.build-type }})
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: ${{ steps.vars.outputs.artifact_name }}-${{ runner.os }}-${{ matrix.build-type }}
path: build\bin
installer:
name: Installer
needs: build-aqtinstall
runs-on: windows-2025
steps:
- name: Checkout code to grab the ISS script
uses: actions/checkout@v4
- name: Download build artifacts from previous job
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: '*Windows*'
- name: Ensure a x64 Qt 6 build is present
run: |
Set-Location artifacts
$x64_build = Get-ChildItem -Filter '*Qt6*-x64-Windows-release' -Attributes Directory |
Sort-Object -Property @{Expression = "Name"; Descending = $true} |
Select-Object -First 1
if (!$x64_build) {
Throw 'Could not find a x64 Qt 6 build.'
}
Move-Item $x64_build Notes64
- name: Install latest Inno Setup
run: |
# Only installs if Inno Setup's Compiler (ISCC.exe) is not already in the PATH environment variable.
if (-Not (Get-Command ISCC -ErrorAction SilentlyContinue)) {
winget install --id JRSoftware.InnoSetup --exact --silent --source winget
# Add to PATH
Add-Content $env:GITHUB_PATH "$env:LOCALAPPDATA\Programs\Inno Setup 6"
}
- name: Create installer
run: |
Set-Location artifacts
Copy-Item ..\packaging\windows\Notes_Inno_Script_Github.iss
$env:APP_VERSION = '${{ needs.build-aqtinstall.outputs.version }}'
iscc /Oinstaller Notes_Inno_Script_Github.iss
# This step makes sure that all files copied by windeployqt are also included in the final installer.
# This is done by parsing the 'Set-Manifest.txt' file, which is generated by Inno Setup:
# https://jrsoftware.org/ishelp/index.php?topic=setup_outputmanifestfile
- name: Verify installer files
run: |
Set-Location artifacts
$inno_setup_manifest = ".\installer\Setup-Manifest.txt"
$windeployqt_paths = @(".\Notes64")
$inno_setup_files = @()
Get-Content -LiteralPath $inno_setup_manifest -ErrorAction Stop | Select-Object -Skip 1 | Foreach-Object {
$path = ($_ -Split "\t")[1] # We only need the second column, which refers to the absolute path of the file.
$inno_setup_files += (Resolve-Path $path).ToString()
}
$missing_files = 0
Get-ChildItem -File -LiteralPath $windeployqt_paths -Recurse -ErrorAction Stop | Foreach-Object {
$path = (Resolve-Path $_).ToString()
if ($path -NotIn $inno_setup_files) {
Write-Host "File '$path' was not included in Inno Setup's list of files." -ForegroundColor Yellow
$missing_files++
}
}
if ($missing_files -gt 0) {
$is_plural = $missing_files -gt 1
Write-Host ""
Write-Host ("ERROR: {0} {1} previously copied by windeployqt {2} missing from Inno Setup's list of files." `
-F $missing_files, ($is_plural ? "files" : "file"), ($is_plural ? "are" : "is")) `
-ForegroundColor DarkRed
Write-Host (" Did you forget to include {0} in '.\packaging\windows\Notes_Inno_Script_Github.iss'?" `
-F ($is_plural ? "them" : "it")) `
-ForegroundColor DarkRed
Exit 1
}
Write-Host "SUCCESS: List of files in the installer matches the ones copied by windeployqt."
- name: Upload installer artifact
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: NotesSetup_${{ needs.build-aqtinstall.outputs.version }}-${{ runner.os }}-release
path: artifacts\installer