Skip to content

Commit 4a63a8a

Browse files
authored
Refactor vcpkg setup in build workflow [skip CI]
Updated vcpkg setup and environment variables in GitHub Actions workflow.
1 parent a79a2bb commit 4a63a8a

1 file changed

Lines changed: 29 additions & 86 deletions

File tree

.github/workflows/build.yml

Lines changed: 29 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ on:
66
workflow_dispatch:
77

88
env:
9-
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
10-
BUILD_TYPE: Release
11-
USERNAME: ManiVaultStudio
12-
FEED_URL: https://nuget.pkg.github.com/ManiVaultStudio/index.json
13-
VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/ManiVaultStudio/index.json,readwrite"
9+
VCPKG_COMMIT_SHA: 56bb2411609227288b70117ead2c47585ba07713 # corresponds to tag 2026.04.27
1410

1511
# for matrix check https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners
1612
jobs:
@@ -73,95 +69,42 @@ jobs:
7369
key: ${{ secrets.RULESSUPPORT_DEPLOY_KEY }}
7470
known_hosts: github.com AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
7571

76-
# Install vcpkg
77-
- name: Clone vcpkg
72+
- name: Set vcpkg environment (Unix)
73+
if: "!startsWith(runner.os, 'Windows')"
7874
run: |
79-
cd ${{ github.workspace }}
80-
git clone --branch 2025.02.14 --single-branch https://github.com/microsoft/vcpkg.git
75+
echo "VCPKG_DIR=${{ runner.temp }}/vcpkg" >> $GITHUB_ENV
76+
echo "VCPKG_ROOT=${{ runner.temp }}/vcpkg" >> $GITHUB_ENV
77+
echo "VCPKG_BINARY_SOURCES=clear;files,${{ runner.temp }}/vcpkg-cache,readwrite" >> $GITHUB_ENV
8178
82-
# Bootstrap vcpkg
83-
- name: Bootstrap vcpkg
84-
if: startsWith(matrix.os, 'windows')
79+
- name: Set vcpkg environmentg (Windows)
80+
if: startsWith(runner.os, 'Windows')
8581
shell: pwsh
86-
run: |
87-
${{ github.workspace }}\vcpkg\bootstrap-vcpkg.bat
88-
echo "VCPKG_ROOT=${{ github.workspace }}\vcpkg" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
89-
echo "VCPKG_EXE=${{ github.workspace }}\vcpkg\vcpkg.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
90-
echo "VCPKG_LIBRARY_LINKAGE=dynamic" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
91-
92-
- name: Bootstrap vcpkg
93-
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
94-
shell: bash
9582
run: |
96-
${{ github.workspace }}/vcpkg/bootstrap-vcpkg.sh
97-
echo "VCPKG_ROOT=${{ github.workspace }}/vcpkg" >> $GITHUB_ENV
98-
echo "VCPKG_EXE=${{ github.workspace }}/vcpkg/vcpkg" >> $GITHUB_ENV
99-
echo "VCPKG_LIBRARY_LINKAGE=dynamic" >> $GITHUB_ENV
83+
echo "VCPKG_DIR=${{ runner.temp }}/vcpkg" >> $env:GITHUB_ENV
84+
echo "VCPKG_ROOT=${{ runner.temp }}/vcpkg" >> $env:GITHUB_ENV
85+
echo "VCPKG_BINARY_SOURCES=clear;files,${{ runner.temp }}/vcpkg-cache,readwrite" >> $env:GITHUB_ENV
10086
101-
- name: NuGet dependencies (Linux)
102-
if: startsWith(matrix.os, 'ubuntu')
103-
shell: bash
104-
run: |
105-
sudo apt update && sudo apt install -y mono-complete
106-
107-
- name: NuGet dependencies (MacOS)
108-
if: startsWith(matrix.os, 'macos') && !endsWith(matrix.os, '13')
109-
shell: bash
110-
run: |
111-
brew install mono
112-
113-
# Use cached vcpkg packages if possible
114-
- name: Add NuGet sources
115-
if: startsWith(matrix.os, 'windows')
116-
shell: pwsh
117-
run: |
118-
.$(${{ env.VCPKG_EXE }} fetch nuget) `
119-
sources add `
120-
-Source "${{ env.FEED_URL }}" `
121-
-StorePasswordInClearText `
122-
-Name GitHubPackages `
123-
-UserName "${{ env.USERNAME }}" `
124-
-Password "${{ secrets.GH_VCPKG_PACKAGES }}"
125-
.$(${{ env.VCPKG_EXE }} fetch nuget) `
126-
setapikey "${{ secrets.GH_VCPKG_PACKAGES }}" `
127-
-Source "${{ env.FEED_URL }}"
128-
129-
- name: Add NuGet sources
130-
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
131-
shell: bash
87+
- name: Set up binary cache
88+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
89+
with:
90+
path: ${{ runner.temp }}/vcpkg-cache
91+
key: vcpkg-cache-${{ runner.os }}-${{ matrix.os }}-${{ matrix.build-cversion }}-${{ env.VCPKG_COMMIT_SHA }}-${{ hashFiles('**/vcpkg.json', '**/vcpkg-overlays/**') }}
92+
restore-keys: |
93+
vcpkg-cache-${{ runner.os }}-${{ matrix.os }}-${{ matrix.build-cversion }}-${{ env.VCPKG_COMMIT_SHA }}
94+
95+
- name: Clone and checkout vcpkg
13296
run: |
133-
mono `${{ env.VCPKG_EXE }} fetch nuget | tail -n 1` \
134-
sources add \
135-
-Source "${{ env.FEED_URL }}" \
136-
-StorePasswordInClearText \
137-
-Name GitHubPackages \
138-
-UserName "${{ env.USERNAME }}" \
139-
-Password "${{ secrets.GH_VCPKG_PACKAGES }}"
140-
mono `${{ env.VCPKG_EXE }} fetch nuget | tail -n 1` \
141-
setapikey "${{ secrets.GH_VCPKG_PACKAGES }}" \
142-
-Source "${{ env.FEED_URL }}"
143-
144-
# Install vcpkg dependencies
145-
- name: Install vcpkg dependencies
146-
if: startsWith(matrix.os, 'windows')
147-
shell: pwsh
148-
run: |
149-
cd ${{ github.workspace }}
150-
${{ env.VCPKG_EXE }} install --triplet x64-windows
97+
git clone https://github.com/microsoft/vcpkg.git --branch master ${{ env.VCPKG_DIR }}
98+
git -C ${{ env.VCPKG_DIR }} checkout ${{ env.VCPKG_COMMIT_SHA }}
15199
152-
- name: Install vcpkg dependencies
153-
if: startsWith(matrix.os, 'ubuntu')
154-
shell: bash
155-
run: |
156-
cd ${{ github.workspace }}
157-
${{ env.VCPKG_EXE }} install --triplet x64-linux-dynamic
100+
- name: Bootstrap vcpkg (Unix)
101+
if: "!startsWith(runner.os, 'Windows')"
102+
run: ${{ env.VCPKG_DIR }}/bootstrap-vcpkg.sh -disableMetrics
158103

159-
- name: Install vcpkg dependencies
160-
if: startsWith(matrix.os, 'macos')
161-
shell: bash
162-
run: |
163-
cd ${{ github.workspace }}
164-
${{ env.VCPKG_EXE }} install --triplet x64-osx-dynamic
104+
- name: Bootstrap vcpkg (Windows)
105+
if: startsWith(runner.os, 'Windows')
106+
shell: pwsh
107+
run: ${{ env.VCPKG_DIR }}/bootstrap-vcpkg.bat -disableMetrics
165108

166109
# Build the package
167110
- name: Windows build

0 commit comments

Comments
 (0)