Skip to content

Commit 590f74b

Browse files
committed
Enhance CI workflow by adding vcpkg caching and conditional steps for setup and dependency installation
1 parent 4af027c commit 590f74b

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,40 @@ jobs:
4141

4242
runs-on: ${{ matrix.os }}
4343

44+
env:
45+
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
46+
4447
steps:
4548
- uses: actions/checkout@v4
4649

50+
- name: Cache vcpkg
51+
id: vcpkg-cache
52+
uses: actions/cache@v4
53+
with:
54+
path: |
55+
${{ github.workspace }}/vcpkg
56+
!${{ github.workspace }}/vcpkg/buildtrees
57+
!${{ github.workspace }}/vcpkg/packages
58+
!${{ github.workspace }}/vcpkg/downloads
59+
key: vcpkg-${{ runner.os }}-${{ matrix.triplet }}-2025.12.12-${{ hashFiles('.github/workflows/ci.yml') }}
60+
restore-keys: vcpkg-${{ runner.os }}-${{ matrix.triplet }}-2025.12.12-
61+
4762
- name: Setup vcpkg (using git clone)
63+
if: steps.vcpkg-cache.outputs.cache-hit != 'true'
4864
run: |
4965
git clone https://github.com/Microsoft/vcpkg.git ${{ github.workspace }}/vcpkg
5066
cd ${{ github.workspace }}/vcpkg
5167
git checkout 2025.12.12
5268
5369
- name: Bootstrap vcpkg (Windows)
54-
if: runner.os == 'Windows'
70+
if: runner.os == 'Windows' && steps.vcpkg-cache.outputs.cache-hit != 'true'
5571
run: |
5672
cd ${{ github.workspace }}/vcpkg
5773
.\bootstrap-vcpkg.bat
5874
shell: pwsh
5975

6076
- name: Bootstrap vcpkg (Linux/macOS)
61-
if: runner.os != 'Windows'
77+
if: runner.os != 'Windows' && steps.vcpkg-cache.outputs.cache-hit != 'true'
6278
run: |
6379
cd ${{ github.workspace }}/vcpkg
6480
./bootstrap-vcpkg.sh
@@ -75,8 +91,8 @@ jobs:
7591
g++ --version
7692
7793
- name: Install vcpkg dependencies
94+
if: steps.vcpkg-cache.outputs.cache-hit != 'true'
7895
env:
79-
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
8096
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
8197
run: |
8298
${{ github.workspace }}/vcpkg/vcpkg install boost-asio boost-beast boost-context boost-system openssl nlohmann-json gtest

0 commit comments

Comments
 (0)