Skip to content

Commit 1cc5f87

Browse files
committed
Integrate into main release workflow
1 parent 90cc60a commit 1cc5f87

File tree

2 files changed

+54
-5
lines changed

2 files changed

+54
-5
lines changed

.github/workflows/release-binaries-all.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ jobs:
9191
- ubuntu-22.04
9292
- ubuntu-22.04-arm
9393
- macos-14
94+
- windows-2022
9495

9596
uses: ./.github/workflows/release-binaries.yml
9697
with:

.github/workflows/release-binaries.yml

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,17 @@ jobs:
8686
shell: bash
8787
run: |
8888
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user "$GITHUB_ACTOR" --user-token "$USER_TOKEN" check-permissions
89+
90+
# The name of the Windows binaries uses the version from source, so we need
91+
# to fetch it here.
92+
- id: version-from-source
93+
if: runner.os == 'Windows'
94+
uses: ./.github/workflows/get-llvm-version
8995

9096
- name: Collect Variables
9197
id: vars
98+
env:
99+
LLVM_VERSION_FROM_SOURCE: ${{ format('{0}.{1}.{2}', steps.version.outputs.major, steps.version.outputs.minor, steps.version.outputs.patch) }}
92100
shell: bash
93101
# In order for the test-release.sh script to run correctly, the LLVM
94102
# source needs to be at the following location relative to the build dir:
@@ -104,7 +112,11 @@ jobs:
104112
release_version="$trimmed"
105113
ref="llvmorg-$release_version"
106114
else
107-
release_version="${{ (github.event_name == 'pull_request' && format('PR{0}', github.event.pull_request.number)) || 'CI'}}-$GITHUB_SHA"
115+
if [ "$RUNNER_OS" = "Windows" ]; then
116+
release_version="$LLVM_VERSION_FROM_SOURCE"
117+
else
118+
release_version="${{ (github.event_name == 'pull_request' && format('PR{0}', github.event.pull_request.number)) || 'CI'}}-$GITHUB_SHA"
119+
fi
108120
ref="$GITHUB_SHA"
109121
fi
110122
if [ -n "${{ inputs.upload }}" ]; then
@@ -116,7 +128,19 @@ jobs:
116128
echo "ref=$ref" >> $GITHUB_OUTPUT
117129
echo "upload=$upload" >> $GITHUB_OUTPUT
118130
119-
release_binary_basename="LLVM-$release_version-$RUNNER_OS-$RUNNER_ARCH"
131+
if [ "$RUNNER_OS" = "Windows" ]; then
132+
case $RUNNER_ARCH in
133+
"X64" )
134+
tar_arch="x86_64"
135+
;;
136+
"ARM64" )
137+
tar_arch="aarch64"
138+
;;
139+
esac
140+
release_binary_basename="LLVM-$release_version-$tar_arch-pc-windows-msvc"
141+
else
142+
release_binary_basename="LLVM-$release_version-$RUNNER_OS-$RUNNER_ARCH"
143+
fi
120144
echo "release-binary-basename=$release_binary_basename" >> $GITHUB_OUTPUT
121145
echo "release-binary-filename=$release_binary_basename.tar.xz" >> $GITHUB_OUTPUT
122146
@@ -202,8 +226,9 @@ jobs:
202226
fi
203227
echo "build-prefix=$build_prefix" >> $GITHUB_OUTPUT
204228
205-
- name: Configure
229+
- name: Configure Linux/MacOS
206230
id: build
231+
if: runner.os != 'Windows'
207232
shell: bash
208233
run: |
209234
# There were some issues on the ARM64 MacOS runners with trying to build x86 object,
@@ -212,32 +237,55 @@ jobs:
212237
${{ needs.prepare.outputs.target-cmake-flags }} \
213238
-C clang/cmake/caches/Release.cmake
214239
215-
- name: Build
240+
- name: Build Linux/MacOS
241+
if: runner.os != 'Windows'
216242
shell: bash
217243
run: |
218244
ninja -v -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-package
219245
release_dir=`find ${{ steps.setup-stage.outputs.build-prefix }}/build -iname 'stage2-bins'`
220246
mv $release_dir/${{ needs.prepare.outputs.release-binary-filename }} .
221247
248+
249+
- name: Build Windows
250+
id: build-windows
251+
if: runner.os == 'Windows'
252+
env:
253+
INSTALLER_ARCH:
254+
run: |
255+
subst S: ${{ github.workspace }}
256+
cd S:\llvm\utils\release\
257+
.\build_llvm_release.bat "--$($env:RUNNER_ARCH.ToLower())" --version $env:LLVM_VERSION --local-python --skip-checkout
258+
$installer = (Get-ChildItem -Recurse -Filter "*.exe" | Select-Object -First 1).fullName
259+
$tarball = (Get-ChildItem -Recurse -Filter "*.tar.xz" | Select-Object -First 1).fullName
260+
# Move installer to top-level directory so it is easier to upload.
261+
mv $installer $env:GITHUB_WORKSPACE
262+
mv $tarball $env:GITHUB_WORKSPACE
263+
echo "windows-installer-filename=$installer" >> $env:GITHUB_OUTPUT
264+
222265
- name: Generate sha256 digest for binaries
223266
id: digest
224267
shell: bash
225268
env:
226269
RELEASE_BINARY_FILENAME: ${{ needs.prepare.outputs.release-binary-filename }}
270+
# This will be empty on non-Windows builds.
271+
WINDOWS_INSTALLER_FILENAME: ${{ steps.build-windows.outputs.windows-installer-filename }}
227272
run: |
228-
echo "digest=$(cat $RELEASE_BINARY_FILENAME | sha256sum | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
273+
echo "digest=$(cat $WINDOWS_INSTALLER_FILENAME $RELEASE_BINARY_FILENAME | sha256sum | cut -d ' ' -f 1)" >> $GITHUB_OUTPUT
229274
230275
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
231276
id: artifact-upload
232277
with:
233278
name: ${{ runner.os }}-${{ runner.arch }}-release-binary
234279
# Due to path differences on Windows when running in bash vs running on node,
235280
# we need to search for files in the current workspace.
281+
# The steps.build-windows.* variables will be empty on Linux/MacOS.
236282
path: |
237283
${{ needs.prepare.outputs.release-binary-filename }}
284+
${{ steps.build-windows.outputs.windows-installer-filename }}
238285
239286
- name: Run Tests
240287
# These almost always fail so don't let them fail the build and prevent the uploads.
288+
if : runner.os != 'Windows'
241289
continue-on-error: true
242290
run: |
243291
ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-check-all

0 commit comments

Comments
 (0)