From a8ae108e8a25918d91a374b5688ea03d0147f722 Mon Sep 17 00:00:00 2001 From: scawful Date: Wed, 15 Oct 2025 01:09:33 -0400 Subject: [PATCH] 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. --- .github/workflows/ci.yml | 15 ++++++++++++++- .github/workflows/release.yml | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bdc2e806..d3b8748c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 21fa8aab..00bcef61 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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'