CI: x-gha extension is deprecated, so we cache the vcpkg build ourselves.

This commit is contained in:
Roman Fomin 2025-04-28 11:14:48 +07:00
parent b271de8949
commit 550ceb4b3f

View File

@ -11,7 +11,8 @@ on:
workflow_dispatch:
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
VCPKG_INSTALLED_DIR: "${{ github.workspace }}/vcpkg_installed"
VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}/vcpkg_cache,readwrite"
jobs:
build:
@ -63,21 +64,18 @@ jobs:
sudo apt-get install ninja-build
sudo apt-get build-dep libsdl2-dev
- name: Install CMake
uses: lukka/get-cmake@v3.31.6
- name: Developer Command Prompt
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.config.arch }}
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
- name: Restore vcpkg cache
uses: actions/cache/restore@v4
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
path: ${{ github.workspace }}/vcpkg_cache
key: vcpkg-${{ matrix.config.triplet }}-${{ hashFiles('vcpkg.json', 'vcpkg_installed/compiler-file-hash-cache.json', 'vcpkg_installed/status') }}
restore-keys: vcpkg-${{ matrix.config.triplet }}-
- name: Configure
run: >-
@ -92,6 +90,12 @@ jobs:
- name: Build
run: cmake --build build --config "Release"
- name: Save vcpkg cache
uses: actions/cache/save@v4
with:
path: ${{ github.workspace }}/vcpkg_cache
key: vcpkg-${{ matrix.config.triplet }}-${{ hashFiles('vcpkg.json', 'vcpkg_installed/compiler-file-hash-cache.json', 'vcpkg_installed/status') }}
- name: Test
if: github.event_name == 'workflow_dispatch'
run: |