CI: switch vcpkg cache from removed x-gha backend to actions/cache #18
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: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| build: | |
| name: ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ ubuntu-latest, macos-latest, windows-latest ] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # --- dependencies --- | |
| - name: Install dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev nlohmann-json3-dev | |
| - name: Install dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| run: brew install nlohmann-json # libcurl ships with macOS | |
| # --- configure --- | |
| - name: Configure (Linux/macOS, system packages) | |
| if: runner.os != 'Windows' | |
| run: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release | |
| # Cache vcpkg's built-package archives so curl/nlohmann-json are not | |
| # rebuilt from source on every run. vcpkg's old x-gha backend was | |
| # removed; using actions/cache on the archives directory gives the same | |
| # speedup without provider setup. Key on vcpkg.json so a dep bump | |
| # invalidates cleanly. | |
| - name: Cache vcpkg archives (Windows) | |
| if: runner.os == 'Windows' | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~\AppData\Local\vcpkg\archives | |
| key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }} | |
| restore-keys: | | |
| vcpkg-${{ runner.os }}- | |
| - name: Configure (Windows, vcpkg) | |
| if: runner.os == 'Windows' | |
| run: | | |
| # Sync the runner's vcpkg to the manifest's builtin-baseline so its | |
| # port/version database matches, then configure. | |
| $base = (Get-Content vcpkg.json | ConvertFrom-Json).'builtin-baseline' | |
| git -C "$env:VCPKG_INSTALLATION_ROOT" fetch --depth 1 origin $base | |
| git -C "$env:VCPKG_INSTALLATION_ROOT" checkout -f $base | |
| & "$env:VCPKG_INSTALLATION_ROOT\bootstrap-vcpkg.bat" -disableMetrics | |
| cmake -B build -S . "-DCMAKE_TOOLCHAIN_FILE=$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" | |
| # --- build + verify install/export --- | |
| - name: Build | |
| run: cmake --build build --config Release | |
| - name: Install (verify export) | |
| run: cmake --install build --config Release --prefix "${{ runner.temp }}/nml-install" |