Skip to content

Commit d50d497

Browse files
committed
Add VCPKG set up
Borrowed from the Glib workflow
1 parent d71c0ce commit d50d497

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/cpp_windows.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,39 @@ jobs:
113113
path: ${{ steps.ccache-info.outputs.cache-dir }}
114114
key: cpp-ccache-windows-${{ inputs.arch }}-${{ hashFiles('cpp/**') }}
115115
restore-keys: cpp-ccache-windows-${{ inputs.arch }}-
116+
- name: Checkout vcpkg
117+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
118+
with:
119+
fetch-depth: 0
120+
path: vcpkg
121+
repository: microsoft/vcpkg
122+
- name: Bootstrap vcpkg
123+
run: |
124+
vcpkg\bootstrap-vcpkg.bat
125+
$VCPKG_ROOT = $(Resolve-Path -LiteralPath "vcpkg").ToString()
126+
Write-Output ${VCPKG_ROOT} | `
127+
Out-File -FilePath ${Env:GITHUB_PATH} -Encoding utf8 -Append
128+
Write-Output "VCPKG_ROOT=${VCPKG_ROOT}" | `
129+
Out-File -FilePath ${Env:GITHUB_ENV} -Encoding utf8 -Append
130+
- name: Setup NuGet credentials for vcpkg caching
131+
shell: bash
132+
run: |
133+
$(vcpkg fetch nuget | tail -n 1) \
134+
sources add \
135+
-source "https://nuget.pkg.github.com/$GITHUB_REPOSITORY_OWNER/index.json" \
136+
-storepasswordincleartext \
137+
-name "GitHub" \
138+
-username "$GITHUB_REPOSITORY_OWNER" \
139+
-password "${{ secrets.GITHUB_TOKEN }}"
140+
$(vcpkg fetch nuget | tail -n 1) \
141+
setapikey "${{ secrets.GITHUB_TOKEN }}" \
142+
-source "https://nuget.pkg.github.com/$GITHUB_REPOSITORY_OWNER/index.json"
116143
- name: Build
117144
shell: cmd
118145
run: |
146+
set VCPKG_ROOT_KEEP=%VCPKG_ROOT%
119147
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ inputs.arch }}
148+
set VCPKG_ROOT=%VCPKG_ROOT_KEEP%
120149
bash -c "ci/scripts/cpp_build.sh $(pwd) $(pwd)/build"
121150
- name: Register Flight SQL ODBC Driver
122151
shell: cmd

0 commit comments

Comments
 (0)