Skip to content

Commit 8dc19da

Browse files
committed
[CI][Github] Install Clang in Windows container
Downloads clang-for-windows from the LLVM releases website, decompresses and untars the images, and leave them in C:\clang\clang-msvc\... Temporarily downloads the 'xz' utility to decompress the downloaded clang tarball image.
1 parent 7a73a8b commit 8dc19da

File tree

1 file changed

+34
-0
lines changed
  • .github/workflows/containers/github-action-ci-windows

1 file changed

+34
-0
lines changed

.github/workflows/containers/github-action-ci-windows/Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,37 @@ RUN powershell -Command \
9898
Add-Type -AssemblyName System.IO.Compression.FileSystem ; \
9999
[System.IO.Compression.ZipFile]::ExtractToDirectory('actions-runner-win.zip', $PWD) ;\
100100
rm actions-runner-win.zip
101+
102+
# Download and extract Clang compiler.
103+
# Create directories, download, extract, and clean up all in one layer
104+
RUN powershell -Command \
105+
# --- Setup directories --- \
106+
Write-Host "Creating directories..."; \
107+
New-Item -Path "C:\temp-download" -ItemType "Directory" -Force ; \
108+
New-Item -Path "C:\xz-utils" -ItemType "Directory" -Force ; \
109+
New-Item -Path "C:\clang" -ItemType "Directory" -Force ; \
110+
# --- 1. Download and extract xz --- \
111+
Set-Location C:\temp-download ; \
112+
Write-Host "Downloading xz-utils..."; \
113+
Invoke-WebRequest -Uri "http://github.com/tukaani-project/xz/releases/download/v5.8.1/xz-5.8.1-windows.zip" -OutFile "xz.zip"; \
114+
Write-Host "Extracting xz-utils..."; \
115+
Add-Type -AssemblyName "System.IO.Compression.FileSystem"; \
116+
[System.IO.Compression.ZipFile]::ExtractToDirectory('C:\temp-download\xz.zip', 'C:\xz-utils'); \
117+
# --- 2. Download and decompress Clang --- \
118+
Write-Host "Downloading Clang..."; \
119+
Invoke-WebRequest -Uri "http://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.2/clang+llvm-21.1.2-x86_64-pc-windows-msvc.tar.xz" -OutFile "clang+llvm-21.1.2-x86_64-pc-windows-msvc.tar.xz" ; \
120+
Write-Host "Decompressing clang.tar.xz using C:\xz-utils\bin_x86-64\xz.exe"; \
121+
C:\xz-utils\bin_x86-64\xz.exe -d -qq clang+llvm-21.1.2-x86_64-pc-windows-msvc.tar.xz ; \
122+
# --- 3. Extract clang --- \
123+
Write-Host "Extracting clang.tar to C:\clang ..."; \
124+
C:\Windows\System32\tar.exe -xf clang+llvm-21.1.2-x86_64-pc-windows-msvc.tar -C C:\clang ; \
125+
# --- 4. Clean up --- \
126+
Write-Host "Cleaning up..." ; \
127+
Set-Location C:\ ; \
128+
Remove-Item C:\temp-download -Recurse -Force; \
129+
Remove-Item C:\xz-utils -Recurse -Force; \
130+
Write-Host "Download and extraction complete." ;
131+
132+
RUN powershell -Command \
133+
Set-Location C:\clang ; \
134+
Rename-Item -Path "C:\clang\clang+llvm-21.1.2-x86_64-pc-windows-msvc" -NewName "C:\clang\clang-msvc" ;

0 commit comments

Comments
 (0)