Skip to content

Commit d1c3f83

Browse files
committed
chore(ci): adopt setup-vcpkg composite action from common_system
Replace inline vcpkg clone/bootstrap/cache steps (54 lines) with the reusable composite action from kcenon/common_system/.github/actions/setup-vcpkg. Changes: - Remove 5 inline vcpkg setup steps (Cache, Setup Unix/Windows, Determine commit) - Add single composite action step with project-specific cache key - Update vcpkg binary path to use VCPKG_ROOT env var - Update Windows CMake toolchain to use CMAKE_TOOLCHAIN_FILE env var - Simplify vcpkg_installed cache key (pinned commit via action removes need for dynamic hash) Part of kcenon/common_system#512
1 parent b04d14d commit d1c3f83

1 file changed

Lines changed: 6 additions & 54 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -109,58 +109,10 @@ jobs:
109109
echo "VCPKG_FORCE_SYSTEM_BINARIES=arm" >> $GITHUB_ENV
110110
fi
111111
112-
- name: Cache vcpkg
113-
uses: actions/cache@v4
114-
id: vcpkg-cache
112+
- name: Setup vcpkg
113+
uses: kcenon/common_system/.github/actions/setup-vcpkg@main
115114
with:
116-
path: |
117-
${{ github.workspace }}/vcpkg
118-
!${{ github.workspace }}/vcpkg/buildtrees
119-
!${{ github.workspace }}/vcpkg/packages
120-
!${{ github.workspace }}/vcpkg/downloads
121-
key: ${{ runner.os }}-${{ matrix.compiler }}-vcpkg-tool-${{ hashFiles('vcpkg.json') }}
122-
restore-keys: |
123-
${{ runner.os }}-${{ matrix.compiler }}-vcpkg-tool-
124-
125-
- name: Set up vcpkg (Unix)
126-
if: runner.os != 'Windows'
127-
run: |
128-
if [ ! -d "vcpkg" ]; then
129-
git clone https://github.com/Microsoft/vcpkg.git
130-
fi
131-
cd vcpkg
132-
if [ "${{ steps.vcpkg-cache.outputs.cache-hit }}" != "true" ]; then
133-
git pull
134-
./bootstrap-vcpkg.sh
135-
fi
136-
cd ..
137-
138-
- name: Set up vcpkg (Windows)
139-
if: runner.os == 'Windows'
140-
shell: pwsh
141-
run: |
142-
if (!(Test-Path "vcpkg")) {
143-
git clone https://github.com/Microsoft/vcpkg.git
144-
}
145-
cd vcpkg
146-
if ("${{ steps.vcpkg-cache.outputs.cache-hit }}" -ne "true") {
147-
git pull
148-
.\bootstrap-vcpkg.bat
149-
}
150-
cd ..
151-
152-
- name: Determine vcpkg commit (Unix)
153-
if: runner.os != 'Windows'
154-
id: vcpkg-commit-unix
155-
run: echo "commit=$(git -C vcpkg rev-parse HEAD)" >> $GITHUB_OUTPUT
156-
157-
- name: Determine vcpkg commit (Windows)
158-
if: runner.os == 'Windows'
159-
id: vcpkg-commit-windows
160-
shell: pwsh
161-
run: |
162-
$commit = git -C vcpkg rev-parse HEAD
163-
"commit=$commit" >> $env:GITHUB_OUTPUT
115+
extra-cache-key: 'messaging-system'
164116

165117
# Cache vcpkg_installed for Unix only (Windows uses vcpkg binary caching via x-gha)
166118
- name: Cache vcpkg installed (Unix)
@@ -169,14 +121,14 @@ jobs:
169121
id: vcpkg-installed
170122
with:
171123
path: ${{ github.workspace }}/vcpkg_installed
172-
key: ${{ runner.os }}-${{ matrix.compiler }}-vcpkg-installed-${{ matrix.triplet }}-testing-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json') }}-${{ steps.vcpkg-commit-unix.outputs.commit }}
124+
key: ${{ runner.os }}-${{ matrix.compiler }}-vcpkg-installed-${{ matrix.triplet }}-testing-${{ hashFiles('vcpkg.json', 'vcpkg-configuration.json') }}
173125
restore-keys: |
174126
${{ runner.os }}-${{ matrix.compiler }}-vcpkg-installed-${{ matrix.triplet }}-testing-
175127
176128
- name: Install dependencies with vcpkg (Unix)
177129
if: runner.os != 'Windows' && steps.vcpkg-installed.outputs.cache-hit != 'true'
178130
run: |
179-
./vcpkg/vcpkg install --x-manifest-root=. --x-install-root=${{ github.workspace }}/vcpkg_installed --triplet ${{ matrix.triplet }} --x-feature=testing || echo "vcpkg install failed, will use system libraries"
131+
${{ env.VCPKG_ROOT }}/vcpkg install --x-manifest-root=. --x-install-root=${{ github.workspace }}/vcpkg_installed --triplet ${{ matrix.triplet }} --x-feature=testing || echo "vcpkg install failed, will use system libraries"
180132
181133
# Windows: vcpkg toolchain handles installation in manifest mode
182134
# Uses binary caching (VCPKG_BINARY_SOURCES) for build speed
@@ -220,7 +172,7 @@ jobs:
220172
-DMESSAGING_BUILD_EXAMPLES=OFF `
221173
-DMESSAGING_USE_LOCAL_SYSTEMS=ON `
222174
-DCMAKE_BUILD_TYPE=$env:BUILD_TYPE `
223-
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake `
175+
-DCMAKE_TOOLCHAIN_FILE=${{ env.CMAKE_TOOLCHAIN_FILE }} `
224176
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} `
225177
-DVCPKG_MANIFEST_FEATURES=testing
226178

0 commit comments

Comments
 (0)