Enhance Windows vcpkg setup in release workflows with fallback mechanism
- Added a fallback mechanism for vcpkg setup to handle failures gracefully. - Introduced environment variables to indicate vcpkg availability and switch to a minimal build configuration if vcpkg is not available. - Updated CMake configuration to conditionally use vcpkg toolchain based on the availability flag.
This commit is contained in:
66
.github/workflows/release-simplified.yml
vendored
66
.github/workflows/release-simplified.yml
vendored
@@ -164,10 +164,12 @@ jobs:
|
|||||||
# Install Homebrew dependencies needed for UI tests and full builds
|
# Install Homebrew dependencies needed for UI tests and full builds
|
||||||
brew install pkg-config libpng boost abseil ninja gtk+3
|
brew install pkg-config libpng boost abseil ninja gtk+3
|
||||||
|
|
||||||
# Set up vcpkg for Windows builds
|
# Set up vcpkg for Windows builds with fallback
|
||||||
- name: Set up vcpkg (Windows)
|
- name: Set up vcpkg (Windows)
|
||||||
|
id: vcpkg_setup
|
||||||
if: runner.os == 'Windows'
|
if: runner.os == 'Windows'
|
||||||
uses: lukka/run-vcpkg@v11
|
uses: lukka/run-vcpkg@v11
|
||||||
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
vcpkgGitCommitId: 'c8696863d371ab7f46e213d8f5ca923c4aef2a00'
|
vcpkgGitCommitId: 'c8696863d371ab7f46e213d8f5ca923c4aef2a00'
|
||||||
runVcpkgInstall: true
|
runVcpkgInstall: true
|
||||||
@@ -180,6 +182,23 @@ jobs:
|
|||||||
VCPKG_DEFAULT_TRIPLET: ${{ matrix.vcpkg_triplet }}
|
VCPKG_DEFAULT_TRIPLET: ${{ matrix.vcpkg_triplet }}
|
||||||
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
|
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
|
||||||
|
|
||||||
|
# Set vcpkg availability flag when vcpkg succeeds
|
||||||
|
- name: Set vcpkg availability flag
|
||||||
|
if: runner.os == 'Windows' && steps.vcpkg_setup.outcome == 'success'
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
echo "VCPKG_AVAILABLE=true" >> $env:GITHUB_ENV
|
||||||
|
Write-Host "vcpkg setup successful"
|
||||||
|
|
||||||
|
# Fallback: Set minimal build flag when vcpkg fails
|
||||||
|
- name: Set minimal build flag (Windows fallback)
|
||||||
|
if: runner.os == 'Windows' && steps.vcpkg_setup.outcome == 'failure'
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
echo "VCPKG_AVAILABLE=false" >> $env:GITHUB_ENV
|
||||||
|
echo "YAZE_MINIMAL_BUILD=ON" >> $env:GITHUB_ENV
|
||||||
|
Write-Host "vcpkg setup failed, using minimal build configuration"
|
||||||
|
|
||||||
# Configure CMake
|
# Configure CMake
|
||||||
- name: Configure CMake (Linux/macOS)
|
- name: Configure CMake (Linux/macOS)
|
||||||
if: runner.os != 'Windows'
|
if: runner.os != 'Windows'
|
||||||
@@ -203,20 +222,37 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
Write-Host "Configuring CMake for Windows build..."
|
Write-Host "Configuring CMake for Windows build..."
|
||||||
|
|
||||||
# Use vcpkg toolchain
|
# Check if vcpkg is available
|
||||||
cmake -B build `
|
if (Test-Path "${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -and $env:VCPKG_AVAILABLE -ne "false") {
|
||||||
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} `
|
Write-Host "Using vcpkg toolchain..."
|
||||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.16 `
|
cmake -B build `
|
||||||
-DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" `
|
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} `
|
||||||
-DYAZE_BUILD_TESTS=OFF `
|
-DCMAKE_POLICY_VERSION_MINIMUM=3.16 `
|
||||||
-DYAZE_BUILD_EMU=OFF `
|
-DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" `
|
||||||
-DYAZE_BUILD_Z3ED=OFF `
|
-DYAZE_BUILD_TESTS=OFF `
|
||||||
-DYAZE_ENABLE_ROM_TESTS=OFF `
|
-DYAZE_BUILD_EMU=OFF `
|
||||||
-DYAZE_ENABLE_EXPERIMENTAL_TESTS=OFF `
|
-DYAZE_BUILD_Z3ED=OFF `
|
||||||
-DYAZE_INSTALL_LIB=OFF `
|
-DYAZE_ENABLE_ROM_TESTS=OFF `
|
||||||
-DYAZE_MINIMAL_BUILD=OFF `
|
-DYAZE_ENABLE_EXPERIMENTAL_TESTS=OFF `
|
||||||
-G "${{ matrix.cmake_generator }}" `
|
-DYAZE_INSTALL_LIB=OFF `
|
||||||
-A ${{ matrix.cmake_generator_platform }}
|
-DYAZE_MINIMAL_BUILD=OFF `
|
||||||
|
-G "${{ matrix.cmake_generator }}" `
|
||||||
|
-A ${{ matrix.cmake_generator_platform }}
|
||||||
|
} else {
|
||||||
|
Write-Host "Using minimal build configuration (vcpkg not available)..."
|
||||||
|
cmake -B build `
|
||||||
|
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} `
|
||||||
|
-DCMAKE_POLICY_VERSION_MINIMUM=3.16 `
|
||||||
|
-DYAZE_BUILD_TESTS=OFF `
|
||||||
|
-DYAZE_BUILD_EMU=OFF `
|
||||||
|
-DYAZE_BUILD_Z3ED=OFF `
|
||||||
|
-DYAZE_ENABLE_ROM_TESTS=OFF `
|
||||||
|
-DYAZE_ENABLE_EXPERIMENTAL_TESTS=OFF `
|
||||||
|
-DYAZE_INSTALL_LIB=OFF `
|
||||||
|
-DYAZE_MINIMAL_BUILD=ON `
|
||||||
|
-G "${{ matrix.cmake_generator }}" `
|
||||||
|
-A ${{ matrix.cmake_generator_platform }}
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host "CMake configuration completed successfully"
|
Write-Host "CMake configuration completed successfully"
|
||||||
|
|
||||||
|
|||||||
64
.github/workflows/release.yml
vendored
64
.github/workflows/release.yml
vendored
@@ -164,10 +164,12 @@ jobs:
|
|||||||
# Install Homebrew dependencies needed for UI tests and full builds
|
# Install Homebrew dependencies needed for UI tests and full builds
|
||||||
brew install pkg-config libpng boost abseil ninja gtk+3
|
brew install pkg-config libpng boost abseil ninja gtk+3
|
||||||
|
|
||||||
# Set up vcpkg for Windows builds (Abseil removed from vcpkg.json to avoid MSYS2 issues)
|
# Set up vcpkg for Windows builds with fallback
|
||||||
- name: Set up vcpkg (Windows)
|
- name: Set up vcpkg (Windows)
|
||||||
|
id: vcpkg_setup
|
||||||
if: runner.os == 'Windows'
|
if: runner.os == 'Windows'
|
||||||
uses: lukka/run-vcpkg@v11
|
uses: lukka/run-vcpkg@v11
|
||||||
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
vcpkgGitCommitId: 'c8696863d371ab7f46e213d8f5ca923c4aef2a00'
|
vcpkgGitCommitId: 'c8696863d371ab7f46e213d8f5ca923c4aef2a00'
|
||||||
runVcpkgInstall: true
|
runVcpkgInstall: true
|
||||||
@@ -180,6 +182,23 @@ jobs:
|
|||||||
VCPKG_DEFAULT_TRIPLET: ${{ matrix.vcpkg_triplet }}
|
VCPKG_DEFAULT_TRIPLET: ${{ matrix.vcpkg_triplet }}
|
||||||
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
|
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
|
||||||
|
|
||||||
|
# Set vcpkg availability flag when vcpkg succeeds
|
||||||
|
- name: Set vcpkg availability flag
|
||||||
|
if: runner.os == 'Windows' && steps.vcpkg_setup.outcome == 'success'
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
echo "VCPKG_AVAILABLE=true" >> $env:GITHUB_ENV
|
||||||
|
Write-Host "vcpkg setup successful"
|
||||||
|
|
||||||
|
# Fallback: Set minimal build flag when vcpkg fails
|
||||||
|
- name: Set minimal build flag (Windows fallback)
|
||||||
|
if: runner.os == 'Windows' && steps.vcpkg_setup.outcome == 'failure'
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
echo "VCPKG_AVAILABLE=false" >> $env:GITHUB_ENV
|
||||||
|
echo "YAZE_MINIMAL_BUILD=ON" >> $env:GITHUB_ENV
|
||||||
|
Write-Host "vcpkg setup failed, using minimal build configuration"
|
||||||
|
|
||||||
# Configure CMake
|
# Configure CMake
|
||||||
- name: Configure CMake (Linux/macOS)
|
- name: Configure CMake (Linux/macOS)
|
||||||
if: runner.os != 'Windows'
|
if: runner.os != 'Windows'
|
||||||
@@ -202,21 +221,36 @@ jobs:
|
|||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
Write-Host "Configuring CMake for Windows build..."
|
Write-Host "Configuring CMake for Windows build..."
|
||||||
Write-Host "Note: Using source-built Abseil, vcpkg for other dependencies"
|
|
||||||
|
|
||||||
# Use vcpkg toolchain (Abseil will be built from source via cmake/absl.cmake)
|
# Check if vcpkg is available
|
||||||
cmake -B build `
|
if (Test-Path "${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -and $env:VCPKG_AVAILABLE -ne "false") {
|
||||||
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} `
|
Write-Host "Using vcpkg toolchain..."
|
||||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.16 `
|
cmake -B build `
|
||||||
-DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" `
|
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} `
|
||||||
-DYAZE_BUILD_TESTS=OFF `
|
-DCMAKE_POLICY_VERSION_MINIMUM=3.16 `
|
||||||
-DYAZE_BUILD_EMU=OFF `
|
-DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" `
|
||||||
-DYAZE_ENABLE_ROM_TESTS=OFF `
|
-DYAZE_BUILD_TESTS=OFF `
|
||||||
-DYAZE_ENABLE_EXPERIMENTAL_TESTS=OFF `
|
-DYAZE_BUILD_EMU=OFF `
|
||||||
-DYAZE_INSTALL_LIB=OFF `
|
-DYAZE_ENABLE_ROM_TESTS=OFF `
|
||||||
-DYAZE_MINIMAL_BUILD=OFF `
|
-DYAZE_ENABLE_EXPERIMENTAL_TESTS=OFF `
|
||||||
-G "${{ matrix.cmake_generator }}" `
|
-DYAZE_INSTALL_LIB=OFF `
|
||||||
-A ${{ matrix.cmake_generator_platform }}
|
-DYAZE_MINIMAL_BUILD=OFF `
|
||||||
|
-G "${{ matrix.cmake_generator }}" `
|
||||||
|
-A ${{ matrix.cmake_generator_platform }}
|
||||||
|
} else {
|
||||||
|
Write-Host "Using minimal build configuration (vcpkg not available)..."
|
||||||
|
cmake -B build `
|
||||||
|
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} `
|
||||||
|
-DCMAKE_POLICY_VERSION_MINIMUM=3.16 `
|
||||||
|
-DYAZE_BUILD_TESTS=OFF `
|
||||||
|
-DYAZE_BUILD_EMU=OFF `
|
||||||
|
-DYAZE_ENABLE_ROM_TESTS=OFF `
|
||||||
|
-DYAZE_ENABLE_EXPERIMENTAL_TESTS=OFF `
|
||||||
|
-DYAZE_INSTALL_LIB=OFF `
|
||||||
|
-DYAZE_MINIMAL_BUILD=ON `
|
||||||
|
-G "${{ matrix.cmake_generator }}" `
|
||||||
|
-A ${{ matrix.cmake_generator_platform }}
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host "CMake configuration completed successfully"
|
Write-Host "CMake configuration completed successfully"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user