[llvm] workflows/precommit: Use single shared job to compute projects (PR #224941)
Tom Stellard via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 30 12:46:10 PDT 2026
https://github.com/tstellar updated https://github.com/llvm/llvm-project/pull/224941
>From 6335b76f268fc4ceec33fcad10fe0a8afd6c64b3 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Sat, 19 Sep 2026 17:00:01 -0700
Subject: [PATCH 01/20] workflows/premerge: Remove full checkout when computing
macOS changes for pushes
We can compute the changes using the API like we do for pull requests.
---
.github/workflows/premerge.yaml | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index c6d604533f1f6c..ce3ec08a47156c 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -200,18 +200,11 @@ jobs:
# 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 df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
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 df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- with:
- persist-credentials: false
- fetch-depth: 2
- name: Get Changed Files
env:
GH_TOKEN: ${{ github.token }}
@@ -221,7 +214,7 @@ jobs:
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
+ gh api "repos/${REPO}/compare/${{ github.event.before }}...${{ github.event.after }}" --paginate --jq '.files[].filename' > /tmp/changed_files.txt
fi
- name: Compute Projects
id: vars
>From 403886647e4571fbf9e1b2e86436515ea0c83024 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Sun, 20 Sep 2026 08:02:20 -0700
Subject: [PATCH 02/20] Remove comment
---
.github/workflows/premerge.yaml | 4 ----
1 file changed, 4 deletions(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index ce3ec08a47156c..3878153f3e698c 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -195,10 +195,6 @@ jobs:
macos-runtimes: ${{ steps.vars.outputs.macos-runtimes }}
macos-runtimes-check-targets: ${{ steps.vars.outputs.macos-runtimes-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)
uses: actions/checkout at df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
>From a84785fa8b8bf407948fe00cd21d72c81dedb867 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Sun, 20 Sep 2026 09:10:22 -0700
Subject: [PATCH 03/20] XXX: pre-compute
---
.ci/compute_projects.py | 6 +-
.github/workflows/premerge.yaml | 133 ++++++++++++++++----------------
2 files changed, 70 insertions(+), 69 deletions(-)
diff --git a/.ci/compute_projects.py b/.ci/compute_projects.py
index 936397b779eb06..079b56e6b459b6 100644
--- a/.ci/compute_projects.py
+++ b/.ci/compute_projects.py
@@ -7,6 +7,7 @@
"""
from collections.abc import Set
+import json
import pathlib
import platform
import sys
@@ -388,5 +389,6 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
current_platform = sys.argv[1]
changed_files = [line.strip() for line in sys.stdin.readlines()]
env_variables = get_env_variables(changed_files, current_platform)
- for env_variable in env_variables:
- print(f"{env_variable}='{env_variables[env_variable]}'")
+ json.dumps(env_variables)
+# for env_variable in env_variables:
+ #print(f"{env_variable}='{env_variables[env_variable]}'")
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 3878153f3e698c..c6820c16759e3b 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -23,11 +23,68 @@ concurrency:
cancel-in-progress: true
jobs:
+ # Computes which projects/check-targets to build and test on the
+ # self-hosted macOS runners.
+ premerge-compute-macos:
+ name: Compute Projects
+ if: >-
+ github.repository_owner == 'llvm' &&
+ (github.event_name != 'pull_request' || github.event.action != 'closed')
+ runs-on: ubuntu-22.04
+ permissions:
+ contents: read
+ pull-requests: read
+ outputs:
+ macos-projects: ${{ steps.vars.outputs.macos-projects }}
+ macos-check-targets: ${{ steps.vars.outputs.macos-check-targets }}
+ macos-runtimes: ${{ steps.vars.outputs.macos-runtimes }}
+ macos-runtimes-check-targets: ${{ steps.vars.outputs.macos-runtimes-check-targets }}
+ Linux-values: ${{ steps.vars.outputs.Linux-values }}
+ Windows-values: ${{ steps.vars.outputs.Windows-values }}
+ Darwin-values: ${{ steps.vars.outputs.Darwin-values }}
+
+ steps:
+ - name: Checkout LLVM (sparse)
+ uses: actions/checkout at df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
+ with:
+ persist-credentials: false
+ sparse-checkout: .ci
+ sparse-checkout-cone-mode: false
+ - name: Get Changed Files
+ env:
+ GH_TOKEN: ${{ github.token }}
+ PR_NUMBER: ${{ github.event.pull_request.number }}
+ REPO: ${{ github.repository }}
+ run: |
+ if [[ "${{ github.event_name }}" == "pull_request" ]]; then
+ gh api "repos/${REPO}/pulls/${PR_NUMBER}/files" --paginate --jq '.[].filename' > /tmp/changed_files.txt
+ else
+ gh api "repos/${REPO}/compare/${{ github.event.before }}...${{ github.event.after }}" --paginate --jq '.files[].filename' > /tmp/changed_files.txt
+ fi
+ - name: Compute Projects
+ id: vars
+ run: |
+ for p in Linux Windows Darwin; do
+ echo $p-values=$(python3 .ci/compute_projects.py $p < /tmp/changed_files.txt) >> $GITHUB_OUTPUT
+ done
+
+# 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}"
+
+# echo "macos-projects=${projects_to_build}" >> $GITHUB_OUTPUT
+# echo "macos-check-targets=${project_check_targets}" >> $GITHUB_OUTPUT
+# echo "macos-runtimes=${runtimes_to_build}" >> $GITHUB_OUTPUT
+# echo "macos-runtimes-check-targets=${runtimes_check_targets}" >> $GITHUB_OUTPUT
premerge-checks-linux:
name: Build and Test Linux
+ needs: premerge-compute
if: >-
github.repository_owner == 'llvm' &&
- (github.event_name != 'pull_request' || github.event.action != 'closed')
+ (github.event_name != 'pull_request' || github.event.action != 'closed') &&
+ fromJSON(needs.premerge-compute.outputs.Linux-values).projects_to_build != ''
runs-on: llvm-premerge-linux-runners
defaults:
run:
@@ -40,22 +97,18 @@ jobs:
uses: actions/checkout at df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- fetch-depth: 2
- name: Build and Test
timeout-minutes: 120
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
- run: |
- git config --global --add safe.directory '*'
-
- 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
+ projects_to_build: ${{ fromJSON(needs.premerge-compute.outputs.Linux-values).projects_to_build }}
+ project_check_targets: ${{ fromJSON(needs.premerge-compute.outputs.Linux-values).project_check_targets }}
+ runtimes_to_build: ${{ fromJSON(needs.premerge-compute.outputs.Linux-values).runtimes_to_build }}
+ runtimes_check_targets: ${{ fromJSON(needs.premerge-compute-outputs.Linux-values).runtimes_check_targets }}
+ runtimes_check_targets_needs_reconfig: ${{ fromJSON(needs.premerge-compute-outputs.Linux-values).runtimes_check_targets_needs_reconfig}}
+ run: |
echo "Building projects: ${projects_to_build}"
echo "Running project checks targets: ${project_check_targets}"
echo "Building runtimes: ${runtimes_to_build}"
@@ -104,6 +157,7 @@ jobs:
premerge-checks-windows:
name: Build and Test Windows
+ needs: premerge-compute
if: >-
github.repository_owner == 'llvm' &&
(github.event_name != 'pull_request' || github.event.action != 'closed')
@@ -173,65 +227,10 @@ jobs:
path: |
comments-Windows-AMD64
- # Computes which projects/check-targets to build and test on the
- # self-hosted macOS runners. This job intentionally runs on a
- # GitHub-hosted runner rather than a self-hosted one, since self-hosted
- # macOS capacity is limited and shouldn't be spent just to compute what
- # to build. Its outputs feed premerge-check-macos below, which does the
- # actual build/test on the self-hosted runners, so changes here directly
- # affect what runs there.
- premerge-compute-macos:
- name: Compute macOS Projects
- if: >-
- github.repository_owner == 'llvm' &&
- (github.event_name != 'pull_request' || github.event.action != 'closed')
- runs-on: ubuntu-22.04
- permissions:
- contents: read
- pull-requests: read
- outputs:
- macos-projects: ${{ steps.vars.outputs.macos-projects }}
- macos-check-targets: ${{ steps.vars.outputs.macos-check-targets }}
- macos-runtimes: ${{ steps.vars.outputs.macos-runtimes }}
- macos-runtimes-check-targets: ${{ steps.vars.outputs.macos-runtimes-check-targets }}
- steps:
- - name: Checkout LLVM (sparse)
- uses: actions/checkout at df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- with:
- persist-credentials: false
- sparse-checkout: .ci
- sparse-checkout-cone-mode: false
- - name: Get Changed Files
- env:
- GH_TOKEN: ${{ github.token }}
- PR_NUMBER: ${{ github.event.pull_request.number }}
- REPO: ${{ github.repository }}
- run: |
- if [[ "${{ github.event_name }}" == "pull_request" ]]; then
- gh api "repos/${REPO}/pulls/${PR_NUMBER}/files" --paginate --jq '.[].filename' > /tmp/changed_files.txt
- else
- gh api "repos/${REPO}/compare/${{ github.event.before }}...${{ github.event.after }}" --paginate --jq '.files[].filename' > /tmp/changed_files.txt
- fi
- - name: Compute Projects
- id: vars
- run: |
- 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}"
- 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}"
-
- echo "macos-projects=${projects_to_build}" >> $GITHUB_OUTPUT
- echo "macos-check-targets=${project_check_targets}" >> $GITHUB_OUTPUT
- echo "macos-runtimes=${runtimes_to_build}" >> $GITHUB_OUTPUT
- echo "macos-runtimes-check-targets=${runtimes_check_targets}" >> $GITHUB_OUTPUT
premerge-check-macos:
name: Build and Test macOS arm64
- needs: premerge-compute-macos
+ needs: premerge-compute
runs-on: [self-hosted, macOS, ARM64, apple-runners]
# Skip the self-hosted runner entirely if there is nothing to build,
# rather than tying up a runner slot for a no-op run.
>From 35a00e2f3cb665507194c8b984562cd3a6917e87 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Sun, 20 Sep 2026 09:18:33 -0700
Subject: [PATCH 04/20] Fix
---
.github/workflows/premerge.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index c6820c16759e3b..d20caaeda873d7 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -25,7 +25,7 @@ concurrency:
jobs:
# Computes which projects/check-targets to build and test on the
# self-hosted macOS runners.
- premerge-compute-macos:
+ premerge-compute:
name: Compute Projects
if: >-
github.repository_owner == 'llvm' &&
>From 8728f5bddca1affbdb5be15a4ce8aff00ae54770 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 21 Sep 2026 08:40:06 -0700
Subject: [PATCH 05/20] Debug
---
.github/workflows/premerge.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index d20caaeda873d7..b91edc7fa52bfa 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -66,6 +66,7 @@ jobs:
run: |
for p in Linux Windows Darwin; do
echo $p-values=$(python3 .ci/compute_projects.py $p < /tmp/changed_files.txt) >> $GITHUB_OUTPUT
+ python3 .ci/compute_projects.py $p < /tmp/changed_files.txt
done
# echo "Building projects: ${projects_to_build}"
>From c7245ae4faa2cde201913d4a434bfc909e6369de Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 21 Sep 2026 10:29:09 -0700
Subject: [PATCH 06/20] Debug
---
.github/workflows/premerge.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index b91edc7fa52bfa..2bd100b30b55ac 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -64,6 +64,7 @@ jobs:
- name: Compute Projects
id: vars
run: |
+ cat /tmp/changed_files.txt
for p in Linux Windows Darwin; do
echo $p-values=$(python3 .ci/compute_projects.py $p < /tmp/changed_files.txt) >> $GITHUB_OUTPUT
python3 .ci/compute_projects.py $p < /tmp/changed_files.txt
>From f8c8584477c90dcdab50daf859fdb6835c4f1366 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 21 Sep 2026 10:36:43 -0700
Subject: [PATCH 07/20] Fix
---
.ci/compute_projects.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.ci/compute_projects.py b/.ci/compute_projects.py
index 079b56e6b459b6..a80c9b32a7ec96 100644
--- a/.ci/compute_projects.py
+++ b/.ci/compute_projects.py
@@ -389,6 +389,6 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
current_platform = sys.argv[1]
changed_files = [line.strip() for line in sys.stdin.readlines()]
env_variables = get_env_variables(changed_files, current_platform)
- json.dumps(env_variables)
+ print(json.dumps(env_variables))
# for env_variable in env_variables:
#print(f"{env_variable}='{env_variables[env_variable]}'")
>From f1e7eeaa603b8da1be19c180d064009456bddc4f Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 21 Sep 2026 11:11:17 -0700
Subject: [PATCH 08/20] fix
---
.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 2bd100b30b55ac..5cc8e43c3fc319 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -107,8 +107,8 @@ jobs:
projects_to_build: ${{ fromJSON(needs.premerge-compute.outputs.Linux-values).projects_to_build }}
project_check_targets: ${{ fromJSON(needs.premerge-compute.outputs.Linux-values).project_check_targets }}
runtimes_to_build: ${{ fromJSON(needs.premerge-compute.outputs.Linux-values).runtimes_to_build }}
- runtimes_check_targets: ${{ fromJSON(needs.premerge-compute-outputs.Linux-values).runtimes_check_targets }}
- runtimes_check_targets_needs_reconfig: ${{ fromJSON(needs.premerge-compute-outputs.Linux-values).runtimes_check_targets_needs_reconfig}}
+ runtimes_check_targets: ${{ fromJSON(needs.premerge-compute.outputs.Linux-values).runtimes_check_targets }}
+ runtimes_check_targets_needs_reconfig: ${{ fromJSON(needs.premerge-compute.outputs.Linux-values).runtimes_check_targets_needs_reconfig}}
run: |
echo "Building projects: ${projects_to_build}"
>From 232d82e084b015838279e214c49f7ec8e8eccb05 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 21 Sep 2026 13:11:51 -0700
Subject: [PATCH 09/20] Debug templates
---
.github/workflows/premerge.yaml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 5cc8e43c3fc319..b20f0445e83790 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -99,6 +99,11 @@ jobs:
uses: actions/checkout at df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
+ - &extra_variables
+ name: Extract Environment Variables
+ run: |
+ echo "Test"
+ - *extra_variables
- name: Build and Test
timeout-minutes: 120
env:
>From c2a4bc9322bef4cbb904bb968276fa827a4e1676 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 21 Sep 2026 13:17:54 -0700
Subject: [PATCH 10/20] Test
---
.github/workflows/anchors-test.yml | 12 ++++++++++++
1 file changed, 12 insertions(+)
create mode 100644 .github/workflows/anchors-test.yml
diff --git a/.github/workflows/anchors-test.yml b/.github/workflows/anchors-test.yml
new file mode 100644
index 00000000000000..38cf1924d4b055
--- /dev/null
+++ b/.github/workflows/anchors-test.yml
@@ -0,0 +1,12 @@
+on:
+ push:
+jobs:
+ test:
+ runs-on: ubuntu-22.04
+ steps:
+ - &extra_variables
+ name: Extract Environment Variables
+ run: |
+ echo "Test"
+ - *extra_variables
+
>From 81ca6ef7f279819d968aa8e615ba98c71ff2dfbe Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 21 Sep 2026 13:19:10 -0700
Subject: [PATCH 11/20] Test
---
.github/workflows/anchors-test.yml | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/anchors-test.yml b/.github/workflows/anchors-test.yml
index 38cf1924d4b055..468432654e63fd 100644
--- a/.github/workflows/anchors-test.yml
+++ b/.github/workflows/anchors-test.yml
@@ -2,11 +2,10 @@ on:
push:
jobs:
test:
- runs-on: ubuntu-22.04
- steps:
- - &extra_variables
- name: Extract Environment Variables
- run: |
- echo "Test"
- - *extra_variables
-
+ runs-on: ubuntu-22.04
+ steps:
+ - &extra_variables
+ name: Extract Environment Variables
+ run: |
+ echo "Test"
+ - *extra_variables
>From 57f049c936e225c994fffc5e24242c057680d814 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 21 Sep 2026 13:38:17 -0700
Subject: [PATCH 12/20] Optimize
---
.github/workflows/premerge.yaml | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index b20f0445e83790..3b732537e20198 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -99,22 +99,17 @@ jobs:
uses: actions/checkout at df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- - &extra_variables
+ - &extract_variables
name: Extract Environment Variables
+ env:
+ VALUES: ${{ case(runner.os == "Windows", needs.premerge-compute.outputs.Windows-values, runner.os == "macOS", needs.premerge-compute.outputs.Darwin-values, needs.premerge-compute.outputs.Linux-values) }}
run: |
- echo "Test"
- - *extra_variables
+ echo $VALUES | jq -r 'keys[] as $k | "\($k)=\"\(.[$k])\""' >> $GITHUB_ENV
- name: Build and Test
timeout-minutes: 120
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
- projects_to_build: ${{ fromJSON(needs.premerge-compute.outputs.Linux-values).projects_to_build }}
- project_check_targets: ${{ fromJSON(needs.premerge-compute.outputs.Linux-values).project_check_targets }}
- runtimes_to_build: ${{ fromJSON(needs.premerge-compute.outputs.Linux-values).runtimes_to_build }}
- runtimes_check_targets: ${{ fromJSON(needs.premerge-compute.outputs.Linux-values).runtimes_check_targets }}
- runtimes_check_targets_needs_reconfig: ${{ fromJSON(needs.premerge-compute.outputs.Linux-values).runtimes_check_targets_needs_reconfig}}
-
run: |
echo "Building projects: ${projects_to_build}"
echo "Running project checks targets: ${project_check_targets}"
@@ -167,12 +162,14 @@ jobs:
needs: premerge-compute
if: >-
github.repository_owner == 'llvm' &&
- (github.event_name != 'pull_request' || github.event.action != 'closed')
+ (github.event_name != 'pull_request' || github.event.action != 'closed') &&
+ fromJSON(needs.premerge-compute.outputs.Windows-values).projects_to_build != ''
runs-on: llvm-premerge-windows-2022-runners
defaults:
run:
shell: bash
steps:
+ - *extract_variables
- name: Checkout LLVM
uses: actions/checkout at df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
@@ -244,8 +241,9 @@ jobs:
if: >-
github.repository_owner == 'llvm' &&
(github.event_name != 'pull_request' || github.event.action != 'closed') &&
- needs.premerge-compute-macos.outputs.macos-projects != ''
+ fromJSON(needs.premerge-compute.outputs.Darwin-values).projects_to_build != ''
steps:
+ - *extract_variables
- name: Checkout LLVM
uses: actions/checkout at df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
>From 9f9b6cd9a98e22feebb8817f3a5d458b71e97955 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 21 Sep 2026 13:42:23 -0700
Subject: [PATCH 13/20] Fix
---
.github/workflows/premerge.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 3b732537e20198..4f43431367e08c 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -102,7 +102,7 @@ jobs:
- &extract_variables
name: Extract Environment Variables
env:
- VALUES: ${{ case(runner.os == "Windows", needs.premerge-compute.outputs.Windows-values, runner.os == "macOS", needs.premerge-compute.outputs.Darwin-values, needs.premerge-compute.outputs.Linux-values) }}
+ VALUES: ${{ case(runner.os == 'Windows', needs.premerge-compute.outputs.Windows-values, runner.os == 'macOS', needs.premerge-compute.outputs.Darwin-values, needs.premerge-compute.outputs.Linux-values) }}
run: |
echo $VALUES | jq -r 'keys[] as $k | "\($k)=\"\(.[$k])\""' >> $GITHUB_ENV
- name: Build and Test
>From 3120a803148a4a4479da65e93830322b9ebbf7ea Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 21 Sep 2026 14:27:20 -0700
Subject: [PATCH 14/20] Fixes
---
.github/workflows/premerge.yaml | 51 +++++++++++++--------------------
1 file changed, 20 insertions(+), 31 deletions(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 4f43431367e08c..687eb9657a86d9 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -88,6 +88,7 @@ jobs:
(github.event_name != 'pull_request' || github.event.action != 'closed') &&
fromJSON(needs.premerge-compute.outputs.Linux-values).projects_to_build != ''
runs-on: llvm-premerge-linux-runners
+ env: ${{ fromJSON(needs.premerge-compute.outputs.Linux-values) }}
defaults:
run:
# The run step defaults to using sh as the shell when running in a
@@ -99,12 +100,6 @@ jobs:
uses: actions/checkout at df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- - &extract_variables
- name: Extract Environment Variables
- env:
- VALUES: ${{ case(runner.os == 'Windows', needs.premerge-compute.outputs.Windows-values, runner.os == 'macOS', needs.premerge-compute.outputs.Darwin-values, needs.premerge-compute.outputs.Linux-values) }}
- run: |
- echo $VALUES | jq -r 'keys[] as $k | "\($k)=\"\(.[$k])\""' >> $GITHUB_ENV
- name: Build and Test
timeout-minutes: 120
env:
@@ -165,34 +160,19 @@ jobs:
(github.event_name != 'pull_request' || github.event.action != 'closed') &&
fromJSON(needs.premerge-compute.outputs.Windows-values).projects_to_build != ''
runs-on: llvm-premerge-windows-2022-runners
+ env: ${{ fromJSON(needs.premerge-compute.outputs.Windows-values) }}
defaults:
run:
shell: bash
steps:
- - *extract_variables
- name: Checkout LLVM
uses: actions/checkout at df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
fetch-depth: 2
- name: Compute Projects
- id: vars
run: |
- source <(git diff --name-only HEAD~1...HEAD | python .ci/compute_projects.py)
-
- if [[ "${projects_to_build}" == "" ]]; then
- echo "No projects to build"
- fi
- 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 "windows-projects=${projects_to_build}" >> $GITHUB_OUTPUT
- echo "windows-check-targets=${project_check_targets}" >> $GITHUB_OUTPUT
- echo "windows-runtimes=${runtimes_to_build}" >> $GITHUB_OUTPUT
- echo "windows-runtimes-check-targets=${runtimes_check_targets}" >> $GITHUB_OUTPUT
- name: Build and Test
timeout-minutes: 180
if: ${{ steps.vars.outputs.windows-projects != '' }}
@@ -200,11 +180,15 @@ jobs:
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
- WINDOWS_PROJECTS: ${{ steps.vars.outputs.windows-projects }}
- WINDOWS_CHECK_TARGETS: ${{ steps.vars.outputs.windows-check-targets }}
- WINDOWS_RUNTIMES: ${{ steps.vars.outputs.windows-runtimes }}
- WINDOWS_RUNTIMES_CHECK_TARGETS: ${{ steps.vars.outputs.windows-runtimes-check-targets }}
+ WINDOWS_PROJECTS: ${{ env.projects_to_build }}
+ WINDOWS_CHECK_TARGETS: ${{ env.check_targets }}
+ WINDOWS_RUNTIMES: ${{ env.runtimes_to_build }}
+ WINDOWS_RUNTIMES_CHECK_TARGETS: ${{ env.runtimes_check_targets }}
run: |
+ bash -c "echo Building projects: ${projects_to_build}"
+ bash -c "echo Running project checks targets: ${project_check_targets}"
+ bash -c "echo Building runtimes: ${runtimes_to_build}"
+ bash -c "echo Running runtimes checks targets: ${runtimes_check_targets}"
call C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64
# See the comments above in the Linux job for why we define each of
# these environment variables.
@@ -242,8 +226,8 @@ jobs:
github.repository_owner == 'llvm' &&
(github.event_name != 'pull_request' || github.event.action != 'closed') &&
fromJSON(needs.premerge-compute.outputs.Darwin-values).projects_to_build != ''
+ env: ${{ fromJSON(needs.premerge-compute.outputs.Darwin-values) }}
steps:
- - *extract_variables
- name: Checkout LLVM
uses: actions/checkout at df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
@@ -262,14 +246,19 @@ jobs:
env:
SCCACHE_BUCKET: sccache-bucket
SCCACHE_REGION: us-west-2
- PROJECTS: ${{ needs.premerge-compute-macos.outputs.macos-projects }}
- CHECK_TARGETS: ${{ needs.premerge-compute-macos.outputs.macos-check-targets }}
- RUNTIMES: ${{ needs.premerge-compute-macos.outputs.macos-runtimes }}
- RUNTIMES_CHECK_TARGETS: ${{ needs.premerge-compute-macos.outputs.macos-runtimes-check-targets }}
+ PROJECTS: ${{ env.projects_to_build }}
+ CHECK_TARGETS: ${{ env.project_check_targets }}
+ RUNTIMES: ${{ env.runtimes_to_build }}
+ RUNTIMES_CHECK_TARGETS: ${{ env.runtimes_check_targets }}
CLANG_TOOLCHAIN_PROGRAM_TIMEOUT: 120
GITHUB_TOKEN: ${{ github.token }}
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
+ 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}"
+
export SCCACHE_IDLE_TIMEOUT=0
mkdir -p artifacts
SCCACHE_LOG=info SCCACHE_ERROR_LOG=$(pwd)/artifacts/sccache.log sccache --start-server
>From 5a6d6550ddec66390d04c03fd06f3ecfbc374389 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 21 Sep 2026 15:16:43 -0700
Subject: [PATCH 15/20] Cleanup
---
.github/workflows/premerge.yaml | 2 --
1 file changed, 2 deletions(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 687eb9657a86d9..9be94671d9da7e 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -170,8 +170,6 @@ jobs:
with:
persist-credentials: false
fetch-depth: 2
- - name: Compute Projects
- run: |
- name: Build and Test
timeout-minutes: 180
>From 36a0be3694ec089cece68d98dc3fcf367db0ac6b Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 21 Sep 2026 15:17:59 -0700
Subject: [PATCH 16/20] More cleanup
---
.github/workflows/premerge.yaml | 1 -
1 file changed, 1 deletion(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 9be94671d9da7e..06f7fe679d01ca 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -173,7 +173,6 @@ jobs:
- name: Build and Test
timeout-minutes: 180
- if: ${{ steps.vars.outputs.windows-projects != '' }}
shell: cmd
env:
GITHUB_TOKEN: ${{ github.token }}
>From 2e2ed95ee10cf0b8d9184a0f60a1040aea528d5e Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 21 Sep 2026 16:20:18 -0700
Subject: [PATCH 17/20] Clean ups
---
.ci/compute_projects.py | 2 --
.github/workflows/anchors-test.yml | 11 -----------
.github/workflows/premerge.yaml | 15 ++-------------
3 files changed, 2 insertions(+), 26 deletions(-)
delete mode 100644 .github/workflows/anchors-test.yml
diff --git a/.ci/compute_projects.py b/.ci/compute_projects.py
index a80c9b32a7ec96..7a1d22e9f6f664 100644
--- a/.ci/compute_projects.py
+++ b/.ci/compute_projects.py
@@ -390,5 +390,3 @@ def get_env_variables(modified_files: list[str], platform: str) -> Set[str]:
changed_files = [line.strip() for line in sys.stdin.readlines()]
env_variables = get_env_variables(changed_files, current_platform)
print(json.dumps(env_variables))
-# for env_variable in env_variables:
- #print(f"{env_variable}='{env_variables[env_variable]}'")
diff --git a/.github/workflows/anchors-test.yml b/.github/workflows/anchors-test.yml
deleted file mode 100644
index 468432654e63fd..00000000000000
--- a/.github/workflows/anchors-test.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-on:
- push:
-jobs:
- test:
- runs-on: ubuntu-22.04
- steps:
- - &extra_variables
- name: Extract Environment Variables
- run: |
- echo "Test"
- - *extra_variables
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 06f7fe679d01ca..688b175aa34a6b 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -42,7 +42,7 @@ jobs:
Linux-values: ${{ steps.vars.outputs.Linux-values }}
Windows-values: ${{ steps.vars.outputs.Windows-values }}
Darwin-values: ${{ steps.vars.outputs.Darwin-values }}
-
+
steps:
- name: Checkout LLVM (sparse)
uses: actions/checkout at df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
@@ -61,25 +61,14 @@ jobs:
else
gh api "repos/${REPO}/compare/${{ github.event.before }}...${{ github.event.after }}" --paginate --jq '.files[].filename' > /tmp/changed_files.txt
fi
+ cat /tmp/changed_files.txt
- name: Compute Projects
id: vars
run: |
- cat /tmp/changed_files.txt
for p in Linux Windows Darwin; do
echo $p-values=$(python3 .ci/compute_projects.py $p < /tmp/changed_files.txt) >> $GITHUB_OUTPUT
- python3 .ci/compute_projects.py $p < /tmp/changed_files.txt
done
-# 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}"
-
-# echo "macos-projects=${projects_to_build}" >> $GITHUB_OUTPUT
-# echo "macos-check-targets=${project_check_targets}" >> $GITHUB_OUTPUT
-# echo "macos-runtimes=${runtimes_to_build}" >> $GITHUB_OUTPUT
-# echo "macos-runtimes-check-targets=${runtimes_check_targets}" >> $GITHUB_OUTPUT
premerge-checks-linux:
name: Build and Test Linux
needs: premerge-compute
>From 0d33b84a9fcf947d7f57a3347d4a9637ca1ae389 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Thu, 24 Sep 2026 16:09:50 -0700
Subject: [PATCH 18/20] Switch to ubuntu 24.04
---
.github/workflows/premerge.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 688b175aa34a6b..e61387d921c0b7 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -30,7 +30,7 @@ jobs:
if: >-
github.repository_owner == 'llvm' &&
(github.event_name != 'pull_request' || github.event.action != 'closed')
- runs-on: ubuntu-22.04
+ runs-on: ubuntu-24.04
permissions:
contents: read
pull-requests: read
>From 2ca55b4cd3a795758e658977d929e04a65ccf2b0 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 28 Sep 2026 15:44:21 -0700
Subject: [PATCH 19/20] Ubuntu 26
---
.github/workflows/premerge.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index 811b8ec190306d..f02cdd490829c8 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -30,7 +30,7 @@ jobs:
if: >-
github.repository_owner == 'llvm' &&
(github.event_name != 'pull_request' || github.event.action != 'closed')
- runs-on: ubuntu-24.04
+ runs-on: ubuntu-26.04
permissions:
contents: read
pull-requests: read
>From 2d9233d3924f2eb2aef25e9e3eea341a65b638c0 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Wed, 30 Sep 2026 12:44:53 -0700
Subject: [PATCH 20/20] Restore fetch-depth: 2, premerge advisor needs it
---
.github/workflows/premerge.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml
index f02cdd490829c8..c830193fa56999 100644
--- a/.github/workflows/premerge.yaml
+++ b/.github/workflows/premerge.yaml
@@ -89,6 +89,7 @@ jobs:
uses: actions/checkout at 3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
+ fetch-depth: 2
- name: Build and Test
timeout-minutes: 120
env:
More information about the llvm-commits
mailing list