CI: fetch the vcpkg builtin-baseline commit on Windows before configure #13
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 | |
| - name: Configure (Windows, vcpkg) | |
| if: runner.os == 'Windows' | |
| shell: bash | |
| run: | | |
| # The runner's pre-installed vcpkg may not contain the manifest's | |
| # builtin-baseline commit, so fetch it before configuring. | |
| BASE=$(jq -r '."builtin-baseline"' vcpkg.json) | |
| git -C "$VCPKG_INSTALLATION_ROOT" fetch --depth 1 origin "$BASE" | |
| cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE="$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" |