Fix grid #234
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| 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 }} |