Progmasoft Git

tazel

A build system for C, C++, Objective-C, Objective-C++ and Zig, with C# project files.

Clonegit clone https://git.progmasoft.com/tazel

Install LLVM on Windows CI from its MSI

Windows' tar cannot unpack the zstd archive of LLVM (a frame needs more memory than its
decoder allows). The MSI of LLVM 23.1.5, checked against its SHA-256, is unpacked by an
administrative install, and the directory of its clang.exe goes first on PATH.
Commit
e2c2aac8476e407eeb2d396cc1e0c442291c7874
Author
Leitwolf11 ·
Parents
64f52cb21c76

Files · Download .tar.gz

Changes

 .github/workflows/ci.yml | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2ffa833..6632540 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -64,36 +64,35 @@ jobs:
             if ($_ -match '^(INCLUDE|LIB|LIBPATH|PATH)=(.*)$') { "$($Matches[1])=$($Matches[2])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 }
           }
 
-      # The STL of this Visual Studio needs Clang 22 or newer, which the image does not have: LLVM 23.1.5, checked against
-      # the SHA-256 of its release, comes first on PATH.
+      # The STL of this Visual Studio needs Clang 22 or newer, which the image does not have: LLVM 23.1.5 from its MSI,
+      # checked against the SHA-256 of its release and unpacked by an administrative install, comes first on PATH.
       - name: Restore LLVM
         if: runner.os == 'Windows'
         id: llvm
         uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
         with:
           path: ${{ runner.temp }}/llvm
-          key: llvm-23.1.5-x86_64-pc-windows-msvc
+          key: llvm-23.1.5-win64-msi
 
-      # Windows' own tar (libarchive) unpacks zstd and takes D:\ as a drive, not as a remote host.
       - name: Install LLVM
         if: runner.os == 'Windows' && steps.llvm.outputs.cache-hit != 'true'
         shell: pwsh
         run: |
-          $archive = Join-Path $env:RUNNER_TEMP "llvm.tar.zst"
-          Invoke-WebRequest -Uri "https://github.com/llvm/llvm-project/releases/download/llvmorg-23.1.5/clang%2Bllvm-23.1.5-x86_64-pc-windows-msvc.tar.zst" -OutFile $archive
-          $sha = (Get-FileHash -Algorithm SHA256 $archive).Hash.ToLowerInvariant()
-          if ($sha -ne "b2be33385ddc86e83511417a060de927ae8b09d1f3017cc3cdce5c73cd5029d7") { throw "LLVM has the SHA-256 $sha" }
+          $msi = Join-Path $env:RUNNER_TEMP "llvm.msi"
+          Invoke-WebRequest -Uri "https://github.com/llvm/llvm-project/releases/download/llvmorg-23.1.5/LLVM-23.1.5-win64.msi" -OutFile $msi
+          $sha = (Get-FileHash -Algorithm SHA256 $msi).Hash.ToLowerInvariant()
+          if ($sha -ne "288ab326377157a9e02e6fb9724914cc2b55963882d493a405f31dc66e837c12") { throw "LLVM has the SHA-256 $sha" }
           $llvm = Join-Path $env:RUNNER_TEMP "llvm"
-          New-Item -ItemType Directory -Force $llvm | Out-Null
-          & "$env:SystemRoot\System32\tar.exe" -xf $archive -C $llvm --strip-components 1
-          if ($LASTEXITCODE -ne 0) { throw "tar failed with $LASTEXITCODE" }
+          $process = Start-Process msiexec.exe -ArgumentList "/a", "`"$msi`"", "/qn", "TARGETDIR=`"$llvm`"" -Wait -PassThru
+          if ($process.ExitCode -ne 0) { throw "msiexec failed with $($process.ExitCode)" }
 
       - name: Put LLVM first on PATH
         if: runner.os == 'Windows'
         shell: pwsh
         run: |
-          $path = "${env:RUNNER_TEMP}\llvm\bin;${env:PATH}"
-          "PATH=$path" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
+          $clang = Get-ChildItem -Path (Join-Path $env:RUNNER_TEMP "llvm") -Recurse -Filter clang.exe | Select-Object -First 1
+          if ($null -eq $clang) { throw "the LLVM install has no clang.exe" }
+          "PATH=$($clang.DirectoryName);${env:PATH}" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
 
       # Warnings are errors in every project (Directory.Build.props).
       - name: Build