From 878211c8b8ecd336a5c3060b25432450787a9c52 Mon Sep 17 00:00:00 2001 From: Symmetricity <184246+Symmetricity@users.noreply.github.com> Date: Fri, 5 Jun 2026 07:39:23 +0200 Subject: [PATCH] Use a vcpkg manifest for CI dependencies Move the CI vcpkg package list into vcpkg.json so dependency versions and the builtin baseline are tracked in one place. Use the manifest files for cache keys, check out the manifest baseline before install, and pass an explicit installed directory to CMake so Windows and Linux CI restore matching binary caches across reruns on the same runner image. Co-authored-by: Codex --- .github/dependabot.yml | 11 +++++++++++ .github/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++------ vcpkg.json | 27 +++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 vcpkg.json diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..3cf52b82 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + + - package-ecosystem: "vcpkg" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5f17b6c9..01c608e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,6 +62,9 @@ jobs: CMakeLists.txt|Makefile|Dockerfile|action.yml|VERSION) runtime=true ;; + vcpkg.json|vcpkg-configuration.json) + runtime=true + ;; get-coastline.sh|get-landcover.sh|get-monaco.sh) runtime=true ;; @@ -131,12 +134,21 @@ jobs: - name: Validate version metadata run: | python3 <<'PY' + import json import pathlib import re version = pathlib.Path("VERSION").read_text(encoding="utf-8").strip() if not re.fullmatch(r"\d+\.\d+\.\d+", version): raise SystemExit(f"VERSION must use X.Y.Z format, got {version!r}") + + with open("vcpkg.json", encoding="utf-8") as handle: + vcpkg_version = json.load(handle).get("version-string") + + if vcpkg_version != version: + raise SystemExit( + f"vcpkg.json version-string {vcpkg_version!r} does not match VERSION {version!r}" + ) PY - name: Validate Lua profiles @@ -316,17 +328,24 @@ jobs: uses: actions/cache@v5 with: path: ${{ github.workspace }}\vcpkg-binary-cache - key: vcpkg-binary-${{ runner.os }}-${{ steps.runner-image.outputs.image-os }}-${{ steps.runner-image.outputs.image-version }}-x64-windows-static-md-${{ hashFiles('.github/workflows/ci.yml') }} + key: vcpkg-binary-${{ runner.os }}-${{ steps.runner-image.outputs.image-os }}-${{ steps.runner-image.outputs.image-version }}-x64-windows-static-md-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json') }} restore-keys: vcpkg-binary-${{ runner.os }}-${{ steps.runner-image.outputs.image-os }}-${{ steps.runner-image.outputs.image-version }}-x64-windows-static-md- + - name: Checkout vcpkg manifest baseline + shell: pwsh + run: | + $baseline = (Get-Content vcpkg.json | ConvertFrom-Json).'builtin-baseline' + git -C $env:VCPKG_INSTALLATION_ROOT fetch --depth=1 origin $baseline + git -C $env:VCPKG_INSTALLATION_ROOT checkout --force $baseline + - name: Build dependencies run: | - vcpkg install --triplet=x64-windows-static-md lua shapelib zlib protobuf[zlib] sqlite3 boost-program-options boost-filesystem boost-geometry boost-system boost-asio boost-interprocess boost-iostreams boost-sort rapidjson + vcpkg install --triplet=x64-windows-static-md - name: Build tilemaker run: | mkdir ${{ github.workspace }}\build - cd ${{ github.workspace }}\build && cmake -DTILEMAKER_BUILD_STATIC=ON -DVCPKG_TARGET_TRIPLET="x64-windows-static-md" -DCMAKE_TOOLCHAIN_FILE="${env:VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" .. + cd ${{ github.workspace }}\build && cmake -DTILEMAKER_BUILD_STATIC=ON -DVCPKG_TARGET_TRIPLET="x64-windows-static-md" -DVCPKG_INSTALLED_DIR="${{ github.workspace }}\vcpkg_installed" -DCMAKE_TOOLCHAIN_FILE="${env:VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" .. cd ${{ github.workspace }}\build && cmake --build . --config RelWithDebInfo - name: Build openmaptiles-compatible mbtiles files of Liechtenstein @@ -408,18 +427,24 @@ jobs: uses: actions/cache@v5 with: path: ${{ github.workspace }}/vcpkg-binary-cache - key: vcpkg-binary-${{ runner.os }}-${{ steps.runner-image.outputs.image-os }}-${{ steps.runner-image.outputs.image-version }}-${{ matrix.triplet }}-${{ hashFiles('.github/workflows/ci.yml') }} + key: vcpkg-binary-${{ runner.os }}-${{ steps.runner-image.outputs.image-os }}-${{ steps.runner-image.outputs.image-version }}-${{ matrix.triplet }}-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json') }} restore-keys: vcpkg-binary-${{ runner.os }}-${{ steps.runner-image.outputs.image-os }}-${{ steps.runner-image.outputs.image-version }}-${{ matrix.triplet }}- + - name: Checkout vcpkg manifest baseline + run: | + baseline="$(python3 -c 'import json; print(json.load(open("vcpkg.json"))["builtin-baseline"])')" + git -C "$VCPKG_INSTALLATION_ROOT" fetch --depth=1 origin "$baseline" + git -C "$VCPKG_INSTALLATION_ROOT" checkout --force "$baseline" + - name: Build dependencies run: | - vcpkg install --triplet="${{ matrix.triplet }}" lua shapelib zlib protobuf[zlib] sqlite3 boost-program-options boost-filesystem boost-geometry boost-system boost-asio boost-interprocess boost-iostreams boost-sort rapidjson + vcpkg install --triplet="${{ matrix.triplet }}" - name: Build tilemaker run: | mkdir build cd build - cmake -DTILEMAKER_BUILD_STATIC=ON -DCMAKE_BUILD_TYPE=Release -DVCPKG_TARGET_TRIPLET="${{ matrix.triplet }}" -DCMAKE_TOOLCHAIN_FILE="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" -DCMAKE_CXX_COMPILER=g++ .. + cmake -DTILEMAKER_BUILD_STATIC=ON -DCMAKE_BUILD_TYPE=Release -DVCPKG_TARGET_TRIPLET="${{ matrix.triplet }}" -DVCPKG_INSTALLED_DIR="${{ github.workspace }}/vcpkg_installed" -DCMAKE_TOOLCHAIN_FILE="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" -DCMAKE_CXX_COMPILER=g++ .. cmake --build . strip tilemaker diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 00000000..48260fa9 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,27 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", + "name": "tilemaker", + "version-string": "3.1.0", + "builtin-baseline": "f3e10653cc27d62a37a3763cd84b38bca07c6075", + "dependencies": [ + "lua", + "shapelib", + "zlib", + { + "name": "protobuf", + "features": [ + "zlib" + ] + }, + "sqlite3", + "boost-program-options", + "boost-filesystem", + "boost-geometry", + "boost-system", + "boost-asio", + "boost-interprocess", + "boost-iostreams", + "boost-sort", + "rapidjson" + ] +}