Disable vcpkg applocal for static Windows builds to fix file-lock flake #831
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Windows | |
| on: | |
| push: | |
| branches: | |
| - "*" | |
| tags: | |
| - "*" | |
| pull_request: | |
| branches: | |
| - "*" | |
| jobs: | |
| build-shared: | |
| name: "Libs: ${{ matrix.libs }}, FS Lib: ${{ matrix.fslib }}, Arch: ${{ matrix.arch }}, Build OS: ${{ matrix.runs-on }}" | |
| runs-on: ${{ matrix.runs-on }} | |
| env: | |
| USERNAME: projectM-visualizer | |
| VCPKG_EXE: ${{ github.workspace }}/vcpkg/vcpkg | |
| FEED_URL: https://nuget.pkg.github.com/projectM-visualizer/index.json | |
| VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/projectM-visualizer/index.json,readwrite" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| libs: ['shared', 'static'] | |
| fslib: ['stl', 'boost'] | |
| arch: ['X64', 'Win32'] | |
| runs-on: ['windows-2025', 'windows-2022'] | |
| steps: | |
| - name: Checkout vcpkg | |
| uses: actions/checkout@v7 | |
| with: | |
| repository: microsoft/vcpkg | |
| path: vcpkg | |
| submodules: recursive | |
| - name: Bootstrap vcpkg | |
| shell: pwsh | |
| run: | | |
| ${{ github.workspace }}/vcpkg/bootstrap-vcpkg.bat | |
| ${{ env.VCPKG_EXE }} fetch nuget | |
| - name: Add NuGet sources | |
| shell: pwsh | |
| run: | | |
| .$(${{ env.VCPKG_EXE }} fetch nuget) ` | |
| sources add ` | |
| -Source "${{ env.FEED_URL }}" ` | |
| -StorePasswordInClearText ` | |
| -Name GitHubPackages ` | |
| -UserName "${{ env.USERNAME }}" ` | |
| -Password "${{ secrets.VCPKG_PACKAGES_TOKEN }}" | |
| .$(${{ env.VCPKG_EXE }} fetch nuget) ` | |
| setapikey "${{ secrets.VCPKG_PACKAGES_TOKEN }}" ` | |
| -Source "${{ env.FEED_URL }}" | |
| - name: Checkout libprojectM | |
| uses: actions/checkout@v7 | |
| with: | |
| submodules: 'recursive' | |
| - name: Configure Build | |
| run: | | |
| if("${{ matrix.libs }}" -eq "shared") { | |
| $shared_libs = "ON" | |
| $applocal_deps = "ON" | |
| } else { | |
| $shared_libs = "OFF" | |
| # Static triplets link everything (incl. CRT) statically, so there are no DLLs to deploy. | |
| # Disabling applocal removes a proven file-lock race (MSB3073, exit 32) with zero benefit lost. | |
| $applocal_deps = "OFF" | |
| } | |
| if("${{ matrix.fslib }}" -eq "boost") { | |
| $use_boost = "ON" | |
| } else { | |
| $use_boost = "OFF" | |
| } | |
| if("${{ matrix.arch }}" -eq "X64") { | |
| $triplet = "x64-windows" | |
| } else { | |
| $triplet = "x86-windows" | |
| } | |
| if("${{ matrix.libs }}" -eq "shared") { | |
| $runtime = "DLL" | |
| } else { | |
| $runtime = "" | |
| $triplet = $triplet + "-static" | |
| } | |
| if("${{ matrix.runs-on }}" -eq "windows-2022") { | |
| $generator = "Visual Studio 17 2022" | |
| } else { | |
| $generator = "Visual Studio 18 2026" | |
| } | |
| cmake -G "$($generator)" ` | |
| -A "${{ matrix.arch }}" ` | |
| -S "${{ github.workspace }}" ` | |
| -B "${{ github.workspace }}/cmake-build" ` | |
| -DCMAKE_TOOLCHAIN_FILE="${Env:VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" ` | |
| -DVCPKG_TARGET_TRIPLET="$($triplet)" ` | |
| -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" ` | |
| -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$<CONFIG:Debug>:Debug>$($runtime)" ` | |
| -DCMAKE_VERBOSE_MAKEFILE=YES ` | |
| -DBUILD_SHARED_LIBS="$($shared_libs)" ` | |
| -DVCPKG_APPLOCAL_DEPS="$($applocal_deps)" ` | |
| -DENABLE_BOOST_FILESYSTEM="$($use_boost)" ` | |
| -DENABLE_CXX_INTERFACE=YES ` | |
| -DBUILD_TESTING=YES ` | |
| -DCMAKE_VERBOSE_MAKEFILE=ON | |
| - name: Build Debug | |
| run: cmake --build "${{ github.workspace }}/cmake-build" --config "Debug" --parallel | |
| - name: Run Unit Tests | |
| run: ctest --test-dir "${{ github.workspace }}/cmake-build" --verbose --build-config "Debug" | |
| - name: Build Release | |
| run: cmake --build "${{ github.workspace }}/cmake-build" --config "Release" --parallel | |
| - name: Install | |
| run: | | |
| cmake --build "${{ github.workspace }}/cmake-build" --config "Debug" --target INSTALL | |
| cmake --build "${{ github.workspace }}/cmake-build" --config "Release" --target INSTALL | |
| - name: Test C++ Interface | |
| run: | | |
| if("${{ matrix.fslib }}" -eq "boost") { | |
| $use_boost = "ON" | |
| } else { | |
| $use_boost = "OFF" | |
| } | |
| if("${{ matrix.arch }}" -eq "X64") { | |
| $triplet = "x64-windows" | |
| } else { | |
| $triplet = "x86-windows" | |
| } | |
| if("${{ matrix.libs }}" -eq "shared") { | |
| $runtime = "DLL" | |
| $applocal_deps = "ON" | |
| } else { | |
| $runtime = "" | |
| $triplet = $triplet + "-static" | |
| # Same as above: nothing to deploy for static builds, only file-lock risk. | |
| $applocal_deps = "OFF" | |
| } | |
| if("${{ matrix.runs-on }}" -eq "windows-2022") { | |
| $generator = "Visual Studio 17 2022" | |
| } else { | |
| $generator = "Visual Studio 18 2026" | |
| } | |
| cmake -G "$($generator)" ` | |
| -A "${{ matrix.arch }}" ` | |
| -S "${{ github.workspace }}/tests/cxx-interface" ` | |
| -B "${{ github.workspace }}/cmake-build-cxx-api" ` | |
| -DCMAKE_PREFIX_PATH="${{ github.workspace }}/install" ` | |
| -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$<CONFIG:Debug>:Debug>$($runtime)" ` | |
| -DCMAKE_TOOLCHAIN_FILE="${Env:VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" ` | |
| -DVCPKG_TARGET_TRIPLET="$($triplet)" ` | |
| -DVCPKG_APPLOCAL_DEPS="$($applocal_deps)" ` | |
| -DENABLE_BOOST_FILESYSTEM="$($use_boost)" ` | |
| -DCMAKE_VERBOSE_MAKEFILE=ON | |
| cmake --build "${{ github.workspace }}/cmake-build-cxx-api" --config "Debug" | |
| cmake --build "${{ github.workspace }}/cmake-build-cxx-api" --config "Release" | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: projectm-windows-${{ matrix.libs }}-${{ matrix.fslib }}-${{ matrix.arch }}-${{ matrix.runs-on }} | |
| path: install/* |