-
Notifications
You must be signed in to change notification settings - Fork 1
298 lines (298 loc) · 12 KB
/
release-app.yml
File metadata and controls
298 lines (298 loc) · 12 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
---
name: Release Application
on:
release:
types: [published]
push:
branches: [main]
tags:
- 'v*'
pull_request:
branches: ["*"]
workflow_dispatch:
permissions:
contents: write
packages: write
env:
# Binary cache stored in this repo's GitHub Packages (NuGet) feed. The
# previous `x-gha` backend was removed by vcpkg in 2025 and also capped at
# 10 GB per repo, causing constant cache eviction/thrashing with Qt+GDAL.
# GitHub Packages on a public repo has no practical storage limit.
VCPKG_BINARY_SOURCES: "clear;nuget,GitHub,readwrite"
jobs:
package-windows:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
arch: [x64, arm64]
include:
- arch: x64
triplet: x64-windows
os: windows-latest
- arch: arm64
triplet: arm64-windows
os: windows-11-arm
env:
VCPKG_TARGET_TRIPLET: ${{ matrix.triplet }}
steps:
- uses: actions/checkout@v4
- name: Get version from tag
id: version
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'release'
run: |
if ($env:GITHUB_EVENT_NAME -eq 'release') {
$tag = $env:GITHUB_EVENT_RELEASE_TAG_NAME -replace '^v', ''
} else {
$tag = $env:GITHUB_REF -replace 'refs/tags/v', ''
}
echo "version=$tag" >> $env:GITHUB_OUTPUT
echo "Version: $tag"
- name: Cache NSIS
id: nsis-cache
uses: actions/cache@v4
with:
path: 'C:\Program Files (x86)\NSIS'
key: nsis-3.11-${{ runner.os }}
- name: Install NSIS
if: steps.nsis-cache.outputs.cache-hit != 'true'
run: choco install nsis -y
- name: Add NSIS to PATH
run: echo "C:\Program Files (x86)\NSIS" >> $env:GITHUB_PATH
- name: Configure vcpkg binary cache (GitHub Packages NuGet)
shell: pwsh
run: |
# Locate a vcpkg.exe so we can use its bundled nuget. The
# runner-provided VCPKG_INSTALLATION_ROOT works; our project's
# FetchContent-managed vcpkg hasn't bootstrapped yet at this point.
$vcpkg = Join-Path $env:VCPKG_INSTALLATION_ROOT 'vcpkg.exe'
if (-not (Test-Path $vcpkg)) {
Write-Error "vcpkg.exe not found at $vcpkg (VCPKG_INSTALLATION_ROOT=$env:VCPKG_INSTALLATION_ROOT)"
exit 1
}
$nuget = (& $vcpkg fetch nuget | Select-Object -Last 1).Trim()
if (-not (Test-Path -LiteralPath $nuget)) {
Write-Error "vcpkg fetch nuget did not return a valid path: $nuget"
exit 1
}
# vcpkg invokes `nuget` from PATH; runners often have Chocolatey's nuget
# first, which uses a different config — restores fail and pushes get 403.
# Append after NSIS so this directory is last in GITHUB_PATH (highest PATH
# precedence on Windows runners).
$nugetDir = Split-Path -LiteralPath $nuget
Add-Content -Path $env:GITHUB_PATH -Value $nugetDir
# GITHUB_PATH / GITHUB_ENV are unreliable once MSVC sets PATH; Configure/Build
# steps re-fetch this directory and prepend to PATH before cmake (see below).
$owner = '${{ github.repository_owner }}'
$feed = "https://nuget.pkg.github.com/$owner/index.json"
& $nuget sources add `
-Source $feed `
-StorePasswordInClearText `
-Name GitHub `
-UserName $owner `
-Password '${{ secrets.GITHUB_TOKEN }}'
& $nuget setapikey '${{ secrets.GITHUB_TOKEN }}' -Source $feed
- name: Set up MSVC dev cmd
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Configure
shell: pwsh
run: |
$vcpkgHost = Join-Path $env:VCPKG_INSTALLATION_ROOT 'vcpkg.exe'
$nugetExe = (& $vcpkgHost fetch nuget | Select-Object -Last 1).Trim()
$nugetShimDir = Join-Path $env:RUNNER_TEMP 'blaze-vcpkg-nuget'
New-Item -ItemType Directory -Force -Path $nugetShimDir | Out-Null
Copy-Item -LiteralPath $nugetExe -Destination (Join-Path $nugetShimDir 'nuget.exe') -Force
$env:PATH = "$nugetShimDir;$env:PATH"
$cmakeArgs = @(
"-DVCPKG_TARGET_TRIPLET=${{ env.VCPKG_TARGET_TRIPLET }}",
"-DVCPKG_BUILD_TYPE=release",
"-DVCPKG_VERBOSE=ON"
)
if ("${{ steps.version.outputs.version }}" -ne "") {
$cmakeArgs += "-DBLAZE_VERSION=${{ steps.version.outputs.version }}"
}
cmake -B build $cmakeArgs
- name: Build
shell: pwsh
run: |
$vcpkgHost = Join-Path $env:VCPKG_INSTALLATION_ROOT 'vcpkg.exe'
$nugetExe = (& $vcpkgHost fetch nuget | Select-Object -Last 1).Trim()
$nugetShimDir = Join-Path $env:RUNNER_TEMP 'blaze-vcpkg-nuget'
New-Item -ItemType Directory -Force -Path $nugetShimDir | Out-Null
Copy-Item -LiteralPath $nugetExe -Destination (Join-Path $nugetShimDir 'nuget.exe') -Force
$env:PATH = "$nugetShimDir;$env:PATH"
cmake --build build --config Release --parallel
- name: Package (NSIS Installer)
run: |
cd build
cpack -C Release -G NSIS
- name: Debug NSIS Failure
if: failure()
run: |
if (Test-Path "build/_CPack_Packages/win64/NSIS/NSISOutput.log") {
Get-Content "build/_CPack_Packages/win64/NSIS/NSISOutput.log"
}
- name: Install package
run: |
$installer = (Get-Item build/Blaze-*.exe).FullName
Start-Process -Wait -FilePath $installer -ArgumentList '/S', '/D=C:\BlazeTest'
- name: Test installed package
run: |
Copy-Item -Recurse C:\BlazeTest\share\assets $env:TEMP\blaze-test
& C:\BlazeTest\bin\blaze-cli.exe $env:TEMP\blaze-test\default_config.json
# Skip on PRs and push-to-main to stay under the 0.5 GB Actions storage
# quota — installers are ~200 MB each and 4 platforms × every push fills
# the quota in a day. Tag builds publish to the GitHub Release (separate,
# unlimited storage on public repos), and workflow_dispatch keeps a
# short-retention artifact for manual debug runs.
- name: Upload Artifact
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: blaze-windows-${{ matrix.arch }}-installer
path: build/Blaze-*.exe
retention-days: 2
- name: Upload to Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
token: ${{ secrets.BLAZE_RELEASE_TOKEN }}
files: build/Blaze-*.exe
package-linux:
strategy:
fail-fast: false
matrix:
include:
- arch: x64
runner: ubuntu-22.04
- arch: arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- name: Get version from tag
id: version
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'release'
run: |
if [ "$GITHUB_EVENT_NAME" = "release" ]; then
TAG=${GITHUB_EVENT_RELEASE_TAG_NAME#v}
else
TAG=${GITHUB_REF#refs/tags/v}
fi
echo "version=$TAG" >> $GITHUB_OUTPUT
echo "Version: $TAG"
- name: Install dependencies
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: libgdal-dev libopencv-dev cmake libomp-dev rpm qt6-base-dev libglx-dev
libgl1-mesa-dev qt6-image-formats-plugins libqt6svg6-dev ccache mold ninja-build
version: 1.1
execute_install_scripts: true
# Install LAPACK/BLAS directly (not via cache) because liblapack.so.3 and
# libblas.so.3 are update-alternatives-managed symlinks; cache-apt-pkgs-action
# restores package files but does not run update-alternatives triggers, so the
# .so.3 symlinks are missing when restored from cache (breaks linking on arm64).
- name: Install LAPACK/BLAS
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
liblapack-dev libblas-dev liblapack3 libblas3
sudo ldconfig
- name: Verify LAPACK installation
run: |
ldconfig -p | grep -E 'lapack|blas' \
|| echo "Warning: LAPACK/BLAS not found in library cache"
ls -la /usr/lib/*/liblapack* /usr/lib/*/libblas* 2>/dev/null \
|| echo "Warning: LAPACK/BLAS libraries not found"
- name: Configure
run: |
CMAKE_ARGS=""
if [ -n "${{ steps.version.outputs.version }}" ]; then
CMAKE_ARGS="-DBLAZE_VERSION=${{ steps.version.outputs.version }}"
fi
cmake -B build $CMAKE_ARGS
- name: Build
run: cmake --build build --config Release
- name: Package (DEB)
run: |
cd build
cpack -C Release -G DEB
- name: Install DEB package
run: |
sudo dpkg -i build/Blaze-*.deb || true
sudo apt-get install -f -y
- name: Test installed package
run: |
cp -r /usr/share/assets /tmp/blaze-test
blaze-cli /tmp/blaze-test/default_config.json
# See note on the Windows job — only keep artifacts on tags / debug runs.
- name: Upload Artifact
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: blaze-linux-${{ matrix.arch }}-deb
path: build/Blaze-*.deb
retention-days: 2
- name: Upload to Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
token: ${{ secrets.BLAZE_RELEASE_TOKEN }}
files: build/Blaze-*.deb
package-plugin:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get version from tag
id: version
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'release'
run: |
if [ "$GITHUB_EVENT_NAME" = "release" ]; then
TAG=${GITHUB_EVENT_RELEASE_TAG_NAME#v}
else
TAG=${GITHUB_REF#refs/tags/v}
fi
echo "version=$TAG" >> $GITHUB_OUTPUT
echo "Version: $TAG"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f qgis_plugin/requirements.txt ]; then pip install -r qgis_plugin/requirements.txt; fi
- name: Package Plugin
run: |
cd qgis_plugin
python package_plugin.py
- name: Set plugin zip filename
id: plugin_zip
run: |
cd qgis_plugin
# Find the generated zip file (it will have version in name: blaze_loader_qgis_plugin_v*.zip)
ZIP_FILE=$(ls blaze_loader_qgis_plugin*.zip | head -1)
if [ -z "$ZIP_FILE" ]; then
echo "ERROR: No zip file found"
exit 1
fi
echo "Found zip: $ZIP_FILE"
echo "zip_path=qgis_plugin/$ZIP_FILE" >> $GITHUB_OUTPUT
echo "zip_name=$ZIP_FILE" >> $GITHUB_OUTPUT
# Plugin zip is published to the GitHub Release on tags; skip Actions
# artifact storage except for manual debug runs (see Windows job note).
- name: Upload Artifact
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: blaze-qgis-plugin
path: ${{ steps.plugin_zip.outputs.zip_path }}
retention-days: 2
- name: Upload to Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
token: ${{ secrets.BLAZE_RELEASE_TOKEN }}
files: ${{ steps.plugin_zip.outputs.zip_path }}