feat(ci): update Ninja installation method for Windows in CI and release workflows

- Replaced the previous method of installing Ninja with a PowerShell script that downloads and extracts Ninja directly from the official release.
- This change ensures that the installation process is more reliable and provides immediate feedback if the installation fails.

Benefits:
- Enhances the setup process for Windows environments by ensuring Ninja is correctly installed, leading to improved build efficiency.
This commit is contained in:
scawful
2025-10-15 01:09:33 -04:00
parent e2bee5b3ba
commit a8ae108e8a
2 changed files with 28 additions and 2 deletions

View File

@@ -71,7 +71,20 @@ jobs:
- name: Install Ninja (Windows)
if: runner.os == 'Windows'
uses: seanmiddleditch/gha-setup-ninja@v1
shell: pwsh
run: |
$ninjaDir = Join-Path $env:RUNNER_TEMP "ninja"
New-Item -ItemType Directory -Force -Path $ninjaDir | Out-Null
Invoke-WebRequest -Uri "https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-win.zip" -OutFile "$ninjaDir\ninja.zip"
Expand-Archive "$ninjaDir\ninja.zip" -DestinationPath $ninjaDir -Force
$ninjaExe = Join-Path $ninjaDir "ninja.exe"
if (-not (Test-Path $ninjaExe)) {
Write-Host "::error::ninja.exe not found after extraction"
exit 1
}
Write-Host "Ninja installed at $ninjaExe"
"$ninjaDir" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
ninja --version
- name: Set up vcpkg (Windows)
if: runner.os == 'Windows'

View File

@@ -145,7 +145,20 @@ jobs:
- name: "Install Ninja (Windows only)"
if: runner.os == 'Windows'
uses: seanmiddleditch/gha-setup-ninja@v1
shell: pwsh
run: |
$ninjaDir = Join-Path $env:RUNNER_TEMP "ninja"
New-Item -ItemType Directory -Force -Path $ninjaDir | Out-Null
Invoke-WebRequest -Uri "https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-win.zip" -OutFile "$ninjaDir\ninja.zip"
Expand-Archive "$ninjaDir\ninja.zip" -DestinationPath $ninjaDir -Force
$ninjaExe = Join-Path $ninjaDir "ninja.exe"
if (-not (Test-Path $ninjaExe)) {
Write-Host "::error::ninja.exe not found after extraction"
exit 1
}
Write-Host "Ninja installed at $ninjaExe"
"$ninjaDir" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
ninja --version
- name: "Set up vcpkg (Windows only)"
if: runner.os == 'Windows'