Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/containers/github-action-ci-windows/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,37 @@ RUN powershell -Command \
Add-Type -AssemblyName System.IO.Compression.FileSystem ; \
[System.IO.Compression.ZipFile]::ExtractToDirectory('actions-runner-win.zip', $PWD) ;\
rm actions-runner-win.zip

# Download and extract Clang compiler.
# Create directories, download, extract, and clean up all in one layer
RUN powershell -Command \
# --- Setup directories --- \
Write-Host "Creating directories..."; \
New-Item -Path "C:\temp-download" -ItemType "Directory" -Force ; \
New-Item -Path "C:\xz-utils" -ItemType "Directory" -Force ; \
New-Item -Path "C:\clang" -ItemType "Directory" -Force ; \
# --- 1. Download and extract xz --- \
Set-Location C:\temp-download ; \
Write-Host "Downloading xz-utils..."; \
Invoke-WebRequest -Uri "https://github.com/tukaani-project/xz/releases/download/v5.8.1/xz-5.8.1-windows.zip" -OutFile "xz.zip"; \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to verify a checksum here? Similar to what we do for sccache in the linux container:

echo $( [ $(arch) = 'x86_64' ] && echo "1fbb35e135660d04a2d5e42b59c7874d39b3deb17de56330b25b713ec59f849b" || echo "d6a1ce4acd02b937cd61bc675a8be029a60f7bc167594c33d75732bbc0a07400") /tmp/sccache.tar.gz | sha256sum -c && \

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done (I think).

Write-Host "Extracting xz-utils..."; \
Add-Type -AssemblyName "System.IO.Compression.FileSystem"; \
[System.IO.Compression.ZipFile]::ExtractToDirectory('C:\temp-download\xz.zip', 'C:\xz-utils'); \
# --- 2. Download and decompress Clang --- \
Write-Host "Downloading Clang..."; \
Invoke-WebRequest -Uri "https://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" ; \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we pull the version number here into an ENV line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Write-Host "Decompressing clang.tar.xz using C:\xz-utils\bin_x86-64\xz.exe"; \
C:\xz-utils\bin_x86-64\xz.exe -d -qq clang+llvm-21.1.2-x86_64-pc-windows-msvc.tar.xz ; \
# --- 3. Extract clang --- \
Write-Host "Extracting clang.tar to C:\clang ..."; \
C:\Windows\System32\tar.exe -xf clang+llvm-21.1.2-x86_64-pc-windows-msvc.tar -C C:\clang ; \
# --- 4. Clean up --- \
Write-Host "Cleaning up..." ; \
Set-Location C:\ ; \
Remove-Item C:\temp-download -Recurse -Force; \
Remove-Item C:\xz-utils -Recurse -Force; \
Write-Host "Download and extraction complete." ;

RUN powershell -Command \
Set-Location C:\clang ; \
Rename-Item -Path "C:\clang\clang+llvm-21.1.2-x86_64-pc-windows-msvc" -NewName "C:\clang\clang-msvc" ;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the binary? Why are we renaming it to clang-msvc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that's not the binary. That's the directory into which tar untar'd everything. I'm shortening the path name. With this renaming, the clang-cl binary is in C:\clang\clang-msvc\bin\clang-cl.exe I thought the very long path name would be a pain to type and a likely source of typos.

Loading