From dafd20e1821a27d480a3d97300e9f86cdb56113b Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Sun, 22 Sep 2024 13:38:51 +0100 Subject: [PATCH] ci: remove `restore-keys` for `vcpkg` and use local bootstrap --- .github/workflows/ci.yml | 5 +++-- scripts/install_deps.py | 2 +- scripts/lib/vcpkg.py | 9 +++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 69599fa4c..215e195f6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,10 +68,9 @@ jobs: uses: actions/cache@v4 with: path: | + vcpkg vcpkg_installed - ${{ env.LOCALAPPDATA }}/vcpkg key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json') }} - restore-keys: vcpkg-${{ runner.os }} # Should only restore the .venv directory from cache. - name: Init Python venv @@ -98,6 +97,8 @@ jobs: uses: seanmiddleditch/gha-setup-ninja@master - name: Install dependencies + env: + VCPKG_ROOT: "" # Unset deliberately to suppress 'already installed' warning. run: python ./scripts/install_deps.py - name: Configure diff --git a/scripts/install_deps.py b/scripts/install_deps.py index 7f13740f3..81f0517d1 100755 --- a/scripts/install_deps.py +++ b/scripts/install_deps.py @@ -175,7 +175,7 @@ def install(args): if env.is_windows() and not args.skip_vcpkg: import lib.vcpkg as vcpkg - vcpkg.install() + vcpkg.install(args.ci_env) if not args.skip_meson: if args.subprojects: diff --git a/scripts/lib/vcpkg.py b/scripts/lib/vcpkg.py index 9b735c20a..b2a5303aa 100644 --- a/scripts/lib/vcpkg.py +++ b/scripts/lib/vcpkg.py @@ -21,14 +21,15 @@ import lib.cmd_utils as cmd_utils GIT_REPO = "https://github.com/microsoft/vcpkg.git" -def install(): - vcpkg_bin = ensure_vcpkg() +def install(ci_env): + vcpkg_bin = ensure_vcpkg(ci_env) cmd_utils.run([vcpkg_bin, "install"], print_cmd=True) -def ensure_vcpkg(): - if cmd_utils.has_command("vcpkg"): +def ensure_vcpkg(ci_env): + # Don't use the local vcpkg if we're in CI, since this makes caching complicated. + if not ci_env and cmd_utils.has_command("vcpkg"): print("Using system vcpkg") return "vcpkg"