Repository navigation
273 lines (249 loc) · 11 KB
/
Copy pathbuild.yml
File metadata and controls
273 lines (249 loc) · 11 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
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
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
inputs:
package_artifacts:
description: Build installer and symbol archives
required: true
type: boolean
default: true
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: pwsh
env:
BUILD_CONFIGURATION: Release
BUILD_PLATFORM: x64
VCPKG_ROOT: C:\vcpkg
VCPKG_COMMIT: 617ef1c0c422737d117eda00a471ea1be5bad088
VCPKG_DEFAULT_TRIPLET: x64-windows-static
VCPKG_FORCE_DOWNLOADED_BINARIES: "1"
VCPKG_INSTALLED_DIR: ${{ github.workspace }}\vcpkg_installed
VCPKG_OVERLAY_TRIPLETS: ${{ github.workspace }}\.github\vcpkg-triplets
VCPKG_DOWNLOADS: ${{ github.workspace }}\.ci-cache\vcpkg-downloads
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}\.ci-cache\vcpkg-binary-cache
VCPKG_BINARY_SOURCES: clear;files,${{ github.workspace }}\.ci-cache\vcpkg-binary-cache,readwrite
jobs:
build:
name: build
runs-on: windows-2025-vs2026
timeout-minutes: 60
steps:
- name: Checkout source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Prepare Python tools
uses: ./.github/actions/prepare-python
- name: Read product version
id: version
run: |
[xml]$props = Get-Content -LiteralPath "Common\Version.props" -Raw
$nodes = @($props.SelectNodes("/*[local-name()='Project']/*[local-name()='PropertyGroup']/*[local-name()='OpenGlassProductVersion']"))
if ($nodes.Count -ne 1) {
throw "Expected exactly one OpenGlassProductVersion, found $($nodes.Count)."
}
$version = $nodes[0].InnerText.Trim()
if ($version -notmatch '^\d+\.\d+\.\d+\.\d+$') {
throw "OpenGlassProductVersion has an invalid format: $version"
}
$artifactName = "v$version-unsigned"
$themeExtensionArtifactName = "v$version-theme-extension-unsigned"
"version=$version" >> $env:GITHUB_OUTPUT
"artifact_name=$artifactName" >> $env:GITHUB_OUTPUT
"theme_extension_artifact_name=$themeExtensionArtifactName" >> $env:GITHUB_OUTPUT
@"
## OpenGlass CI
- Version: ``$version``
- Installer artifact (when enabled): ``$artifactName``
- Theme extension artifact: ``$themeExtensionArtifactName``
- Signing: unsigned build
"@ >> $env:GITHUB_STEP_SUMMARY
- name: Prepare Windows build
uses: ./.github/actions/prepare-build
- name: Build solution
run: |
$PSNativeCommandUseErrorActionPreference = $true
New-Item -ItemType Directory -Force -Path "MSBuild_Logs" | Out-Null
msbuild OpenGlass.slnx /m `
/p:Configuration=$env:BUILD_CONFIGURATION `
/p:Platform=$env:BUILD_PLATFORM `
/p:VcpkgEnableManifest=true `
/p:VcpkgManifestInstall=false `
/p:VcpkgAutoBootstrap=false `
/p:VcpkgRoot=$env:VCPKG_ROOT `
/p:VcpkgInstalledDir=$env:VCPKG_INSTALLED_DIR `
/p:VcpkgTriplet=$env:VCPKG_DEFAULT_TRIPLET `
/p:ForceImportBeforeCppProps=$env:VCPKG_ROOT\scripts\buildsystems\msbuild\vcpkg.props `
/p:ForceImportAfterCppTargets=$env:VCPKG_ROOT\scripts\buildsystems\msbuild\vcpkg.targets `
/p:OpenGlassInstallerEnabled=false `
/bl:MSBuild_Logs/build.binlog
- name: Verify build outputs
run: |
$buildRoot = "Build\$env:BUILD_PLATFORM\$env:BUILD_CONFIGURATION"
$expected = @(
"$buildRoot\legacy\OpenGlass.dll",
"$buildRoot\milcomp\OpenGlass.dll",
"$buildRoot\common\OpenGlassHost.exe",
"$buildRoot\common\OpenGlassGUI.exe",
"$buildRoot\common\OpenGlassThemeExtension.dll",
"$buildRoot\common\OpenGlassThemeExtension.pdb",
"$buildRoot\common\OpenGlassTests.exe",
"$buildRoot\common\OpenGlassRenderTest.exe"
)
foreach ($path in $expected) {
$item = Get-Item -LiteralPath $path -ErrorAction Stop
if ($item.Length -eq 0) {
throw "Build output is empty: $path"
}
}
$extension = "$buildRoot\common\OpenGlassThemeExtension.dll"
$signature = Get-AuthenticodeSignature -LiteralPath $extension
if ($signature.Status -ne [System.Management.Automation.SignatureStatus]::NotSigned) {
throw "Expected an unsigned theme extension, but $extension has signature status $($signature.Status)."
}
- name: Locate packaging tools
id: packaging_tools
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.package_artifacts == true)
run: |
$PSNativeCommandUseErrorActionPreference = $true
$iscc = Get-Command ISCC.exe -ErrorAction SilentlyContinue
if ($iscc) {
"iscc=$($iscc.Source)" >> $env:GITHUB_OUTPUT
}
else {
"Installer and symbol packaging skipped: ISCC.exe is unavailable." >> $env:GITHUB_STEP_SUMMARY
}
- name: Package unsigned installer and symbols
if: steps.packaging_tools.outputs.iscc != ''
env:
OPENGLASS_ISCC: ${{ steps.packaging_tools.outputs.iscc }}
run: |
$PSNativeCommandUseErrorActionPreference = $true
$arguments = @(
"Scripts\OpenGlass.Packaging.proj",
"/m",
"/p:Configuration=$env:BUILD_CONFIGURATION",
"/p:Platform=$env:BUILD_PLATFORM",
"/p:BuildDependencies=false",
"/p:OpenGlassIsccTool=$env:OPENGLASS_ISCC"
)
& msbuild @arguments
if ($LASTEXITCODE -ne 0) {
throw "Packaging failed with exit code $LASTEXITCODE."
}
- name: Verify unsigned packages
if: steps.packaging_tools.outputs.iscc != ''
run: |
Add-Type -AssemblyName System.IO.Compression.FileSystem
$buildRoot = "Build\$env:BUILD_PLATFORM\$env:BUILD_CONFIGURATION"
$artifacts = @(
"$buildRoot\OpenGlassSetup.exe",
"$buildRoot\OpenGlassSymbols.zip"
)
foreach ($path in $artifacts) {
$item = Get-Item -LiteralPath $path -ErrorAction Stop
if ($item.Length -eq 0) {
throw "Package output is empty: $path"
}
}
$obsoletePackages = @(
"$buildRoot\OpenGlassSetup.Legacy.exe",
"$buildRoot\OpenGlassSetup.MILComp.exe",
"$buildRoot\OpenGlassSymbols.Legacy.zip",
"$buildRoot\OpenGlassSymbols.MILComp.zip"
)
foreach ($path in $obsoletePackages) {
if (Test-Path -LiteralPath $path) {
throw "Obsolete architecture-specific package was produced: $path"
}
}
$stagedDlls = @(
@{ Path = "Cache\Packaging\$env:BUILD_CONFIGURATION\signed\legacy\OpenGlass.dll"; Architecture = "Legacy" },
@{ Path = "Cache\Packaging\$env:BUILD_CONFIGURATION\signed\milcomp\OpenGlass.dll"; Architecture = "MILComp" }
)
foreach ($stagedDll in $stagedDlls) {
$description = (Get-Item -LiteralPath $stagedDll.Path -ErrorAction Stop).VersionInfo.FileDescription
if ($description -notlike "*($($stagedDll.Architecture))") {
throw "Unexpected architecture in $($stagedDll.Path): $description"
}
}
$zipPath = "$buildRoot\OpenGlassSymbols.zip"
$expectedPdbs = @(
"legacy/OpenGlass.pdb",
"milcomp/OpenGlass.pdb",
"OpenGlassGUI.pdb",
"OpenGlassHost.pdb"
) | Sort-Object
$archive = [IO.Compression.ZipFile]::OpenRead((Resolve-Path -LiteralPath $zipPath))
try {
$entries = @($archive.Entries)
$actualNames = @($entries.FullName | Sort-Object)
$differences = @(Compare-Object -ReferenceObject $expectedPdbs -DifferenceObject $actualNames)
if ($differences.Count -ne 0 -or $entries.Count -ne $expectedPdbs.Count) {
throw "Unexpected contents in $zipPath`: $($actualNames -join ', ')"
}
foreach ($entry in $entries) {
if ($entry.Length -eq 0) {
throw "Symbol archive entry is empty: $zipPath/$($entry.FullName)"
}
}
}
finally {
$archive.Dispose()
}
$unsignedExecutables = @(
"$buildRoot\legacy\OpenGlass.dll",
"$buildRoot\milcomp\OpenGlass.dll",
"$buildRoot\common\OpenGlassHost.exe",
"$buildRoot\common\OpenGlassGUI.exe",
"$buildRoot\OpenGlassSetup.exe"
)
foreach ($path in $unsignedExecutables) {
$signature = Get-AuthenticodeSignature -LiteralPath $path
if ($signature.Status -ne [System.Management.Automation.SignatureStatus]::NotSigned) {
throw "Expected an unsigned file, but $path has signature status $($signature.Status)."
}
}
- name: Verify source tree remains unchanged
run: |
$PSNativeCommandUseErrorActionPreference = $true
git diff --exit-code
- name: Upload unsigned theme extension
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: ${{ steps.version.outputs.theme_extension_artifact_name }}
path: |
Build/${{ env.BUILD_PLATFORM }}/${{ env.BUILD_CONFIGURATION }}/common/OpenGlassThemeExtension.dll
Build/${{ env.BUILD_PLATFORM }}/${{ env.BUILD_CONFIGURATION }}/common/OpenGlassThemeExtension.pdb
if-no-files-found: error
retention-days: 7
- name: Upload unsigned packages
if: steps.packaging_tools.outputs.iscc != ''
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: ${{ steps.version.outputs.artifact_name }}
compression-level: 0 # The installer and symbol ZIP are already compressed.
path: |
Build/${{ env.BUILD_PLATFORM }}/${{ env.BUILD_CONFIGURATION }}/OpenGlassSetup.exe
Build/${{ env.BUILD_PLATFORM }}/${{ env.BUILD_CONFIGURATION }}/OpenGlassSymbols.zip
if-no-files-found: error
retention-days: 7
- name: Upload MSBuild binary log on failure
if: failure() && hashFiles('MSBuild_Logs/build.binlog') != ''
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: msbuild-build-${{ github.run_id }}
path: MSBuild_Logs/build.binlog
if-no-files-found: ignore
retention-days: 7