use VCPKG_DEFAULT_TRIPLET with -static on windows; turn windows arm64… #243
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: cmake-test | |
| on: | |
| push: | |
| branches: [ "main", "dev", "unstable" ] | |
| tags: [ "*" ] | |
| pull_request: | |
| branches: [ "main", "dev", "unstable" ] | |
| workflow_dispatch: | |
| inputs: | |
| firestarr_ref: | |
| description: 'FireSTARR branch/tag to build' | |
| default: 'main' | |
| type: string | |
| release: | |
| types: [published] | |
| jobs: | |
| cmake-test: | |
| name: firestarr-${{ matrix.os }}-${{ matrix.os-version }}-${{ matrix.target-cpu}}-${{ matrix.target-compiler }}-${{ matrix.variant }} | |
| runs-on: ${{ matrix.os }}-${{ matrix.os-version }}${{ case( matrix.os != 'macos' && matrix.target-cpu == 'arm64', '-arm', '' ) }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [macos, ubuntu, windows] | |
| compiler: [cl, clang++, g++] | |
| target-cpu: [arm64, x64] | |
| variant: [Release] | |
| include: | |
| - os: macos | |
| os-version: 14 | |
| target-os: osx | |
| # HACK: latest doesn't work with -arm | |
| - os: ubuntu | |
| os-version: 24.04 | |
| target-os: linux | |
| # FIX: this is building x64 exe not arm64 | |
| # # HACK: latest doesn't work with -arm | |
| # - os: windows | |
| # target-cpu: arm64 | |
| # os-version: 11 | |
| # target-os: windows | |
| - os: windows | |
| target-cpu: x64 | |
| os-version: latest | |
| target-os: windows | |
| - compiler: clang++ | |
| target-compiler: clang | |
| - compiler: cl | |
| target-compiler: cl | |
| - compiler: g++ | |
| target-compiler: gcc | |
| exclude: | |
| - os: macos | |
| target-cpu: x64 | |
| - os: macos | |
| compiler: cl | |
| - os: macos | |
| compiler: g++ | |
| - os: ubuntu | |
| compiler: cl | |
| - os: windows | |
| compiler: clang++ | |
| - os: windows | |
| compiler: g++ | |
| env: | |
| CXX: ${{ matrix.compiler }} | |
| # HACK: -static makes windows work right now | |
| VCPKG_DEFAULT_TRIPLET: ${{ matrix.target-cpu }}-${{ matrix.target-os }}${{ case ( matrix.os == 'windows', '-static', '' ) }} | |
| VCPKG_DISABLE_METRICS: true | |
| VCPKG_ROOT: ${{ github.workspace }}/vcpkg | |
| VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg/.cache | |
| OUTPUT_BINARY: firestarr-${{ matrix.os }}-${{ matrix.target-cpu}}-${{ matrix.target-compiler }}-${{ matrix.variant }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - uses: ilammy/msvc-dev-cmd@v1 | |
| - uses: friendlyanon/setup-vcpkg@v1 | |
| with: | |
| committish: 2025.12.12 | |
| # getting a warning when cache exists, so just save/restore ourselves | |
| cache: false | |
| - uses: actions/cache@v4 | |
| with: | |
| # vcpkg always builds release, so share cache between debug and release | |
| key: vcpkg-${{ matrix.os }}-${{ matrix.target-cpu}}-${{ matrix.target-compiler }}-${{ hashFiles('vcpkg.json', '.github/vcpkg_overlays/**') }} | |
| path: | | |
| ${{ env.VCPKG_DEFAULT_BINARY_CACHE }} | |
| - run: cmake --preset ${{ matrix.variant }} | |
| - name: Run cmake --build --parallel --preset ${{ matrix.variant }} | |
| run: | | |
| echo "::add-matcher::.github/cmake-problem-matcher.json" | |
| cmake --build --parallel --preset ${{ matrix.variant }} | |
| - run: ./firestarr -h | |
| - run: ctest --output-on-failure --preset ${{ matrix.variant }} | |
| - run: ./firestarr . 2024-06-03 58.81228184403946 -122.9117103995713 01:00 --ffmc 89.9 --dmc 59.5 --dc 450.9 --apcp_prev 0 -v --wx ./test/input/10N_50651/firestarr_10N_50651_wx.csv --output_date_offsets [1] --tz -5 --raster-root ./test/input/10N_50651/ --perim ./test/input/10N_50651/10N_50651.tif | |
| - name: Locate binary (non-windows) | |
| if: ${{ matrix.variant == 'Release' && matrix.os != 'windows' }} | |
| id: locate | |
| run: | | |
| # Find the built executable | |
| BINARY=$(find build -type f -name "firestarr" ${{ case ( matrix.os == 'macos', '-perm +111', '-executable' ) }} | head -1) | |
| if [ -z "$BINARY" ]; then | |
| echo "ERROR: Could not find firestarr binary" | |
| find build -type f ${{ case ( matrix.os == 'macos', '-perm +111', '-executable' ) }} | |
| exit 1 | |
| fi | |
| echo "binary=$BINARY" >> $GITHUB_OUTPUT | |
| echo "Found binary at: $BINARY" | |
| - name: Locate binary (windows) | |
| if: ${{ matrix.variant == 'Release' && matrix.os == 'windows' }} | |
| id: locate-windows | |
| run: | | |
| $BINARY = Get-ChildItem -Path build -Recurse -Filter "firestarr.exe" | Select-Object -First 1 -ExpandProperty FullName | |
| if (-not $BINARY) { | |
| echo "ERROR: Could not find firestarr.exe" | |
| Get-ChildItem -Path build -Recurse -Filter "*.exe" | Select-Object FullName | |
| exit 1 | |
| } | |
| echo "binary=$BINARY" >> $env:GITHUB_OUTPUT | |
| echo "Found binary at: $BINARY" | |
| shell: pwsh | |
| - name: Check binary dependencies (non-windows) | |
| if: ${{ matrix.variant == 'Release' && matrix.os != 'windows' }} | |
| run: | | |
| echo "=== Binary info ===" | |
| file ${{ steps.locate.outputs.binary }} | |
| echo "" | |
| echo "=== Dynamic dependencies ===" | |
| ${{ case ( matrix.os == 'macos', 'otool -L', 'ldd' ) }} ${{ steps.locate.outputs.binary }} || true | |
| - name: Check binary dependencies (windows) | |
| if: ${{ matrix.variant == 'Release' && matrix.os == 'windows' }} | |
| run: | | |
| echo "=== Binary info ===" | |
| Get-Item "${{ steps.locate-windows.outputs.binary }}" | Format-List Name, Length, LastWriteTime | |
| echo "" | |
| echo "=== Binary size ===" | |
| (Get-Item "${{ steps.locate-windows.outputs.binary }}").Length / 1MB | ForEach-Object { "{0:N2} MB" -f $_ } | |
| shell: pwsh | |
| - name: Package artifact (non-windows) | |
| if: ${{ matrix.variant == 'Release' && matrix.os != 'windows' }} | |
| run: | | |
| mkdir -p dist | |
| cp README.md LICENSE ORIGIN.md dist/ | |
| cp ${{ steps.locate.outputs.binary }} dist/firestarr | |
| # Bundle data files if they exist | |
| [ -f fuel.lut ] && cp fuel.lut dist/ | |
| [ -f proj.db ] && cp proj.db dist/ | |
| [ -f settings.ini ] && cp settings.ini dist/ | |
| [ -f data/fuel.lut ] && cp data/fuel.lut dist/ | |
| [ -f data/settings.ini ] && cp data/settings.ini dist/ | |
| # Create version info | |
| ./firestarr -h | head -n1 > dist/VERSION | |
| # List contents | |
| echo "=== Package contents ===" | |
| ls -la dist/ | |
| # Create tarball | |
| tar -czvf ${{ env.OUTPUT_BINARY }}.tar.gz -C dist . | |
| - name: Package artifact (windows) | |
| if: ${{ matrix.variant == 'Release' && matrix.os == 'windows' }} | |
| run: | | |
| New-Item -ItemType Directory -Force -Path dist | |
| # Including these is a requirement | |
| Copy-Item @("README.md", "LICENSE", "ORIGIN.md") dist\ | |
| Copy-Item "${{ steps.locate-windows.outputs.binary }}" dist\firestarr.exe | |
| # Copy required DLLs from vcpkg depending on variant | |
| copy @((Get-ChildItem -Recurse vcpkg\packages\*.dll).FullName | Select-String ${{ case( matrix.variant == 'Debug', '', '-notMatch' ) }} debug | Select-String bin ) dist\ | |
| # Bundle data files if they exist | |
| if (Test-Path fuel.lut) { Copy-Item fuel.lut dist\ } | |
| if (Test-Path proj.db) { Copy-Item proj.db dist\ } | |
| if (Test-Path settings.ini) { Copy-Item settings.ini dist\ } | |
| if (Test-Path data\fuel.lut) { Copy-Item data\fuel.lut dist\ } | |
| if (Test-Path data\settings.ini) { Copy-Item data\settings.ini dist\ } | |
| # Create version info | |
| .\firestarr.exe | select -first 1 | Out-File -FilePath dist/VERSION -Encoding utf8 | |
| # List contents | |
| echo "=== Package contents ===" | |
| Get-ChildItem dist | |
| # Create zip | |
| Compress-Archive -Path dist\* -DestinationPath ${{ env.OUTPUT_BINARY }}.zip | |
| shell: pwsh | |
| - name: Upload artifact (non-windows) | |
| if: ${{ matrix.variant == 'Release' && matrix.os != 'windows' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.OUTPUT_BINARY }} | |
| path: ${{ env.OUTPUT_BINARY }}.tar.gz | |
| retention-days: 30 | |
| - name: Upload artifact (windows) | |
| if: ${{ matrix.variant == 'Release' && matrix.os == 'windows' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.OUTPUT_BINARY }} | |
| path: ${{ env.OUTPUT_BINARY }}.zip | |
| retention-days: 30 | |
| build-release: | |
| needs: [cmake-test] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| - name: List artifacts | |
| run: | | |
| echo "=== All artifacts ===" | |
| find . -type f \( -name "*.tar.gz" -o -name "*.zip" \) | |
| - name: Update firestarr-latest release | |
| if: github.event_name != 'release' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: firestarr-latest | |
| name: "FireSTARR Latest Build" | |
| body: | | |
| Latest FireSTARR binaries built from last commit | |
| **commit:** ${{ github.ref }} | |
| **Built:** ${{ github.run_id }} | |
| **Workflow run:** https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| prerelease: true | |
| make_latest: false | |
| files: | | |
| ./firestarr*/*.tar.gz | |
| ./firestarr*/*.zip | |
| - name: Attach to release (release events) | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: "FireSTARR ${{ github.ref_name }}" | |
| body: | | |
| **Hash:** ${{ github.sha }} | |
| **Workflow run:** https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| prerelease: true | |
| make_latest: false | |
| generate_release_notes: true | |
| files: | | |
| ./firestarr*/*.tar.gz | |
| ./firestarr*/*.zip | |
| - name: Attach to release (release events) | |
| if: github.event_name == 'release' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| ./firestarr*/*.tar.gz | |
| ./firestarr*/*.zip |