Here’s a Windows‑MSVC GitHub Actions workflow that builds a CMake + vcpkg (manifest mode) project and automatically caches vcpkg artifacts. It uses Ninja + MSVC, restores the vcpkg cache based on your vcpkg.json, and bootstraps vcpkg only when needed. ✅ Windows + MSVC + vcpkg + Cache (GitHub Actions) yaml name: Build (Windows + MSVC) on: push: pull_request: jobs: build: runs-on: windows-latest env: VCPKG_ROOT: ${{ github.workspace }}\vcpkg BUILD_DIR: ${{ github.workspace }}\build steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install Ninja uses: seanmiddleditch/gha-setup-ninja@v4 - name: Cache vcpkg uses: actions/cache@v4 with: path: | ${{ env.VCPKG_ROOT }}\installed ${{ env.VCPKG_ROOT }}\buildtrees ${{ env.VCPKG_ROOT }}\packages key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }} restore-keys: | vcpkg-${{ runner.os }}- - name: Clone vcpkg (if not cached) shell: pwsh run: | if (-not (Test-Path "${env:VCPKG_ROOT}")) { git clone https://github.com/microsoft/vcpkg.git $env:VCPKG_ROOT & "$env:VCPKG_ROOT\bootstrap-vcpkg.bat" } - name: Configure CMake (MSVC + Ninja) run: > cmake -S . -B %BUILD_DIR% -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake - name: Build run: cmake --build %BUILD_DIR% --config Release 🧠 What this workflow gets right Uses MSVC automatically (default compiler on windows-latest) Uses Ninja for fast, parallel builds Caches vcpkg buildtrees, packages, installed → huge speed‑up on subsequent runs Cache key tied to vcpkg.json → cache invalidates when dependencies change Bootstraps vcpkg only when missing → avoids unnecessary work