-
Notifications
You must be signed in to change notification settings - Fork 14.3k
workflows: Re-implement the get-llvm-version action as a composite #101554
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
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Get LLVM Version | ||
description: >- | ||
Get the LLVM version from the llvm-project source tree. This action assumes | ||
the llvm-project sources have already been checked out into GITHUB_WORKSPACE. | ||
|
||
outputs: | ||
major: | ||
description: LLVM major version | ||
value: ${{ steps.version.outputs.major }} | ||
minor: | ||
description: LLVM minor version | ||
value: ${{ steps.version.outputs.minor }} | ||
patch: | ||
description: LLVM patch version | ||
value: ${{ steps.version.outputs.patch }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Get Version | ||
shell: bash | ||
id: version | ||
run: | | ||
for v in major minor patch; do | ||
echo "$v=`llvm/utils/release/get-llvm-version.sh --$v`" >> $GITHUB_OUTPUT | ||
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/usr/bin/env bash | ||
#===-- get-llvm-version.sh - Test the LLVM release candidates --------------===# | ||
# | ||
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
# See https://llvm.org/LICENSE.txt for license information. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
#===------------------------------------------------------------------------===# | ||
# | ||
# Extract the current LLVM version from the CMake files. | ||
# | ||
#===------------------------------------------------------------------------===# | ||
|
||
cmake_file=$(dirname $0)/../../../cmake/Modules/LLVMVersion.cmake | ||
function usage() { | ||
echo "usage: `basename $0`" | ||
echo "" | ||
echo "Calling this script with now options will output the full version: e.g. 19.1.0" | ||
echo " --cmake-file Path to cmake file with the version (default: $cmake_file) | ||
echo " You can use at most one of the following options: | ||
echo " --major Print the major version." | ||
echo " --minor Print the minor version." | ||
echo " --patch Print the patch version." | ||
} | ||
|
||
print="" | ||
|
||
while [ $# -gt 0 ]; do | ||
case $1 in | ||
--cmake-file ) | ||
shift | ||
cmake_file="$1" | ||
;; | ||
--major) | ||
if [ -n "$print" ]; then | ||
echo "Only one of --major, --minor, --patch is allowed" | ||
exit 1 | ||
fi | ||
print="major" | ||
;; | ||
--minor) | ||
if [ -n "$print" ]; then | ||
echo "Only one of --major, --minor, --patch is allowed" | ||
exit 1 | ||
fi | ||
print="minor" | ||
;; | ||
--patch) | ||
if [ -n "$print" ]; then | ||
echo "Only one of --major, --minor, --patch is allowed" | ||
exit 1 | ||
fi | ||
print="patch" | ||
;; | ||
--help | -h | -\? ) | ||
usage | ||
exit 0 | ||
;; | ||
* ) | ||
echo "unknown option: $1" | ||
usage | ||
exit 1 | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
major=`grep -o 'LLVM_VERSION_MAJOR[[:space:]]\+\([0-9]\+\)' $cmake_file | grep -o '[0-9]\+'` | ||
minor=`grep -o 'LLVM_VERSION_MINOR[[:space:]]\+\([0-9]\+\)' $cmake_file | grep -o '[0-9]\+'` | ||
patch=`grep -o 'LLVM_VERSION_PATCH[[:space:]]\+\([0-9]\+\)' $cmake_file | grep -o '[0-9]\+'` | ||
|
||
case $print in | ||
major) | ||
echo "$major" | ||
;; | ||
minor) | ||
echo "$minor" | ||
;; | ||
patch) | ||
echo "$patch" | ||
;; | ||
*) | ||
echo "$major.$minor.$patch" | ||
;; | ||
esac | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment here is copy and paste wrong right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed here: PR#101569. I'll merge #101569 and then backport the change to the release branch.