[llvm] Add macOS premerge check workflow (PR #207435)
Mishal Shah via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 13 23:20:57 PDT 2026
https://github.com/shahmishal updated https://github.com/llvm/llvm-project/pull/207435
>From 4592973b72322eec62908bbec6409cb6b9b3ff90 Mon Sep 17 00:00:00 2001
From: Mishal Shah <mishal_shah at apple.com>
Date: Fri, 3 Jul 2026 10:41:33 -0700
Subject: [PATCH 01/16] Add macOS premerge check workflow
Added a premerge check workflow for macOS self-hosted runners to build and test projects.
---
.github/workflows/premerge.yaml | 38 +++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index d506e631e2f21..4825b80da2c76 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -248,3 +248,41 @@ jobs:
# The libcxx tests fail, so we are skipping the runtime targets.
ninja -C build ${project_check_targets}
+
+ premerge-check-macos-self-hosted-runners:
+ name: Build and Test macOS
+ runs-on: [self-hosted, macos, apple-runners]
+ if: >-
+ github.repository_owner == 'llvm' &&
+ (github.event_name != 'pull_request' || github.event.action != 'closed')
+ steps:
+ - name: Checkout LLVM
+ uses: actions/checkout at de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ persist-credentials: false
+ fetch-depth: 2
+ - name: Install Ninja
+ run: |
+ brew install ninja
+ - name: Build and Test
+ run: |
+ source <(git diff --name-only HEAD~1...HEAD | python3 .ci/compute_projects.py)
+
+ if [[ "${projects_to_build}" == "" ]]; then
+ echo "No projects to build"
+ exit 0
+ fi
+
+ echo "Building projects: ${projects_to_build}"
+ echo "Running project checks targets: ${project_check_targets}"
+
+ xcrun cmake -G Ninja \
+ -B build \
+ -S llvm \
+ -DLLVM_ENABLE_PROJECTS="${projects_to_build}" \
+ -DLLVM_DISABLE_ASSEMBLY_FILES=ON \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DLLDB_INCLUDE_TESTS=OFF \
+ -DLLVM_ENABLE_ASSERTIONS=ON \
+
+ ninja -C build ${project_check_targets}
>From 880315710e05b23174e500f50618fea78c691d37 Mon Sep 17 00:00:00 2001
From: Mishal Shah <mishal_shah at apple.com>
Date: Fri, 3 Jul 2026 23:38:41 -0700
Subject: [PATCH 02/16] Enhance debug output in premerge workflow
Added debug statements to display changed files and building information.
---
.github/workflows/premerge.yaml | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 4825b80da2c76..18fc6eb01c409 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -266,16 +266,23 @@ jobs:
brew install ninja
- name: Build and Test
run: |
+ echo "** Debug **"
+ git diff --name-only HEAD~1...HEAD
+ echo "** Debug **"
+
source <(git diff --name-only HEAD~1...HEAD | python3 .ci/compute_projects.py)
+ echo "Building projects: ${projects_to_build}"
+ echo "Running project checks targets: ${project_check_targets}"
+ echo "Building runtimes: ${runtimes_to_build}"
+ echo "Running runtimes checks targets: ${runtimes_check_targets}"
+ echo "Running runtimes checks requiring reconfiguring targets: ${runtimes_check_targets_needs_reconfig}"
+
if [[ "${projects_to_build}" == "" ]]; then
echo "No projects to build"
exit 0
fi
- echo "Building projects: ${projects_to_build}"
- echo "Running project checks targets: ${project_check_targets}"
-
xcrun cmake -G Ninja \
-B build \
-S llvm \
>From 263f980a7052f165f26e8e4f7a49cb890966cfc4 Mon Sep 17 00:00:00 2001
From: Mishal Shah <mishal_shah at apple.com>
Date: Sat, 4 Jul 2026 00:02:52 -0700
Subject: [PATCH 03/16] [Github] Fix macOS self-hosted premerge env var
sourcing
source <(...) via process substitution silently produces empty variables under macOS's bash 3.2, causing the job to skip building any projects. Write compute_projects.py output to a temp file and source that instead.
---
.github/workflows/premerge.yaml | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 18fc6eb01c409..2a1aa447fcd54 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -266,11 +266,8 @@ jobs:
brew install ninja
- name: Build and Test
run: |
- echo "** Debug **"
- git diff --name-only HEAD~1...HEAD
- echo "** Debug **"
-
- source <(git diff --name-only HEAD~1...HEAD | python3 .ci/compute_projects.py)
+ git diff --name-only HEAD~1...HEAD | python3 .ci/compute_projects.py > /tmp/env_vars.sh
+ source /tmp/env_vars.sh
echo "Building projects: ${projects_to_build}"
echo "Running project checks targets: ${project_check_targets}"
>From 2199a83060a8be8ff078e085484377ea0b8c0e5c Mon Sep 17 00:00:00 2001
From: Mishal Shah <mishal_shah at apple.com>
Date: Sat, 4 Jul 2026 00:12:13 -0700
Subject: [PATCH 04/16] [Github] Install cmake for macOS self-hosted premerge
runners
---
.github/workflows/premerge.yaml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 2a1aa447fcd54..fb5f1d53cf4fb 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -261,9 +261,9 @@ jobs:
with:
persist-credentials: false
fetch-depth: 2
- - name: Install Ninja
+ - name: Install Ninja and CMake
run: |
- brew install ninja
+ brew install ninja cmake
- name: Build and Test
run: |
git diff --name-only HEAD~1...HEAD | python3 .ci/compute_projects.py > /tmp/env_vars.sh
>From 93c134991bcf979144dbd0471b68763e58ea35a8 Mon Sep 17 00:00:00 2001
From: Mishal Shah <mishal_shah at apple.com>
Date: Tue, 7 Jul 2026 11:25:14 -0700
Subject: [PATCH 05/16] [Github] Add sccache S3 support for macOS self-hosted
premerge runners
Configures sccache with the sccache-bucket S3 bucket (us-west-2) for
the self-hosted macOS premerge job to speed up rebuilds.
---
.github/workflows/premerge.yaml | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index fb5f1d53cf4fb..0d2b6554fd0c6 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -261,10 +261,14 @@ jobs:
with:
persist-credentials: false
fetch-depth: 2
- - name: Install Ninja and CMake
+ - name: Install Ninja, CMake, and sccache
run: |
brew install ninja cmake
+ command -v sccache >/dev/null || brew install sccache
- name: Build and Test
+ env:
+ SCCACHE_BUCKET: sccache-bucket
+ SCCACHE_REGION: us-west-2
run: |
git diff --name-only HEAD~1...HEAD | python3 .ci/compute_projects.py > /tmp/env_vars.sh
source /tmp/env_vars.sh
@@ -280,6 +284,10 @@ jobs:
exit 0
fi
+ export SCCACHE_IDLE_TIMEOUT=0
+ mkdir -p artifacts
+ SCCACHE_LOG=info SCCACHE_ERROR_LOG=$(pwd)/artifacts/sccache.log sccache --start-server
+
xcrun cmake -G Ninja \
-B build \
-S llvm \
@@ -288,5 +296,9 @@ jobs:
-DCMAKE_BUILD_TYPE=Release \
-DLLDB_INCLUDE_TESTS=OFF \
-DLLVM_ENABLE_ASSERTIONS=ON \
+ -DCMAKE_C_COMPILER_LAUNCHER=sccache \
+ -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
ninja -C build ${project_check_targets}
+
+ sccache --show-stats
>From 5c1893cc4fbad140f8b280ec2b1787e9d0a889b1 Mon Sep 17 00:00:00 2001
From: Mishal Shah <mishal_shah at apple.com>
Date: Tue, 7 Jul 2026 14:46:46 -0700
Subject: [PATCH 06/16] [Github] Fix output/env var name mismatches in macOS
self-hosted premerge job
The Compute Projects step's outputs and the Build and Test step's
env vars used inconsistent names (macos-projects vs projects_to_build,
hyphen vs underscore), so the gating condition was always false and
PROJECTS/CHECK_TARGETS were always empty. Align names with the pattern
used in the Windows job.
---
.github/workflows/premerge.yaml | 33 ++++++++++++++++++++++-----------
1 file changed, 22 insertions(+), 11 deletions(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 0d2b6554fd0c6..0525e0f6841bd 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -265,10 +265,8 @@ jobs:
run: |
brew install ninja cmake
command -v sccache >/dev/null || brew install sccache
- - name: Build and Test
- env:
- SCCACHE_BUCKET: sccache-bucket
- SCCACHE_REGION: us-west-2
+ - name: Compute Projects
+ id: vars
run: |
git diff --name-only HEAD~1...HEAD | python3 .ci/compute_projects.py > /tmp/env_vars.sh
source /tmp/env_vars.sh
@@ -279,11 +277,16 @@ jobs:
echo "Running runtimes checks targets: ${runtimes_check_targets}"
echo "Running runtimes checks requiring reconfiguring targets: ${runtimes_check_targets_needs_reconfig}"
- if [[ "${projects_to_build}" == "" ]]; then
- echo "No projects to build"
- exit 0
- fi
-
+ echo "macos-projects=${projects_to_build}" >> $GITHUB_OUTPUT
+ echo "macos-check-targets=${project_check_targets}" >> $GITHUB_OUTPUT
+ - name: Build and Test
+ if: ${{ steps.vars.outputs.macos-projects != '' }}
+ env:
+ SCCACHE_BUCKET: sccache-bucket
+ SCCACHE_REGION: us-west-2
+ PROJECTS: ${{ steps.vars.outputs.macos-projects }}
+ CHECK_TARGETS: ${{ steps.vars.outputs.macos-check-targets }}
+ run: |
export SCCACHE_IDLE_TIMEOUT=0
mkdir -p artifacts
SCCACHE_LOG=info SCCACHE_ERROR_LOG=$(pwd)/artifacts/sccache.log sccache --start-server
@@ -291,7 +294,7 @@ jobs:
xcrun cmake -G Ninja \
-B build \
-S llvm \
- -DLLVM_ENABLE_PROJECTS="${projects_to_build}" \
+ -DLLVM_ENABLE_PROJECTS="${PROJECTS}" \
-DLLVM_DISABLE_ASSEMBLY_FILES=ON \
-DCMAKE_BUILD_TYPE=Release \
-DLLDB_INCLUDE_TESTS=OFF \
@@ -299,6 +302,14 @@ jobs:
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
- ninja -C build ${project_check_targets}
+ echo "::group::Build $PROJECTS"
+ ninja -C build
+ echo "::endgroup::"
+
+ for target in ${CHECK_TARGETS}; do
+ echo "::group::Running $target"
+ ninja -C build "$target"
+ echo "::endgroup::"
+ done
sccache --show-stats
>From 7b0a5f1cb8b87f4106dd2718f0ace59854c49f6c Mon Sep 17 00:00:00 2001
From: Mishal Shah <mishal_shah at apple.com>
Date: Tue, 7 Jul 2026 22:59:33 -0700
Subject: [PATCH 07/16] [Github] Skip macOS self-hosted premerge job when no
projects need building
Compute the changed-project list in a separate job on ubuntu-latest,
using the GitHub API to fetch the PR's changed files, and only spin up
the macOS self-hosted runner if there's actually something to build.
---
.github/workflows/premerge.yaml | 63 +++++++++++++++++++++++++++------
1 file changed, 53 insertions(+), 10 deletions(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 0525e0f6841bd..c285f49379429 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -249,26 +249,51 @@ jobs:
# The libcxx tests fail, so we are skipping the runtime targets.
ninja -C build ${project_check_targets}
- premerge-check-macos-self-hosted-runners:
- name: Build and Test macOS
- runs-on: [self-hosted, macos, apple-runners]
+ premerge-compute-macos-self-hosted:
+ name: Compute macOS Projects
if: >-
github.repository_owner == 'llvm' &&
(github.event_name != 'pull_request' || github.event.action != 'closed')
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ pull-requests: read
+ outputs:
+ macos-projects: ${{ steps.vars.outputs.macos-projects }}
+ macos-check-targets: ${{ steps.vars.outputs.macos-check-targets }}
steps:
+ # For pull requests we get the changed files from the GitHub API, so we
+ # only need a sparse checkout of .ci/ to run compute_projects.py. For
+ # pushes (e.g. release branches) there is no PR to query, so we fall
+ # back to a git diff, which needs real history.
+ - name: Checkout LLVM (sparse)
+ if: github.event_name == 'pull_request'
+ uses: actions/checkout at de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ persist-credentials: false
+ sparse-checkout: .ci
+ sparse-checkout-cone-mode: false
- name: Checkout LLVM
+ if: github.event_name != 'pull_request'
uses: actions/checkout at de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
fetch-depth: 2
- - name: Install Ninja, CMake, and sccache
+ - name: Get Changed Files
+ env:
+ GH_TOKEN: ${{ github.token }}
+ PR_NUMBER: ${{ github.event.pull_request.number }}
+ REPO: ${{ github.repository }}
run: |
- brew install ninja cmake
- command -v sccache >/dev/null || brew install sccache
+ if [[ "${{ github.event_name }}" == "pull_request" ]]; then
+ gh api "repos/${REPO}/pulls/${PR_NUMBER}/files" --paginate --jq '.[].filename' > /tmp/changed_files.txt
+ else
+ git diff --name-only HEAD~1...HEAD > /tmp/changed_files.txt
+ fi
- name: Compute Projects
id: vars
run: |
- git diff --name-only HEAD~1...HEAD | python3 .ci/compute_projects.py > /tmp/env_vars.sh
+ python3 .ci/compute_projects.py Darwin < /tmp/changed_files.txt > /tmp/env_vars.sh
source /tmp/env_vars.sh
echo "Building projects: ${projects_to_build}"
@@ -279,13 +304,31 @@ jobs:
echo "macos-projects=${projects_to_build}" >> $GITHUB_OUTPUT
echo "macos-check-targets=${project_check_targets}" >> $GITHUB_OUTPUT
+
+ premerge-check-macos-self-hosted-runners:
+ name: Build and Test macOS
+ needs: premerge-compute-macos-self-hosted
+ runs-on: [self-hosted, macos, apple-runners]
+ if: >-
+ github.repository_owner == 'llvm' &&
+ (github.event_name != 'pull_request' || github.event.action != 'closed') &&
+ needs.premerge-compute-macos-self-hosted.outputs.macos-projects != ''
+ steps:
+ - name: Checkout LLVM
+ uses: actions/checkout at de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ persist-credentials: false
+ fetch-depth: 2
+ - name: Install Ninja, CMake, and sccache
+ run: |
+ brew install ninja cmake
+ command -v sccache >/dev/null || brew install sccache
- name: Build and Test
- if: ${{ steps.vars.outputs.macos-projects != '' }}
env:
SCCACHE_BUCKET: sccache-bucket
SCCACHE_REGION: us-west-2
- PROJECTS: ${{ steps.vars.outputs.macos-projects }}
- CHECK_TARGETS: ${{ steps.vars.outputs.macos-check-targets }}
+ PROJECTS: ${{ needs.premerge-compute-macos-self-hosted.outputs.macos-projects }}
+ CHECK_TARGETS: ${{ needs.premerge-compute-macos-self-hosted.outputs.macos-check-targets }}
run: |
export SCCACHE_IDLE_TIMEOUT=0
mkdir -p artifacts
>From 8460f8c81a6d45a65e1e9fd1f1cddee21af7cadb Mon Sep 17 00:00:00 2001
From: Mishal Shah <mishal_shah at apple.com>
Date: Tue, 7 Jul 2026 23:20:57 -0700
Subject: [PATCH 08/16] [Github] Exclude mlir/flang/flang-rt from macOS
self-hosted premerge
The self-hosted macOS runners are not yet set up to build/test these
projects, so filter them out of the computed project/check-target
lists before they are used, without changing compute_projects.py
(shared with the macos-14 GitHub-hosted runner job).
---
.github/workflows/premerge.yaml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index c285f49379429..129ce51e95ed5 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -296,6 +296,13 @@ jobs:
python3 .ci/compute_projects.py Darwin < /tmp/changed_files.txt > /tmp/env_vars.sh
source /tmp/env_vars.sh
+ # The self-hosted macOS runners aren't set up to build/test mlir or
+ # flang (flang-rt depends on flang), so drop them here rather than
+ # in compute_projects.py, which is shared with the macos-14
+ # GitHub-hosted runner job above.
+ projects_to_build=$(echo "${projects_to_build}" | tr ';' '\n' | grep -v -E '^(mlir|flang|flang-rt)$' | paste -sd ';' -)
+ project_check_targets=$(echo "${project_check_targets}" | tr ' ' '\n' | grep -v -E '^(check-mlir|check-flang|check-flang-rt)$' | paste -sd ' ' -)
+
echo "Building projects: ${projects_to_build}"
echo "Running project checks targets: ${project_check_targets}"
echo "Building runtimes: ${runtimes_to_build}"
>From 35dea81d61a9216b470b9d160f92ecd9f02ecd4b Mon Sep 17 00:00:00 2001
From: Mishal Shah <mishal_shah at apple.com>
Date: Fri, 10 Jul 2026 13:43:37 -0700
Subject: [PATCH 09/16] Include lldb, compiler-rt, and libnuwind projects on
macOS
---
.ci/compute_projects.py | 3 ---
1 file changed, 3 deletions(-)
diff --git a/.ci/compute_projects.py b/.ci/compute_projects.py
index 30296ff05f322..d4012a48ace5d 100644
--- a/.ci/compute_projects.py
+++ b/.ci/compute_projects.py
@@ -132,16 +132,13 @@
EXCLUDE_MAC = {
"bolt",
- "compiler-rt",
"cross-project-tests",
"flang",
"libc",
- "lldb",
"openmp",
"polly",
"libcxx",
"libcxxabi",
- "libunwind",
"offload",
}
>From 842978db1eb235cd3c6ee1d4bb34950ed5eb2d7a Mon Sep 17 00:00:00 2001
From: Mishal Shah <mishal_shah at apple.com>
Date: Fri, 10 Jul 2026 14:27:05 -0700
Subject: [PATCH 10/16] [Github] Exclude CIR from macOS self-hosted premerge
and extract exclusion lists
---
.github/workflows/premerge.yaml | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 129ce51e95ed5..05e33ab96f4d6 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -296,12 +296,14 @@ jobs:
python3 .ci/compute_projects.py Darwin < /tmp/changed_files.txt > /tmp/env_vars.sh
source /tmp/env_vars.sh
- # The self-hosted macOS runners aren't set up to build/test mlir or
- # flang (flang-rt depends on flang), so drop them here rather than
- # in compute_projects.py, which is shared with the macos-14
- # GitHub-hosted runner job above.
- projects_to_build=$(echo "${projects_to_build}" | tr ';' '\n' | grep -v -E '^(mlir|flang|flang-rt)$' | paste -sd ';' -)
- project_check_targets=$(echo "${project_check_targets}" | tr ' ' '\n' | grep -v -E '^(check-mlir|check-flang|check-flang-rt)$' | paste -sd ' ' -)
+ # The self-hosted macOS runners aren't set up to build/test mlir,
+ # flang (flang-rt depends on flang), or CIR (depends on mlir), so
+ # drop them here rather than in compute_projects.py, which is
+ # shared with the macos-14 GitHub-hosted runner job above.
+ excluded_projects="mlir|flang|flang-rt|CIR"
+ excluded_check_targets="check-mlir|check-flang|check-flang-rt|check-clang-cir"
+ projects_to_build=$(echo "${projects_to_build}" | tr ';' '\n' | grep -v -E "^(${excluded_projects})$" | paste -sd ';' -)
+ project_check_targets=$(echo "${project_check_targets}" | tr ' ' '\n' | grep -v -E "^(${excluded_check_targets})$" | paste -sd ' ' -)
echo "Building projects: ${projects_to_build}"
echo "Running project checks targets: ${project_check_targets}"
>From acbc442c7d5120520dc613fcd3b591a47b172275 Mon Sep 17 00:00:00 2001
From: Mishal Shah <mishal_shah at apple.com>
Date: Fri, 10 Jul 2026 16:11:38 -0700
Subject: [PATCH 11/16] [Github] Skip check-lldb and rename macOS self-hosted
premerge job
check-lldb is temporarily excluded on the self-hosted macOS runners.
Also renames the job to "Build and Test macOS arm64" to reflect the
runner architecture.
---
.github/workflows/premerge.yaml | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 05e33ab96f4d6..935447368c0ab 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -300,8 +300,9 @@ jobs:
# flang (flang-rt depends on flang), or CIR (depends on mlir), so
# drop them here rather than in compute_projects.py, which is
# shared with the macos-14 GitHub-hosted runner job above.
+ # check-lldb is temporarily skipped as well.
excluded_projects="mlir|flang|flang-rt|CIR"
- excluded_check_targets="check-mlir|check-flang|check-flang-rt|check-clang-cir"
+ excluded_check_targets="check-mlir|check-flang|check-flang-rt|check-clang-cir|check-lldb"
projects_to_build=$(echo "${projects_to_build}" | tr ';' '\n' | grep -v -E "^(${excluded_projects})$" | paste -sd ';' -)
project_check_targets=$(echo "${project_check_targets}" | tr ' ' '\n' | grep -v -E "^(${excluded_check_targets})$" | paste -sd ' ' -)
@@ -315,7 +316,7 @@ jobs:
echo "macos-check-targets=${project_check_targets}" >> $GITHUB_OUTPUT
premerge-check-macos-self-hosted-runners:
- name: Build and Test macOS
+ name: Build and Test macOS arm64
needs: premerge-compute-macos-self-hosted
runs-on: [self-hosted, macos, apple-runners]
if: >-
>From dcb74daf3094de99175356586b7ffbe33261f3f5 Mon Sep 17 00:00:00 2001
From: Mishal Shah <mishal_shah at apple.com>
Date: Fri, 10 Jul 2026 21:38:22 -0700
Subject: [PATCH 12/16] [Github] Skip check-libclc on macOS self-hosted
premerge runners
---
.github/workflows/premerge.yaml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 935447368c0ab..927caf85e1a0d 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -300,9 +300,9 @@ jobs:
# flang (flang-rt depends on flang), or CIR (depends on mlir), so
# drop them here rather than in compute_projects.py, which is
# shared with the macos-14 GitHub-hosted runner job above.
- # check-lldb is temporarily skipped as well.
+ # check-lldb and check-libclc are temporarily skipped as well.
excluded_projects="mlir|flang|flang-rt|CIR"
- excluded_check_targets="check-mlir|check-flang|check-flang-rt|check-clang-cir|check-lldb"
+ excluded_check_targets="check-mlir|check-flang|check-flang-rt|check-clang-cir|check-lldb|check-libclc"
projects_to_build=$(echo "${projects_to_build}" | tr ';' '\n' | grep -v -E "^(${excluded_projects})$" | paste -sd ';' -)
project_check_targets=$(echo "${project_check_targets}" | tr ' ' '\n' | grep -v -E "^(${excluded_check_targets})$" | paste -sd ' ' -)
>From 71d28eb9febb8062b0b38e80fc1b153b2f3481bd Mon Sep 17 00:00:00 2001
From: Mishal Shah <mishal_shah at apple.com>
Date: Mon, 13 Jul 2026 17:06:07 -0700
Subject: [PATCH 13/16] [Github] Fix test_llvm_mac after enabling
lldb/compiler-rt/libunwind on macOS
35dea81d61a9 removed lldb, compiler-rt, and libunwind from EXCLUDE_MAC
but did not update the corresponding test expectations.
---
.ci/compute_projects_test.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/.ci/compute_projects_test.py b/.ci/compute_projects_test.py
index e7445a49bd764..5e4e88818aa64 100644
--- a/.ci/compute_projects_test.py
+++ b/.ci/compute_projects_test.py
@@ -62,20 +62,20 @@ def test_llvm_mac(self):
)
self.assertEqual(
env_variables["projects_to_build"],
- "clang;clang-tools-extra;lld;llvm;mlir",
+ "clang;clang-tools-extra;lld;lldb;llvm;mlir",
)
self.assertEqual(
env_variables["project_check_targets"],
- "check-clang check-clang-tools check-lld check-llvm check-mlir",
+ "check-clang check-clang-tools check-lld check-lldb check-llvm check-mlir",
)
- self.assertEqual(env_variables["runtimes_to_build"], "")
+ self.assertEqual(env_variables["runtimes_to_build"], "libunwind")
self.assertEqual(
env_variables["runtimes_check_targets"],
"",
)
self.assertEqual(
env_variables["runtimes_check_targets_needs_reconfig"],
- "",
+ "check-unwind",
)
def test_clang(self):
>From c59dd2c21e194cbda8efb95a2d4c4eab7f7f159f Mon Sep 17 00:00:00 2001
From: Mishal Shah <mishal_shah at apple.com>
Date: Mon, 13 Jul 2026 17:29:45 -0700
Subject: [PATCH 14/16] [Github] Pin Linux premerge to ubuntu-22.04 and
simplify build/check step
Build and run all check targets in a single ninja invocation instead
of a separate build pass followed by a per-target loop.
---
.github/workflows/premerge.yaml | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 927caf85e1a0d..07f2a18f68738 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -254,7 +254,7 @@ jobs:
if: >-
github.repository_owner == 'llvm' &&
(github.event_name != 'pull_request' || github.event.action != 'closed')
- runs-on: ubuntu-latest
+ runs-on: ubuntu-22.04
permissions:
contents: read
pull-requests: read
@@ -355,14 +355,6 @@ jobs:
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
- echo "::group::Build $PROJECTS"
- ninja -C build
- echo "::endgroup::"
-
- for target in ${CHECK_TARGETS}; do
- echo "::group::Running $target"
- ninja -C build "$target"
- echo "::endgroup::"
- done
+ ninja -C build ${CHECK_TARGETS}
sccache --show-stats
>From 2270136bfc699e856b07ebf332ce2bfb8ebd195c Mon Sep 17 00:00:00 2001
From: Mishal Shah <mishal_shah at apple.com>
Date: Mon, 13 Jul 2026 17:50:54 -0700
Subject: [PATCH 15/16] [Github] Remove redundant macos-14 premerge check job
The premerge-check-macos job duplicates the self-hosted macOS
premerge checks (premerge-compute-macos-self-hosted), which now
cover release branches.
---
.github/workflows/premerge.yaml | 50 ---------------------------------
1 file changed, 50 deletions(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 07f2a18f68738..68be28ce347c1 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -199,56 +199,6 @@ jobs:
path: |
comments-Windows-AMD64
- premerge-check-macos:
- name: MacOS Premerge Checks
- runs-on: macos-14
- if: >-
- github.repository_owner == 'llvm' &&
- (startswith(github.ref_name, 'release/') ||
- startswith(github.base_ref, 'release/')) &&
- (github.event_name != 'pull_request' || github.event.action != 'closed')
- steps:
- - name: Checkout LLVM
- uses: actions/checkout at de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- with:
- persist-credentials: false
- fetch-depth: 2
- - name: Setup ccache
- uses: hendrikmuhs/ccache-action at 33522472633dbd32578e909b315f5ee43ba878ce # v1.2.22
- with:
- max-size: "2000M"
- - name: Install Ninja
- run: |
- brew install ninja
- - name: Build and Test
- run: |
- source <(git diff --name-only HEAD~1...HEAD | python3 .ci/compute_projects.py)
-
- if [[ "${projects_to_build}" == "" ]]; then
- echo "No projects to build"
- exit 0
- fi
-
- echo "Building projects: ${projects_to_build}"
- echo "Running project checks targets: ${project_check_targets}"
-
- # -DLLVM_DISABLE_ASSEMBLY_FILES=ON is for
- # https://github.com/llvm/llvm-project/issues/81967
- # Disable sharding in lit so that the LIT_XFAIL environment var works.
- cmake -G Ninja \
- -B build \
- -S llvm \
- -DLLVM_ENABLE_PROJECTS="${projects_to_build}" \
- -DLLVM_DISABLE_ASSEMBLY_FILES=ON \
- -DCMAKE_BUILD_TYPE=Release \
- -DLLDB_INCLUDE_TESTS=OFF \
- -DLLVM_ENABLE_ASSERTIONS=ON \
- -DCMAKE_C_COMPILER_LAUNCHER=ccache \
- -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-
- # The libcxx tests fail, so we are skipping the runtime targets.
- ninja -C build ${project_check_targets}
-
premerge-compute-macos-self-hosted:
name: Compute macOS Projects
if: >-
>From 04ff09473d9913dbdf8a634c218c256eefcd89a7 Mon Sep 17 00:00:00 2001
From: Mishal Shah <mishal_shah at apple.com>
Date: Mon, 13 Jul 2026 20:54:16 -0700
Subject: [PATCH 16/16] [Github] Move macOS premerge exclusions into
compute_projects.py
The self-hosted macOS premerge job hardcoded exclusions for
mlir/flang/flang-rt/CIR and skipped check-lldb/check-libclc via a
shell grep filter. Move this logic into compute_projects.py so it is
tested and shared like the other platform exclusions.
---
.ci/compute_projects.py | 12 ++++++++++
.ci/compute_projects_test.py | 39 +++++++++++++++++++++++++++++++--
.github/workflows/premerge.yaml | 10 ---------
3 files changed, 49 insertions(+), 12 deletions(-)
diff --git a/.ci/compute_projects.py b/.ci/compute_projects.py
index 363ff8b7e45d0..1a70cf513beaa 100644
--- a/.ci/compute_projects.py
+++ b/.ci/compute_projects.py
@@ -132,9 +132,12 @@
EXCLUDE_MAC = {
"bolt",
+ "CIR", # Depends on mlir, which is excluded below.
"cross-project-tests",
"flang",
+ "flang-rt",
"libc",
+ "mlir",
"openmp",
"polly",
"libcxx",
@@ -142,6 +145,13 @@
"offload",
}
+# These projects are still built on the self-hosted macOS runners, but their
+# tests are temporarily skipped there.
+EXCLUDE_CHECK_TARGETS_MAC = {
+ "lldb",
+ "libclc",
+}
+
PROJECT_CHECK_TARGETS = {
"clang-tools-extra": "check-clang-tools",
"compiler-rt": "check-compiler-rt",
@@ -259,6 +269,8 @@ def _compute_project_check_targets(
) -> Set[str]:
check_targets = set()
for project_to_test in projects_to_test:
+ if platform == "Darwin" and project_to_test in EXCLUDE_CHECK_TARGETS_MAC:
+ continue
if project_to_test in PROJECT_CHECK_TARGETS:
check_targets.add(PROJECT_CHECK_TARGETS[project_to_test])
return check_targets
diff --git a/.ci/compute_projects_test.py b/.ci/compute_projects_test.py
index 5e5783227e933..fa926c476a3db 100644
--- a/.ci/compute_projects_test.py
+++ b/.ci/compute_projects_test.py
@@ -62,11 +62,11 @@ def test_llvm_mac(self):
)
self.assertEqual(
env_variables["projects_to_build"],
- "clang;clang-tools-extra;lld;lldb;llvm;mlir",
+ "clang;clang-tools-extra;lld;lldb;llvm",
)
self.assertEqual(
env_variables["project_check_targets"],
- "check-clang check-clang-python check-clang-tools check-lld check-lldb check-llvm check-mlir",
+ "check-clang check-clang-python check-clang-tools check-lld check-llvm",
)
self.assertEqual(env_variables["runtimes_to_build"], "libunwind")
self.assertEqual(
@@ -78,6 +78,41 @@ def test_llvm_mac(self):
"check-unwind",
)
+ def test_mlir_mac(self):
+ env_variables = compute_projects.get_env_variables(
+ ["mlir/CMakeLists.txt"], "Darwin"
+ )
+ self.assertEqual(env_variables["projects_to_build"], "")
+ self.assertEqual(env_variables["project_check_targets"], "")
+
+ def test_cir_mac(self):
+ env_variables = compute_projects.get_env_variables(
+ ["clang/lib/CIR/CMakeLists.txt"], "Darwin"
+ )
+ self.assertEqual(
+ env_variables["projects_to_build"],
+ "clang;clang-tools-extra;lld;lldb;llvm",
+ )
+ self.assertEqual(
+ env_variables["project_check_targets"],
+ "check-clang check-clang-python check-clang-tools",
+ )
+ self.assertEqual(env_variables["enable_cir"], "OFF")
+
+ def test_lldb_mac(self):
+ env_variables = compute_projects.get_env_variables(
+ ["lldb/CMakeLists.txt"], "Darwin"
+ )
+ self.assertEqual(env_variables["projects_to_build"], "clang;lld;lldb;llvm")
+ self.assertEqual(env_variables["project_check_targets"], "")
+
+ def test_libclc_mac(self):
+ env_variables = compute_projects.get_env_variables(
+ ["libclc/CMakeLists.txt"], "Darwin"
+ )
+ self.assertEqual(env_variables["projects_to_build"], "clang;llvm")
+ self.assertEqual(env_variables["runtimes_check_targets"], "")
+
def test_clang(self):
env_variables = compute_projects.get_env_variables(
["clang/CMakeLists.txt"], "Linux"
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 68be28ce347c1..9c549b8a11ab0 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -246,16 +246,6 @@ jobs:
python3 .ci/compute_projects.py Darwin < /tmp/changed_files.txt > /tmp/env_vars.sh
source /tmp/env_vars.sh
- # The self-hosted macOS runners aren't set up to build/test mlir,
- # flang (flang-rt depends on flang), or CIR (depends on mlir), so
- # drop them here rather than in compute_projects.py, which is
- # shared with the macos-14 GitHub-hosted runner job above.
- # check-lldb and check-libclc are temporarily skipped as well.
- excluded_projects="mlir|flang|flang-rt|CIR"
- excluded_check_targets="check-mlir|check-flang|check-flang-rt|check-clang-cir|check-lldb|check-libclc"
- projects_to_build=$(echo "${projects_to_build}" | tr ';' '\n' | grep -v -E "^(${excluded_projects})$" | paste -sd ';' -)
- project_check_targets=$(echo "${project_check_targets}" | tr ' ' '\n' | grep -v -E "^(${excluded_check_targets})$" | paste -sd ' ' -)
-
echo "Building projects: ${projects_to_build}"
echo "Running project checks targets: ${project_check_targets}"
echo "Building runtimes: ${runtimes_to_build}"
More information about the llvm-commits
mailing list