Skip to content
Merged
Changes from 4 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
25 changes: 23 additions & 2 deletions .github/workflows/on-push-verification-in-tree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,30 @@ jobs:
- name: Checkout opencl-clang sources for action files
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

# This step will fail when the branch naming scheme 'ocl-open-XXX' changes!
- name: Parse LLVM version from branch name
id: check-llvm-version
run: |
BRANCH="${{ github.base_ref }}" # on: pull_request, otherwise null
BRANCH=${BRANCH:-${{ github.ref_name }}} # on: push
# Extract the padded LLVM version (e.g., 190 for LLVM 19)
LLVM_VERSION_PADDED=$(echo $BRANCH | grep -oP 'ocl-open-\K\d+')
if [ -z "$LLVM_VERSION_PADDED" ]; then
echo "[OPENCL-CLANG] Error: Could not parse LLVM version from branch name '$BRANCH'"
exit 1
fi
# Extract the actual LLVM version (e.g., 19 from 190)
if [[ "$LLVM_VERSION_PADDED" =~ ^([0-9]+)0$ ]]; then
LLVM_VERSION_SHORT="${BASH_REMATCH[1]}"
else
echo "[OPENCL-CLANG] Error: Unexpected LLVM version format '$LLVM_VERSION_PADDED' from branch name '$BRANCH'"
Comment on lines +51 to +54
Copy link

Copilot AI Nov 23, 2025

Choose a reason for hiding this comment

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

The regex pattern ^([0-9]+)0$ assumes all LLVM versions end with a zero (e.g., 190 for LLVM 19), but this won't work correctly for versions like 100 (LLVM 10) which would be incorrectly parsed as LLVM 10 instead of LLVM 1. Consider validating that the version is at least two digits or adjusting the logic to handle single-digit major versions differently.

Suggested change
if [[ "$LLVM_VERSION_PADDED" =~ ^([0-9]+)0$ ]]; then
LLVM_VERSION_SHORT="${BASH_REMATCH[1]}"
else
echo "[OPENCL-CLANG] Error: Unexpected LLVM version format '$LLVM_VERSION_PADDED' from branch name '$BRANCH'"
# Accept only two- or three-digit numbers ending in zero (e.g., 190 for LLVM 19, 100 for LLVM 10)
if [[ "$LLVM_VERSION_PADDED" =~ ^([1-9][0-9]{1,2})0$ ]]; then
LLVM_VERSION_SHORT="${BASH_REMATCH[1]}"
else
echo "[OPENCL-CLANG] Error: Unexpected LLVM version format '$LLVM_VERSION_PADDED' from branch name '$BRANCH'. Expected a two- or three-digit number ending in zero (e.g., 190 for LLVM 19, 100 for LLVM 10)."

Copilot uses AI. Check for mistakes.
exit 1
fi
echo "llvm_version=$LLVM_VERSION_SHORT" >> $GITHUB_OUTPUT

- name: Run build-opencl-clang action
uses: ./.github/actions/build-opencl-clang
with:
ref_llvm: main
ref_translator: main
ref_llvm: release/${{ steps.check-llvm-version.outputs.llvm_version }}.x
ref_translator: llvm_release_${{ steps.check-llvm-version.outputs.llvm_version }}0
ref_opencl-clang: ${{ github.ref }}
Loading