Repository navigation
364 lines (335 loc) · 13 KB
/
Copy pathbuild.yml
File metadata and controls
364 lines (335 loc) · 13 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
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
# SPDX-FileCopyrightText: Team OpenVPI
# SPDX-License-Identifier: Apache-2.0
name: Build
on:
workflow_call:
inputs:
source_sha:
required: true
type: string
build_type:
required: true
type: string
version_identifier:
required: false
type: string
default: ''
use_cache:
required: false
type: boolean
default: true
use_ccache:
required: false
type: boolean
default: true
outputs:
semver:
value: ${{ jobs.Prepare.outputs.semver }}
tag:
value: ${{ jobs.Prepare.outputs.tag }}
application_name:
value: ${{ jobs.Prepare.outputs.application_name }}
defaults:
run:
shell: pwsh
jobs:
Prepare:
runs-on: ubuntu-latest
outputs:
semver: ${{ steps.prepare.outputs.semver }}
tag: ${{ steps.prepare.outputs.tag }}
application_name: ${{ steps.prepare.outputs.application_name }}
version_identifier: ${{ steps.prepare.outputs.version_identifier }}
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
ref: ${{ inputs.source_sha }}
- name: Prepare build version
id: prepare
uses: diffscope/catalogs/actions/nightly@main
with:
operation: prepare
source-sha: ${{ inputs.source_sha }}
build-type: ${{ inputs.build_type }}
version-identifier: ${{ inputs.version_identifier }}
Build:
needs: Prepare
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- os: windows-2025
platform: Windows
arch: amd64
- os: ubuntu-24.04
platform: Linux
arch: amd64
- os: macos-15
platform: macOS
arch: arm64
runs-on: ${{ matrix.os }}
env:
QT_VERSION: 6.11.2
VCPKG_DISABLE_METRICS: '1'
INNOSETUP_REF: is-6_5_4
DSSP_CHANNEL: nightly
DSSP_VERSION: 0.1.0-nightly.20261113.1
DSPM_CHANNEL: nightly
DSPM_VERSION: 0.1.0-nightly.20261021.1
MACOSX_DEPLOYMENT_TARGET: '13.3'
BUILD_DIR: ${{ github.workspace }}/build/build
INSTALL_DIR: ${{ github.workspace }}/build/install
CCACHE_DIR: ${{ github.workspace }}/build/ccache
CCACHE_MAXSIZE: '0'
CCACHE_KEY_PREFIX: ccache-${{ matrix.os }}-${{ matrix.arch }}-
BUILD_TYPE: ${{ inputs.build_type }}
VERSION_IDENTIFIER: ${{ needs.Prepare.outputs.version_identifier }}
EXPECTED_SEMVER: ${{ needs.Prepare.outputs.semver }}
ARTIFACT_PLATFORM: ${{ matrix.platform }}
ARTIFACT_ARCH: ${{ matrix.arch }}
USE_CCACHE: ${{ inputs.use_cache && inputs.use_ccache }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.source_sha }}
submodules: recursive
# The checkout of a commit detaches HEAD, and the build information then records the branch
# as unknown. A local branch at the same commit, named after the branch that triggered the
# run, gives the build information its name.
- name: Name the branch of the checkout
env:
SOURCE_BRANCH: ${{ github.head_ref || github.ref_name }}
run: git checkout -B $env:SOURCE_BRANCH
- name: Initialize building environment
uses: ./.github/actions/initialize-build-environment
with:
qt_version: ${{ env.QT_VERSION }}
use_cache: ${{ inputs.use_cache }}
use_ccache: ${{ inputs.use_cache && inputs.use_ccache }}
- name: Download dspm
id: download_dspm
uses: diffscope/catalogs/actions/download-product@main
with:
product: dspm
channel: ${{ env.DSPM_CHANNEL }}
version: ${{ env.DSPM_VERSION }}
platform: ${{ matrix.platform }}
arch: ${{ matrix.arch }}
variant: standalone
directory: ${{ runner.temp }}/dspm-download
fail-on-no-match: 'true'
cache: ${{ inputs.use_cache }}
- name: Download dssp
id: download_dssp
uses: diffscope/catalogs/actions/download-product@main
with:
product: dssp
channel: ${{ env.DSSP_CHANNEL }}
version: ${{ env.DSSP_VERSION }}
platform: ${{ matrix.platform }}
arch: ${{ matrix.arch }}
variant: portable
directory: ${{ runner.temp }}/dssp-download
fail-on-no-match: 'true'
cache: ${{ inputs.use_cache }}
- name: Extract dssp
if: steps.download_dssp.outputs.matched == 'true'
env:
DSSP_ARCHIVE: ${{ steps.download_dssp.outputs.path }}
run: |
$ErrorActionPreference = 'Stop'
$extractionDirectory = Join-Path $env:RUNNER_TEMP ("dssp-" + [guid]::NewGuid())
New-Item -ItemType Directory -Path $extractionDirectory | Out-Null
if ($IsWindows) {
Expand-Archive -LiteralPath $env:DSSP_ARCHIVE -DestinationPath $extractionDirectory
} else {
& /usr/bin/tar -xJf $env:DSSP_ARCHIVE -C $extractionDirectory
if ($LASTEXITCODE -ne 0) {
throw 'dssp artifact extraction failed'
}
}
$dsspDirectory = Join-Path $extractionDirectory 'dssp_nightly'
$executable = Join-Path $dsspDirectory ($IsWindows ? 'bin/dssp.exe' : 'bin/dssp')
if (-not (Test-Path -LiteralPath $executable -PathType Leaf)) {
throw 'The dssp artifact does not contain the expected executable'
}
"DSSP_DIRECTORY=$dsspDirectory" >> $env:GITHUB_ENV
- name: Initialize Vcpkg
id: vcpkg
uses: stdware/dev-scripts/actions/vcpkg-workspace@main
env:
VCPKG_KEEP_ENV_VARS: VCPKG_BUILD_TYPE;MACOSX_DEPLOYMENT_TARGET
with:
qt-dir: ${{ env.QT_ROOT_DIR }}
cache: ${{ inputs.use_cache }}
- name: Restore CCache cache
if: inputs.use_cache && inputs.use_ccache
uses: actions/cache/restore@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ env.CCACHE_KEY_PREFIX }}${{ github.run_id }}-${{ github.run_attempt }}
restore-keys: ${{ env.CCACHE_KEY_PREFIX }}
- name: Prepare CCache
id: ccache_prepare
if: inputs.use_cache && inputs.use_ccache
run: ./scripts/ci/Manage-CCache.ps1 -Operation prepare
- name: Build
env:
DSPM_EXECUTABLE: ${{ steps.download_dspm.outputs.path }}
VCPKG_ROOT_DIR: ${{ steps.vcpkg.outputs.vcpkg-root }}
run: |
$expectedRunnerArch = $env:ARTIFACT_ARCH -eq 'amd64' ? 'X64' : 'ARM64'
if ($env:RUNNER_ARCH -ne $expectedRunnerArch) {
throw "Unexpected runner architecture: $env:RUNNER_ARCH"
}
$output = & ./scripts/ci/Build.ps1 `
-BuildType $env:BUILD_TYPE `
-VcpkgRootDir $env:VCPKG_ROOT_DIR `
-BuildDir $env:BUILD_DIR `
-InstallDir $env:INSTALL_DIR `
-VersionIdentifier $env:VERSION_IDENTIFIER `
-DsspDirectory $env:DSSP_DIRECTORY `
-DspmExecutable $env:DSPM_EXECUTABLE `
-ArtifactPlatform $env:ARTIFACT_PLATFORM `
-ArtifactArchitecture $env:ARTIFACT_ARCH `
-CCache:($env:USE_CCACHE -eq 'true')
if ($output.Semver -ne $env:EXPECTED_SEMVER) {
throw 'Built application version differs from the reserved version'
}
"ARTIFACT_NAME=$($output.ArtifactFileBase)" >> $env:GITHUB_ENV
"APPLICATION_SEMVER=$($output.Semver)" >> $env:GITHUB_ENV
"APPLICATION_DISPLAY_NAME=$($output.ApplicationDisplayName)" >> $env:GITHUB_ENV
"APPLICATION_NAME=$($output.ApplicationName)" >> $env:GITHUB_ENV
"INSTALLER_FILE_BASE=$($output.InstallerFileBase)" >> $env:GITHUB_ENV
- name: Summarize CCache statistics
if: ${{ !cancelled() && steps.ccache_prepare.outcome == 'success' }}
run: |
$statistics = ccache --show-stats
if ($LASTEXITCODE -ne 0) {
throw 'The ccache statistics could not be read'
}
@(
'### CCache Statistics'
''
'```text'
($statistics -join "`n")
'```'
) >> $env:GITHUB_STEP_SUMMARY
- name: Prepare CCache snapshot
id: ccache_snapshot
if: inputs.use_cache && inputs.use_ccache && github.event_name != 'pull_request' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
run: ./scripts/ci/Manage-CCache.ps1 -Operation snapshot
- name: Save CCache cache
if: steps.ccache_snapshot.outputs.save == 'true'
uses: actions/cache/save@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ env.CCACHE_KEY_PREFIX }}${{ github.run_id }}-${{ github.run_attempt }}
- name: Collect symbol files
env:
VCPKG_ROOT_DIR: ${{ steps.vcpkg.outputs.vcpkg-root }}
run: |
$output = & ./scripts/ci/Collect-Symbol-Files.ps1 `
-VcpkgRootDir $env:VCPKG_ROOT_DIR `
-InstallDir $env:INSTALL_DIR `
-ArchivePath "$($env:ARTIFACT_NAME)_debug_symbols.7z"
"SYMBOL_FILES_PATH=$output" >> $env:GITHUB_ENV
- name: Upload symbol files
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}_debug_symbols.7z
path: ${{ env.SYMBOL_FILES_PATH }}
if-no-files-found: error
overwrite: true
compression-level: 0
- name: Create InnoSetup installer (Windows)
if: runner.os == 'Windows'
run: |
$output = & ./scripts/ci/Pack.ps1 -BuildDir $env:BUILD_DIR -InstallerFileBase $env:INSTALLER_FILE_BASE -InnoSetupCommit $env:INNOSETUP_REF
"INSTALLER_PATH=$($output.Path)" >> $env:GITHUB_ENV
- name: Upload installer (Windows)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: ${{ env.INSTALLER_FILE_BASE }}.exe
path: ${{ env.INSTALLER_PATH }}
if-no-files-found: error
overwrite: true
compression-level: 0
- name: Create portable archive (Windows)
if: runner.os == 'Windows'
run: |
$output = & ./scripts/ci/Create-Portable.ps1 `
-InstallDir $env:INSTALL_DIR `
-ApplicationName $env:APPLICATION_NAME `
-ArchivePath "$($env:ARTIFACT_NAME)_portable.7z"
"PORTABLE_PATH=$output" >> $env:GITHUB_ENV
- name: Upload portable archive (Windows)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}_portable.7z
path: ${{ env.PORTABLE_PATH }}
if-no-files-found: error
overwrite: true
compression-level: 0
- name: Create AppImage (Linux)
if: runner.os == 'Linux'
env:
ARCH: x86_64
run: |
$output = & ./scripts/ci/Create-AppImage.ps1 `
-InstallDir $env:INSTALL_DIR `
-ApplicationName $env:APPLICATION_NAME `
-AppImageToolPath $env:APPIMAGETOOL_PATH `
-RuntimePath $env:APPIMAGE_RUNTIME_PATH `
-AppImagePath "$($env:ARTIFACT_NAME)_appimage.AppImage"
"APPIMAGE_PATH=$output" >> $env:GITHUB_ENV
- name: Upload AppImage (Linux)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}_appimage.AppImage
path: ${{ env.APPIMAGE_PATH }}
if-no-files-found: error
overwrite: true
compression-level: 0
- name: Create portable archive (Linux)
if: runner.os == 'Linux'
run: |
$output = & ./scripts/ci/Create-Portable.ps1 `
-InstallDir $env:INSTALL_DIR `
-ApplicationName $env:APPLICATION_NAME `
-ArchivePath "$($env:ARTIFACT_NAME)_portable.tar.xz"
"PORTABLE_PATH=$output" >> $env:GITHUB_ENV
- name: Upload portable archive (Linux)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}_portable.tar.xz
path: ${{ env.PORTABLE_PATH }}
if-no-files-found: error
overwrite: true
compression-level: 0
- name: Create DMG installer (macOS)
if: runner.os == 'macOS'
run: |
$output = & ./scripts/ci/Create-DMG.ps1 `
-AppPath (Join-Path $env:INSTALL_DIR "$($env:APPLICATION_NAME).app") `
-Semver $env:APPLICATION_SEMVER `
-ApplicationDisplayName $env:APPLICATION_DISPLAY_NAME `
-InstallerFileBase $env:INSTALLER_FILE_BASE
"DMG_PATH=$output" >> $env:GITHUB_ENV
- name: Upload DMG installer (macOS)
if: runner.os == 'macOS'
uses: actions/upload-artifact@v4
with:
name: ${{ env.INSTALLER_FILE_BASE }}.dmg
path: ${{ env.DMG_PATH }}
if-no-files-found: error
overwrite: true
compression-level: 0