Skip to content

Commit e4c090b

Browse files
committed
fix(windows-ci): extract LLVM archive with 7-Zip
1 parent f7a96e2 commit e4c090b

2 files changed

Lines changed: 76 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ jobs:
141141
build-windows:
142142
name: Build on Windows (pinned LLVM 20.1.0)
143143
runs-on: windows-2022
144+
timeout-minutes: 45
144145
permissions:
145146
contents: read
146147

@@ -194,7 +195,7 @@ jobs:
194195
path: deps/coretrace-log
195196
fetch-depth: 1
196197

197-
- name: Install LLVM 20.1.0 archive with CMake package files
198+
- name: Install LLVM 20.1.0 archive with 7-Zip
198199
shell: pwsh
199200
run: |
200201
$ErrorActionPreference = "Stop"
@@ -205,15 +206,45 @@ jobs:
205206
$archivePath = Join-Path $env:RUNNER_TEMP $archiveName
206207
$extractRoot = Join-Path $env:RUNNER_TEMP "llvm-extract"
207208
$installRoot = "C:\Program Files\LLVM-$llvmVersion"
209+
$sevenZip = "${env:ProgramFiles}\7-Zip\7z.exe"
210+
$tarPath = Join-Path $env:RUNNER_TEMP "clang+llvm-$llvmVersion-x86_64-pc-windows-msvc.tar"
208211
212+
if (-not (Test-Path $sevenZip)) {
213+
throw "7z.exe not found at $sevenZip"
214+
}
215+
216+
Write-Host "Downloading LLVM archive from $archiveUrl"
209217
Invoke-WebRequest -Uri $archiveUrl -OutFile $archivePath
218+
Write-Host "Download finished"
219+
Get-Item $archivePath | Select-Object FullName, Length | Format-Table -AutoSize
210220
211221
if (Test-Path $extractRoot) {
212222
Remove-Item -Recurse -Force $extractRoot
213223
}
214224
New-Item -ItemType Directory -Force -Path $extractRoot | Out-Null
215225
216-
tar -xJf $archivePath -C $extractRoot
226+
if (Test-Path $tarPath) {
227+
Remove-Item -Force $tarPath
228+
}
229+
230+
Write-Host "Extracting .xz to .tar with 7-Zip"
231+
& $sevenZip x $archivePath "-o$env:RUNNER_TEMP" -y
232+
if ($LASTEXITCODE -ne 0) {
233+
throw "7-Zip failed while extracting .xz archive"
234+
}
235+
236+
if (-not (Test-Path $tarPath)) {
237+
throw "Expected tar file not found after xz extraction: $tarPath"
238+
}
239+
240+
Write-Host "Extracting .tar to $extractRoot"
241+
& $sevenZip x $tarPath "-o$extractRoot" -y
242+
if ($LASTEXITCODE -ne 0) {
243+
throw "7-Zip failed while extracting .tar archive"
244+
}
245+
246+
Write-Host "Listing extracted directories"
247+
Get-ChildItem $extractRoot -Directory | Select-Object Name, FullName | Format-Table -AutoSize
217248
218249
$extractedDir = Get-ChildItem $extractRoot -Directory | Select-Object -First 1
219250
if (-not $extractedDir) {
@@ -231,6 +262,11 @@ jobs:
231262
$llvmConfigPath = Join-Path $llvmCmakeDir "LLVMConfig.cmake"
232263
$clangConfigPath = Join-Path $clangCmakeDir "ClangConfig.cmake"
233264
265+
Write-Host "Checking extracted LLVM files"
266+
Write-Host "clang-cl path: $clangClPath"
267+
Write-Host "LLVMConfig path: $llvmConfigPath"
268+
Write-Host "ClangConfig path: $clangConfigPath"
269+
234270
if (-not (Test-Path $clangClPath)) {
235271
throw "clang-cl.exe not found after LLVM archive extraction: $clangClPath"
236272
}

.github/workflows/release-binaries.yml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ jobs:
9292
build-windows-binary:
9393
name: Build Windows binary (x64, LLVM 20.1.0)
9494
runs-on: windows-2022
95+
timeout-minutes: 45
9596

9697
steps:
9798
- name: Checkout
@@ -155,7 +156,7 @@ jobs:
155156
fi
156157
echo "value=${version}" >> "${GITHUB_OUTPUT}"
157158
158-
- name: Install LLVM 20.1.0 archive with CMake package files
159+
- name: Install LLVM 20.1.0 archive with 7-Zip
159160
shell: pwsh
160161
run: |
161162
$ErrorActionPreference = "Stop"
@@ -166,15 +167,45 @@ jobs:
166167
$archivePath = Join-Path $env:RUNNER_TEMP $archiveName
167168
$extractRoot = Join-Path $env:RUNNER_TEMP "llvm-extract"
168169
$installRoot = "C:\Program Files\LLVM-$llvmVersion"
170+
$sevenZip = "${env:ProgramFiles}\7-Zip\7z.exe"
171+
$tarPath = Join-Path $env:RUNNER_TEMP "clang+llvm-$llvmVersion-x86_64-pc-windows-msvc.tar"
169172
173+
if (-not (Test-Path $sevenZip)) {
174+
throw "7z.exe not found at $sevenZip"
175+
}
176+
177+
Write-Host "Downloading LLVM archive from $archiveUrl"
170178
Invoke-WebRequest -Uri $archiveUrl -OutFile $archivePath
179+
Write-Host "Download finished"
180+
Get-Item $archivePath | Select-Object FullName, Length | Format-Table -AutoSize
171181
172182
if (Test-Path $extractRoot) {
173183
Remove-Item -Recurse -Force $extractRoot
174184
}
175185
New-Item -ItemType Directory -Force -Path $extractRoot | Out-Null
176186
177-
tar -xJf $archivePath -C $extractRoot
187+
if (Test-Path $tarPath) {
188+
Remove-Item -Force $tarPath
189+
}
190+
191+
Write-Host "Extracting .xz to .tar with 7-Zip"
192+
& $sevenZip x $archivePath "-o$env:RUNNER_TEMP" -y
193+
if ($LASTEXITCODE -ne 0) {
194+
throw "7-Zip failed while extracting .xz archive"
195+
}
196+
197+
if (-not (Test-Path $tarPath)) {
198+
throw "Expected tar file not found after xz extraction: $tarPath"
199+
}
200+
201+
Write-Host "Extracting .tar to $extractRoot"
202+
& $sevenZip x $tarPath "-o$extractRoot" -y
203+
if ($LASTEXITCODE -ne 0) {
204+
throw "7-Zip failed while extracting .tar archive"
205+
}
206+
207+
Write-Host "Listing extracted directories"
208+
Get-ChildItem $extractRoot -Directory | Select-Object Name, FullName | Format-Table -AutoSize
178209
179210
$extractedDir = Get-ChildItem $extractRoot -Directory | Select-Object -First 1
180211
if (-not $extractedDir) {
@@ -192,6 +223,11 @@ jobs:
192223
$llvmConfigPath = Join-Path $llvmCmakeDir "LLVMConfig.cmake"
193224
$clangConfigPath = Join-Path $clangCmakeDir "ClangConfig.cmake"
194225
226+
Write-Host "Checking extracted LLVM files"
227+
Write-Host "clang-cl path: $clangClPath"
228+
Write-Host "LLVMConfig path: $llvmConfigPath"
229+
Write-Host "ClangConfig path: $clangConfigPath"
230+
195231
if (-not (Test-Path $clangClPath)) {
196232
throw "clang-cl.exe not found after LLVM archive extraction: $clangClPath"
197233
}

0 commit comments

Comments
 (0)