-
-
Notifications
You must be signed in to change notification settings - Fork 90
185 lines (167 loc) · 7.01 KB
/
Copy pathvc3d-windows.yml
File metadata and controls
185 lines (167 loc) · 7.01 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
name: VC3D Windows Installer
run-name: VC3D Windows ${{ github.event_name }} ${{ inputs.request_id || github.sha }}
# Compiles VC3D natively on Windows under MSYS2/UCRT64 for PRs. Main, release,
# and manual runs also produce and smoke-test a self-contained NSIS installer
# (+ ZIP) with all DLLs and Qt plugins bundled. Published-release installers
# are attached to the GitHub release for Windows 10/11 users.
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'volume-cartographer/**'
- '.github/workflows/vc3d-windows.yml'
push:
branches: [main]
release:
types: [published]
workflow_dispatch:
inputs:
commit_sha:
description: Commit to package (defaults to the selected workflow ref)
required: false
type: string
request_id:
description: Optional caller correlation ID
required: false
type: string
permissions:
contents: read
packages: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# A newer PR/main commit supersedes the older build, but release and manual
# packaging runs must finish once started.
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}
jobs:
build-windows:
name: ${{ github.event_name == 'pull_request' && 'Compile' || 'Build + package' }} (MSYS2 UCRT64)
runs-on: windows-latest
timeout-minutes: 150
env:
SCCACHE_GHA_ENABLED: 'true'
SCCACHE_IGNORE_SERVER_IO_ERROR: '1'
SCCACHE_C_CUSTOM_CACHE_BUSTER: vc3d-windows-ucrt64-mingw-deps-d84dfa07
defaults:
run:
shell: C:\msys64\usr\bin\bash.exe -leo pipefail {0}
working-directory: volume-cartographer
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.commit_sha || github.sha }}
- uses: actions/checkout@v4
with:
repository: ScrollPrize/vc3d-deps
ref: d84dfa0745dd2debbcec2126117878b241ffdb7f
path: vc3d-deps
- uses: oras-project/setup-oras@v1
- name: Restore prebuilt MSYS2 dependencies
shell: pwsh
working-directory: ${{ github.workspace }}
env:
GHCR_TOKEN: ${{ github.token }}
run: |
$env:GHCR_TOKEN | oras login ghcr.io -u '${{ github.actor }}' --password-stdin
oras pull ghcr.io/scrollprize/vc3d-deps/windows:sha-d84dfa0745dd2debbcec2126117878b241ffdb7f -o $env:RUNNER_TEMP
& "$env:GITHUB_WORKSPACE\vc3d-deps\windows\restore.ps1" `
-Archive "$env:RUNNER_TEMP\vc3d-windows-ucrt64.7z"
- name: Set up shared compiler cache
uses: mozilla-actions/sccache-action@v0.0.10
with:
version: v0.15.0
- name: Reset compiler cache statistics
run: '"${SCCACHE_PATH}" --zero-stats'
- name: Configure
run: >-
cmake --preset ci-windows-mingw
-DVC_USE_SCCACHE=ON
-DSCCACHE_PROGRAM="${SCCACHE_PATH}"
- name: Build
run: ninja -C build/ci-windows-mingw
- name: Report compiler cache statistics
if: always()
run: '"${SCCACHE_PATH}" --show-stats'
- name: Package (NSIS installer + ZIP)
if: github.event_name != 'pull_request'
run: |
cd build/ci-windows-mingw
cpack -V
ls -la *.exe *.zip
- name: Upload installer artifact
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v4
with:
name: VC3D-windows-installer
path: |
volume-cartographer/build/ci-windows-mingw/VC3D-*-win64.exe
volume-cartographer/build/ci-windows-mingw/VC3D-*-win64.zip
if-no-files-found: error
# Prove the package is self-contained: unpack the ZIP and run binaries
# from plain PowerShell (no MSYS2 on PATH), so any DLL missing from the
# bundle fails loudly here instead of on a user's machine.
- name: Smoke test packaged tree
if: github.event_name != 'pull_request'
shell: pwsh
timeout-minutes: 10
working-directory: volume-cartographer/build/ci-windows-mingw
run: |
$zip = Get-Item VC3D-*-win64.zip
Expand-Archive $zip.FullName -DestinationPath smoke
$exe = Get-ChildItem smoke -Recurse -Filter VC3D.exe | Select-Object -First 1
$bin = $exe.DirectoryName
Write-Host "bundle bin dir: $bin"
# Console CLI tool: loads the vc_core/OpenCV/Ceres DLL closure.
# No-args prints usage and exits 1; anything else means load failure.
& "$bin\vc_tifxyz_trim.exe"
$trimExitCode = $LASTEXITCODE
if ($trimExitCode -notin 0,1) { throw "vc_tifxyz_trim failed to start (exit $trimExitCode)" }
Write-Host "vc_tifxyz_trim OK (exit $trimExitCode)"
# Start-Process below does not update $LASTEXITCODE. Clear the
# accepted usage exit so the Actions pwsh wrapper does not fail the
# step with this stale value after all smoke checks have passed.
$global:LASTEXITCODE = 0
# A deployed Windows Qt application uses platforms/qwindows.dll.
# Check it explicitly, then force that native backend so this probes
# the same platform plugin users will load. Do not force Qt's
# offscreen test backend: windeployqt does not deploy it for this app,
# and a GUI-subsystem Qt plugin-load error can block in a modal dialog.
$qwindows = Join-Path $bin "platforms\qwindows.dll"
if (-not (Test-Path $qwindows -PathType Leaf)) {
throw "Packaged Qt Windows platform plugin is missing: $qwindows"
}
$env:QT_QPA_PLATFORM = "windows"
# GUI-subsystem exe, so wait via Start-Process and check the exit
# code. Bound the process itself so a GUI-loop regression fails
# promptly instead of consuming the entire job-step timeout.
$p = Start-Process -FilePath $exe.FullName -ArgumentList "--version" -PassThru -NoNewWindow
try {
Wait-Process -Id $p.Id -Timeout 60 -ErrorAction Stop
} catch {
Stop-Process -Id $p.Id -Force -ErrorAction SilentlyContinue
throw "VC3D --version did not exit within 60 seconds"
}
if ($p.ExitCode -ne 0) { throw "VC3D --version failed (exit $($p.ExitCode))" }
Write-Host "VC3D --version OK"
release-windows:
name: Attach Windows package to release
if: github.event_name == 'release'
needs: build-windows
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
actions: read
contents: write
steps:
- name: Download installer artifact
uses: actions/download-artifact@v4
with:
name: VC3D-windows-installer
path: release-assets
- name: Attach installer to release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload "${{ github.event.release.tag_name }}" \
release-assets/VC3D-*-win64.exe \
release-assets/VC3D-*-win64.zip \
--clobber