Skip to content

Commit 815916b

Browse files
committed
Test vcpkg nuget.
1 parent 88f90f7 commit 815916b

1 file changed

Lines changed: 35 additions & 12 deletions

File tree

.github/workflows/build-pcl.yml

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: build-pcl
22

33
on: [push, pull_request]
44

5+
permissions:
6+
packages: write
7+
58
jobs:
69
gcc-build:
710
runs-on: ubuntu-24.04
@@ -230,23 +233,43 @@ jobs:
230233
generator: 'Visual Studio 17 2022'
231234
platform_args: '-A x64'
232235
env:
236+
USERNAME: PointCloudLibrary
237+
FEED_URL: https://nuget.pkg.github.com/PointCloudLibrary/index.json
238+
VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/PointCloudLibrary/index.json,readwrite"
233239
CONFIGURATION: Release
234-
VCPKG_ROOT: '${{ github.workspace }}\vcpkg'
235240
IS_MAIN: ${{ github.ref == 'refs/heads/master' }}
241+
VCPKG_PAT_TOKEN: ${{ secrets.VCPKG_PAT_TOKEN }}
236242
steps:
237243
- uses: actions/checkout@v4
238-
- name: Cache vcpkg installed
239-
uses: actions/cache@v4
240-
with:
241-
path: ${{ env.VCPKG_ROOT }}\installed
242-
key: vcpkg-${{ matrix.architecture }}-${{ hashFiles('**/vcpkg.json') }}
243-
restore-keys: |
244-
vcpkg-${{ matrix.architecture }}-
244+
- name: "check is VCPKG_PAT_TOKEN exists"
245+
if: ${{ env.VCPKG_PAT_TOKEN == '' }}
246+
run: 'echo "echo the secret \"VCPKG_PAT_TOKEN\" has not been made; echo please go to \"settings \> secrets \> actions\" to create it"'
247+
- name: Bootstrap vcpkg
248+
run: |
249+
echo $VCPKG_INSTALLATION_ROOT
250+
cd "$VCPKG_INSTALLATION_ROOT"
251+
ls
252+
git pull > nul
253+
./bootstrap-vcpkg.bat -disableMetrics
254+
shell: bash
255+
- name: Add NuGet sources
256+
shell: pwsh
257+
run: |
258+
.$(vcpkg fetch nuget) `
259+
sources add `
260+
-Source "${{ env.FEED_URL }}" `
261+
-StorePasswordInClearText `
262+
-Name GitHubPackages `
263+
-UserName "${{ env.USERNAME }}" `
264+
-Password "${{ env.VCPKG_PAT_TOKEN }}"
265+
.$(vcpkg fetch nuget) `
266+
setapikey "${{ env.VCPKG_PAT_TOKEN }}" `
267+
-Source "${{ env.FEED_URL }}"
245268
- name: Setup vcpkg
246269
shell: pwsh
247270
run: |
248-
if (-Not (Test-Path "$Env:VCPKG_ROOT")) { git clone https://github.com/microsoft/vcpkg.git "$Env:VCPKG_ROOT" }
249-
cd "$Env:VCPKG_ROOT"
271+
if (-Not (Test-Path "$Env:VCPKG_INSTALLATION_ROOT")) { git clone https://github.com/microsoft/vcpkg.git "$Env:VCPKG_INSTALLATION_ROOT" }
272+
cd "$Env:VCPKG_INSTALLATION_ROOT"
250273
.\bootstrap-vcpkg.bat
251274
- name: Set vcpkg triplet
252275
shell: pwsh
@@ -257,13 +280,13 @@ jobs:
257280
shell: pwsh
258281
run: |
259282
$packages = @('boost','eigen3','flann','qhull','cjson','gtest','vtk','glew','freeglut')
260-
foreach ($p in $packages) { & "$Env:VCPKG_ROOT\vcpkg.exe" install "$($p):$Env:VCPKG_TRIPLET" }
283+
foreach ($p in $packages) { & "$Env:VCPKG_INSTALLATION_ROOT\vcpkg.exe" install "$($p):$Env:VCPKG_TRIPLET" }
261284
- name: Configure (${{ matrix.name }})
262285
shell: cmd
263286
run: |
264287
cmake -B build -S . -G"${{ matrix.generator }}" ${{ matrix.platform_args }} ^
265288
-DVCPKG_TARGET_TRIPLET=%VCPKG_TRIPLET% ^
266-
-DCMAKE_TOOLCHAIN_FILE="%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake" ^
289+
-DCMAKE_TOOLCHAIN_FILE="%VCPKG_INSTALLATION_ROOT%\scripts\buildsystems\vcpkg.cmake" ^
267290
-DCMAKE_BUILD_TYPE=MinSizeRel ^
268291
-DVCPKG_APPLOCAL_DEPS=ON ^
269292
-DPCL_BUILD_WITH_BOOST_DYNAMIC_LINKING_WIN32=ON ^

0 commit comments

Comments
 (0)