[llvm-branch-commits] [llvm] workflows: Re-implement the get-llvm-version action as a composite (PR #101554)
Tom Stellard via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Aug 1 13:19:07 PDT 2024
https://github.com/tstellar created https://github.com/llvm/llvm-project/pull/101554
The old version in the llvm/actions repo stopped working after the version variables were moved out of llvm/CMakeLists.txt. Composite actions are more simple and don't require javascript, which is why I reimplemented it as a composite action.
>From 904aab8a345b781c27e5aaa75a8ba64fdef15658 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Thu, 1 Aug 2024 13:09:52 -0700
Subject: [PATCH] workflows: Re-implement the get-llvm-version action as a
composite
The old version in the llvm/actions repo stopped working after the
version variables were moved out of llvm/CMakeLists.txt. Composite
actions are more simple and don't require javascript, which is why
I reimplemented it as a composite action.
---
.github/workflows/get-llvm-version/action.yml | 26 +++++++++++++++++++
.github/workflows/libclang-abi-tests.yml | 16 ++++++------
.github/workflows/llvm-tests.yml | 14 +++++-----
3 files changed, 41 insertions(+), 15 deletions(-)
create mode 100644 .github/workflows/get-llvm-version/action.yml
diff --git a/.github/workflows/get-llvm-version/action.yml b/.github/workflows/get-llvm-version/action.yml
new file mode 100644
index 0000000000000..b33efa67d416b
--- /dev/null
+++ b/.github/workflows/get-llvm-version/action.yml
@@ -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 echo "$v=`llvm/utils/release/get-llvm-version.sh -$v`" >> $GITHUB_OUTPUT
+ done
diff --git a/.github/workflows/libclang-abi-tests.yml b/.github/workflows/libclang-abi-tests.yml
index 972d21c3bcedf..9e839ff49e283 100644
--- a/.github/workflows/libclang-abi-tests.yml
+++ b/.github/workflows/libclang-abi-tests.yml
@@ -33,9 +33,9 @@ jobs:
ABI_HEADERS: ${{ steps.vars.outputs.ABI_HEADERS }}
ABI_LIBS: ${{ steps.vars.outputs.ABI_LIBS }}
BASELINE_VERSION_MAJOR: ${{ steps.vars.outputs.BASELINE_VERSION_MAJOR }}
- LLVM_VERSION_MAJOR: ${{ steps.version.outputs.LLVM_VERSION_MAJOR }}
- LLVM_VERSION_MINOR: ${{ steps.version.outputs.LLVM_VERSION_MINOR }}
- LLVM_VERSION_PATCH: ${{ steps.version.outputs.LLVM_VERSION_PATCH }}
+ LLVM_VERSION_MAJOR: ${{ steps.version.outputs.major }}
+ LLVM_VERSION_MINOR: ${{ steps.version.outputs.minor }}
+ LLVM_VERSION_PATCH: ${{ steps.version.outputs.patch }}
steps:
- name: Checkout source
uses: actions/checkout at v4
@@ -44,14 +44,14 @@ jobs:
- name: Get LLVM version
id: version
- uses: llvm/actions/get-llvm-version at main
+ uses: ./.github/workflows/get-llvm-version
- name: Setup Variables
id: vars
run: |
remote_repo='https://github.com/llvm/llvm-project'
- if [ ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then
- major_version=$(( ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - 1))
+ if [ ${{ steps.version.outputs.patch }} -eq 0 ]; then
+ major_version=$(( ${{ steps.version.outputs.major }} - 1))
baseline_ref="llvmorg-$major_version.1.0"
# If there is a minor release, we want to use that as the base line.
@@ -73,8 +73,8 @@ jobs:
} >> "$GITHUB_OUTPUT"
else
{
- echo "BASELINE_VERSION_MAJOR=${{ steps.version.outputs.LLVM_VERSION_MAJOR }}"
- echo "BASELINE_REF=llvmorg-${{ steps.version.outputs.LLVM_VERSION_MAJOR }}.1.0"
+ echo "BASELINE_VERSION_MAJOR=${{ steps.version.outputs.major }}"
+ echo "BASELINE_REF=llvmorg-${{ steps.version.outputs.major }}.1.0"
echo "ABI_HEADERS=."
echo "ABI_LIBS=libclang.so libclang-cpp.so"
} >> "$GITHUB_OUTPUT"
diff --git a/.github/workflows/llvm-tests.yml b/.github/workflows/llvm-tests.yml
index 64d60bc3da45e..26e644229aaa2 100644
--- a/.github/workflows/llvm-tests.yml
+++ b/.github/workflows/llvm-tests.yml
@@ -43,9 +43,9 @@ jobs:
ABI_HEADERS: ${{ steps.vars.outputs.ABI_HEADERS }}
BASELINE_VERSION_MAJOR: ${{ steps.vars.outputs.BASELINE_VERSION_MAJOR }}
BASELINE_VERSION_MINOR: ${{ steps.vars.outputs.BASELINE_VERSION_MINOR }}
- LLVM_VERSION_MAJOR: ${{ steps.version.outputs.LLVM_VERSION_MAJOR }}
- LLVM_VERSION_MINOR: ${{ steps.version.outputs.LLVM_VERSION_MINOR }}
- LLVM_VERSION_PATCH: ${{ steps.version.outputs.LLVM_VERSION_PATCH }}
+ LLVM_VERSION_MAJOR: ${{ steps.version.outputs.major }}
+ LLVM_VERSION_MINOR: ${{ steps.version.outputs.minor }}
+ LLVM_VERSION_PATCH: ${{ steps.version.outputs.patch }}
steps:
- name: Checkout source
uses: actions/checkout at v4
@@ -54,7 +54,7 @@ jobs:
- name: Get LLVM version
id: version
- uses: llvm/actions/get-llvm-version at main
+ uses: ./.github/workflows/get-llvm-version
- name: Setup Variables
id: vars
@@ -66,14 +66,14 @@ jobs:
# 18.1.0 We want to check 17.0.x
# 18.1.1 We want to check 18.1.0
echo "BASELINE_VERSION_MINOR=1" >> "$GITHUB_OUTPUT"
- if [ ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then
+ if [ ${{ steps.version.outputs.patch }} -eq 0 ]; then
{
- echo "BASELINE_VERSION_MAJOR=$(( ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - 1))"
+ echo "BASELINE_VERSION_MAJOR=$(( ${{ steps.version.outputs.major }} - 1))"
echo "ABI_HEADERS=llvm-c"
} >> "$GITHUB_OUTPUT"
else
{
- echo "BASELINE_VERSION_MAJOR=${{ steps.version.outputs.LLVM_VERSION_MAJOR }}"
+ echo "BASELINE_VERSION_MAJOR=${{ steps.version.outputs.major }}"
echo "ABI_HEADERS=."
} >> "$GITHUB_OUTPUT"
fi
More information about the llvm-branch-commits
mailing list