Skip to content

Commit 9151982

Browse files
committed
Switch vcpkg cache for Windows build check to NuGet
Both vcpkg and GitHub removed support for GitHub Actions Cache, so the current best way of caching packages on Windows is via NuGet.
1 parent 85dfdda commit 9151982

File tree

1 file changed

+33
-13
lines changed

1 file changed

+33
-13
lines changed

.github/workflows/build.yaml

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,38 @@ jobs:
6363
build-windows:
6464
name: Windows, x64
6565
runs-on: windows-latest
66+
env:
67+
USERNAME: projectM-visualizer
68+
VCPKG_EXE: ${{ github.workspace }}/vcpkg/vcpkg
69+
FEED_URL: https://nuget.pkg.github.com/projectM-visualizer/index.json
70+
VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/projectM-visualizer/index.json,readwrite"
71+
6672

6773
steps:
68-
- name: Export GitHub Actions cache environment variables
69-
uses: actions/github-script@v6
74+
- name: Checkout vcpkg
75+
uses: actions/checkout@v4
7076
with:
71-
script: |
72-
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
73-
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
77+
repository: microsoft/vcpkg
78+
path: vcpkg
79+
submodules: recursive
80+
81+
- name: Bootstrap vcpkg
82+
shell: pwsh
83+
run: ${{ github.workspace }}/vcpkg/bootstrap-vcpkg.bat
84+
85+
- name: Add NuGet sources
86+
shell: pwsh
87+
run: |
88+
.$(${{ env.VCPKG_EXE }} fetch nuget) `
89+
sources add `
90+
-Source "${{ env.FEED_URL }}" `
91+
-StorePasswordInClearText `
92+
-Name GitHubPackages `
93+
-UserName "${{ env.USERNAME }}" `
94+
-Password "${{ secrets.VCPKG_PACKAGES_TOKEN }}"
95+
.$(${{ env.VCPKG_EXE }} fetch nuget) `
96+
setapikey "${{ secrets.VCPKG_PACKAGES_TOKEN }}" `
97+
-Source "${{ env.FEED_URL }}"
7498
7599
- name: Checkout libprojectM Sources
76100
uses: actions/checkout@v4
@@ -80,11 +104,9 @@ jobs:
80104
submodules: recursive
81105

82106
- name: Build/Install libprojectM
83-
env:
84-
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
85107
run: |
86108
mkdir cmake-build-libprojectm
87-
cmake -G "Visual Studio 17 2022" -A "X64" -S "${{ github.workspace }}/projectm" -B "${{ github.workspace }}/cmake-build-libprojectm" -DCMAKE_TOOLCHAIN_FILE="${Env:VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install-libprojectm" -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$<CONFIG:Debug>:Debug>" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=NO
109+
cmake -G "Visual Studio 17 2022" -A "X64" -S "${{ github.workspace }}/projectm" -B "${{ github.workspace }}/cmake-build-libprojectm" -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install-libprojectm" -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$<CONFIG:Debug>:Debug>" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=NO
88110
cmake --build "${{ github.workspace }}/cmake-build-libprojectm" --config Release --parallel
89111
cmake --install "${{ github.workspace }}/cmake-build-libprojectm" --config Release
90112
@@ -95,11 +117,9 @@ jobs:
95117
submodules: recursive
96118

97119
- name: Build projectMSDL
98-
env:
99-
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
100120
run: |
101121
mkdir cmake-build-frontend-sdl2
102-
cmake -G "Visual Studio 17 2022" -A "X64" -S "${{ github.workspace }}/frontend-sdl2" -B "${{ github.workspace }}/cmake-build-frontend-sdl2" -DCMAKE_TOOLCHAIN_FILE="${Env:VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_PREFIX_PATH="${{ github.workspace }}/install-libprojectm" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install-frontend-sdl2" -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$<CONFIG:Debug>:Debug>" -DCMAKE_VERBOSE_MAKEFILE=YES -DSDL2_LINKAGE=static -DBUILD_TESTING=YES
122+
cmake -G "Visual Studio 17 2022" -A "X64" -S "${{ github.workspace }}/frontend-sdl2" -B "${{ github.workspace }}/cmake-build-frontend-sdl2" -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_PREFIX_PATH="${{ github.workspace }}/install-libprojectm" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install-frontend-sdl2" -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$<CONFIG:Debug>:Debug>" -DCMAKE_VERBOSE_MAKEFILE=YES -DSDL2_LINKAGE=static -DBUILD_TESTING=YES
103123
cmake --build "${{ github.workspace }}/cmake-build-frontend-sdl2" --parallel --config Release
104124
# cmake --install "${{ github.workspace }}/cmake-build-frontend-sdl2" --config Release
105125

@@ -121,7 +141,7 @@ jobs:
121141
- name: Build/Install libprojectM
122142
run: |
123143
mkdir cmake-build-libprojectm
124-
cmake -G Ninja -S "${{ github.workspace }}/projectm" -B "${{ github.workspace }}/cmake-build-libprojectm" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}//install-libprojectm"
144+
cmake -G Ninja -S "${{ github.workspace }}/projectm" -B "${{ github.workspace }}/cmake-build-libprojectm" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install-libprojectm"
125145
cmake --build "${{ github.workspace }}/cmake-build-libprojectm" --parallel
126146
cmake --install "${{ github.workspace }}/cmake-build-libprojectm"
127147
@@ -134,6 +154,6 @@ jobs:
134154
- name: Build projectMSDL
135155
run: |
136156
mkdir cmake-build-frontend-sdl2
137-
cmake -G Ninja -S "${{ github.workspace }}/frontend-sdl2" -B "${{ github.workspace }}/cmake-build-frontend-sdl2" -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="${{ github.workspace }}/install-libprojectm" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}//install-frontend-sdl2"
157+
cmake -G Ninja -S "${{ github.workspace }}/frontend-sdl2" -B "${{ github.workspace }}/cmake-build-frontend-sdl2" -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="${{ github.workspace }}/install-libprojectm" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install-frontend-sdl2"
138158
cmake --build "${{ github.workspace }}/cmake-build-frontend-sdl2" --parallel
139159
# cmake --install "${{ github.workspace }}/cmake-build-frontend-sdl2"

0 commit comments

Comments
 (0)