Skip to content

workflows/release-binaries: Enable Windows x86 builds #128274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 1 addition & 4 deletions .github/workflows/release-binaries-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,7 @@ jobs:
# We use ubuntu-22.04 rather than the latest version to make the built
# binaries more portable (eg functional aginast older glibc).
runs-on:
- ubuntu-22.04
- ubuntu-22.04-arm
- macos-13
- macos-14
- windows-2022

uses: ./.github/workflows/release-binaries.yml
with:
Expand Down
41 changes: 32 additions & 9 deletions .github/workflows/release-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ on:
- ubuntu-22.04-arm
- macos-13
- macos-14
- windows-2022

workflow_call:
inputs:
Expand Down Expand Up @@ -66,6 +67,8 @@ jobs:
test-runs-on: ${{ steps.vars.outputs.build-runs-on }}

steps:
- run: |
New-Item -Path "c:\actions-runner\llvm-project\llvm-project\build\tools\clang\tools\extra\clang-tidy\misc\ConfusableTable\CMakeFiles\clang-tidy-confusable-chars-gen.dir\C_\actions-runner\llvm-project\llvm-project\llvm" -ItemType Directory
# It's good practice to use setup-python, but this is also required on macos-14
# due to https://github.com/actions/runner-images/issues/10385
- uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f
Expand All @@ -89,6 +92,9 @@ jobs:
run: |
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user "$GITHUB_ACTOR" --user-token "$USER_TOKEN" check-permissions

- name: Check long paths
run: |
Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled'
- name: Collect Variables
id: vars
shell: bash
Expand Down Expand Up @@ -118,9 +124,15 @@ jobs:
echo "ref=$ref" >> $GITHUB_OUTPUT
echo "upload=$upload" >> $GITHUB_OUTPUT

if [ "$RUNNER_OS" = "Windows" ]; then
release_binary_suffix="exe"
else
release_binary_suffix="tar.xz"
fi

release_binary_basename="LLVM-$release_version-$RUNNER_OS-$RUNNER_ARCH"
echo "release-binary-basename=$release_binary_basename" >> $GITHUB_OUTPUT
echo "release-binary-filename=$release_binary_basename.tar.xz" >> $GITHUB_OUTPUT
echo "release-binary-filename=$release_binary_basename.$release_binary_suffix" >> $GITHUB_OUTPUT

target="$RUNNER_OS-$RUNNER_ARCH"
# The hendrikmuhs/ccache-action action does not support installing sccache
Expand Down Expand Up @@ -151,15 +163,10 @@ jobs:

build_flang="true"

if [ "$RUNNER_OS" = "Windows" ]; then
# The build times out on Windows, so we need to disable LTO.
target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF"
fi

echo "target-cmake-flags=$target_cmake_flags" >> $GITHUB_OUTPUT
echo "build-flang=$build_flang" >> $GITHUB_OUTPUT
case "${{ inputs.runs-on }}" in
ubuntu-22.04*)
ubuntu-22.04*|windows-2022)
build_runs_on="depot-${{ inputs.runs-on }}-16"
test_runs_on=$build_runs_on
;;
Expand Down Expand Up @@ -193,7 +200,9 @@ jobs:
if: github.repository_owner == 'llvm'
runs-on: ${{ needs.prepare.outputs.build-runs-on }}
steps:

- name: Check long paths
run: |
Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled'
- name: Checkout Actions
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
Expand Down Expand Up @@ -241,14 +250,23 @@ jobs:
${{ needs.prepare.outputs.target-cmake-flags }} \
-C clang/cmake/caches/Release.cmake \
-DBOOTSTRAP_LLVM_PARALLEL_LINK_JOBS=1 \
-DCMAKE_OBJECT_PATH_MAX=450 \
-DBOOTSTRAP_BOOTSTRAP_CPACK_PACKAGE_FILE_NAME="${{ needs.prepare.outputs.release-binary-basename }}"

- name: Build
- name: Build Unix
shell: bash
if: runner.os != 'Windows'
run: |
ninja -v -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-package
release_dir=`find ${{ steps.setup-stage.outputs.build-prefix }}/build -iname 'stage2-bins'`
mv $release_dir/${{ needs.prepare.outputs.release-binary-filename }} .

# There is an issue with building on Windows with bash so we use power shell.
# ninja: error: mkdir(tools/clang/tools/extra/clang-tidy/misc/ConfusableTable/CMakeFiles/clang-tidy-confusable-chars-gen.dir/C_/actions-runner/llvm-project/llvm-project/llvm): No such file or directory
- name: Build Windows
if: runner.os == 'Windows'
run: |
ninja -v -C build stage2-package

- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
with:
Expand All @@ -270,6 +288,11 @@ jobs:
with:
build-prefix: ${{ steps.setup-stage.outputs.build-prefix }}

- name: Check Disk
if: always()
run: |
Get-WmiObject -Class Win32_LogicalDisk -ComputerName LOCALHOST | ? {$_. DriveType -eq 3} | select DeviceID, {$_.Size /1GB}, {$_.FreeSpace /1GB}

upload-release-binaries:
name: "Upload Release Binaries"
needs:
Expand Down
9 changes: 7 additions & 2 deletions clang/cmake/caches/Release.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
set(STAGE1_PROJECTS "clang")

# Build all runtimes so we can statically link them into the stage2 compiler.
set(STAGE1_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind")
set(STAGE1_RUNTIMES ${DEFAULT_RUNTIMES})

if (LLVM_RELEASE_ENABLE_PGO)
list(APPEND STAGE1_PROJECTS "lld")
Expand Down Expand Up @@ -140,7 +140,12 @@ set_final_stage_var(LLVM_ENABLE_PROJECTS "${LLVM_RELEASE_ENABLE_PROJECTS}" STRIN
if (${CMAKE_HOST_SYSTEM_NAME} MATCHES "Linux")
set_final_stage_var(CLANG_BOLT "INSTRUMENT" STRING)
endif()
set_final_stage_var(CPACK_GENERATOR "TXZ" STRING)
# We want to generate an installer on Windows.
if(NOT ${CMAKE_HOST_SYSTEM_NAME} MATCHES "Windows")
set_final_stage_var(CPACK_GENERATOR "TXZ" STRING)
else()
set_final_stage_var(CMAKE_OBJECT_PATH_MAX "1024" STRING)
endif()
set_final_stage_var(CPACK_ARCHIVE_THREADS "0" STRING)

set_final_stage_var(LLVM_USE_STATIC_ZSTD "ON" BOOL)
Loading