Skip to content

Commit 34d8586

Browse files
[CI] Move CI over to new project computation script
This patch migrates the CI over to the new compute_projects.py script for calculating what projects need to be tested based on a change to LLVM. Reviewers: lnihlen, ldionne, tstellar, Endilll, joker-eph, Keenuts Reviewed By: Keenuts, tstellar Pull Request: #132642
1 parent 40c1d50 commit 34d8586

File tree

3 files changed

+27
-279
lines changed

3 files changed

+27
-279
lines changed

.ci/compute-projects.sh

Lines changed: 0 additions & 194 deletions
This file was deleted.

.ci/generate-buildkite-pipeline-premerge

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ modified_dirs=$(echo "$MODIFIED_FILES" | cut -d'/' -f1 | sort -u)
5252
echo "Directories modified:" >&2
5353
echo "$modified_dirs" >&2
5454

55-
. ./.ci/compute-projects.sh
56-
5755
# Project specific pipelines.
5856

5957
# If libc++ or one of the runtimes directories changed.
@@ -73,20 +71,16 @@ fi
7371
# needs while letting them run on the infrastructure provided by LLVM.
7472

7573
# Figure out which projects need to be built on each platform
76-
all_projects="bolt clang clang-tools-extra compiler-rt cross-project-tests flang libc libclc lld lldb llvm mlir openmp polly pstl"
77-
modified_projects="$(keep-modified-projects ${all_projects})"
78-
79-
linux_projects_to_test=$(exclude-linux $(compute-projects-to-test 0 ${modified_projects}))
80-
linux_check_targets=$(check-targets ${linux_projects_to_test} | sort | uniq)
81-
linux_projects=$(add-dependencies ${linux_projects_to_test} | sort | uniq)
74+
source <(git diff --name-only origin/${BUILDKITE_PULL_REQUEST_BASE_BRANCH}...HEAD | python3 .ci/compute_projects.py Linux)
75+
linux_projects=${projects_to_build}
76+
linux_check_targets=${project_check_targets}
77+
linux_runtimes=${runtimes_to_build}
78+
linux_runtime_check_targets=${runtimes_check_targets}
8279

83-
linux_runtimes_to_test=$(compute-runtimes-to-test ${linux_projects_to_test})
84-
linux_runtime_check_targets=$(check-targets ${linux_runtimes_to_test} | sort | uniq)
85-
linux_runtimes=$(echo ${linux_runtimes_to_test} | sort | uniq)
80+
source <(git diff --name-only origin/${BUILDKITE_PULL_REQUEST_BASE_BRANCH}...HEAD | python3 .ci/compute_projects.py Windows)
81+
windows_projects=${projects_to_build}
82+
windows_check_targets=${project_check_targets}
8683

87-
windows_projects_to_test=$(exclude-windows $(compute-projects-to-test 1 ${modified_projects}))
88-
windows_check_targets=$(check-targets ${windows_projects_to_test} | sort | uniq)
89-
windows_projects=$(add-dependencies ${windows_projects_to_test} | sort | uniq)
9084

9185
# Generate the appropriate pipeline
9286
if [[ "${linux_projects}" != "" ]]; then

.github/workflows/premerge.yaml

Lines changed: 19 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -49,39 +49,22 @@ jobs:
4949
run: |
5050
git config --global --add safe.directory '*'
5151
52-
modified_files=$(git diff --name-only HEAD~1...HEAD)
53-
modified_dirs=$(echo "$modified_files" | cut -d'/' -f1 | sort -u)
52+
source <(git diff --name-only HEAD~1...HEAD | python3 .ci/compute_projects.py)
5453
55-
echo $modified_files
56-
echo $modified_dirs
57-
58-
. ./.ci/compute-projects.sh
59-
60-
all_projects="bolt clang clang-tools-extra compiler-rt cross-project-tests flang libc libclc lld lldb llvm mlir openmp polly pstl"
61-
modified_projects="$(keep-modified-projects ${all_projects})"
62-
63-
linux_projects_to_test=$(exclude-linux $(compute-projects-to-test 0 ${modified_projects}))
64-
linux_check_targets=$(check-targets ${linux_projects_to_test} | sort | uniq)
65-
linux_projects=$(add-dependencies ${linux_projects_to_test} | sort | uniq)
66-
67-
linux_runtimes_to_test=$(compute-runtimes-to-test ${linux_projects_to_test})
68-
linux_runtime_check_targets=$(check-targets ${linux_runtimes_to_test} | sort | uniq)
69-
linux_runtimes=$(echo ${linux_runtimes_to_test} | sort | uniq)
70-
71-
if [[ "${linux_projects}" == "" ]]; then
54+
if [[ "${projects_to_build}" == "" ]]; then
7255
echo "No projects to build"
7356
exit 0
7457
fi
7558
76-
echo "Building projects: ${linux_projects}"
77-
echo "Running project checks targets: ${linux_check_targets}"
78-
echo "Building runtimes: ${linux_runtimes}"
79-
echo "Running runtimes checks targets: ${linux_runtime_check_targets}"
59+
echo "Building projects: ${projects_to_build}"
60+
echo "Running project checks targets: ${project_check_targets}"
61+
echo "Building runtimes: ${runtimes_to_build}"
62+
echo "Running runtimes checks targets: ${runtimes_check_targets}"
8063
8164
export CC=/opt/llvm/bin/clang
8265
export CXX=/opt/llvm/bin/clang++
8366
84-
./.ci/monolithic-linux.sh "$(echo ${linux_projects} | tr ' ' ';')" "$(echo ${linux_check_targets})" "$(echo ${linux_runtimes} | tr ' ' ';')" "$(echo ${linux_runtime_check_targets})"
67+
./.ci/monolithic-linux.sh "${projects_to_build}" "${project_check_targets}" "${runtimes_to_build}" "${runtimes_check_targets}"
8568
8669
premerge-checks-windows:
8770
name: Windows Premerge Checks (Test Only - Please Ignore Results)
@@ -105,30 +88,17 @@ jobs:
10588
- name: Compute Projects
10689
id: vars
10790
run: |
108-
modified_files=$(git diff --name-only HEAD~1...HEAD)
109-
modified_dirs=$(echo "$modified_files" | cut -d'/' -f1 | sort | uniq)
110-
111-
echo $modified_files
112-
echo $modified_dirs
113-
114-
. ./.ci/compute-projects.sh
91+
source <(git diff --name-only HEAD~1...HEAD | python .ci/compute_projects.py)
11592
116-
all_projects="bolt clang clang-tools-extra compiler-rt cross-project-tests flang libc libclc lld lldb llvm mlir openmp polly pstl"
117-
modified_projects="$(keep-modified-projects ${all_projects})"
118-
119-
windows_projects_to_test=$(exclude-windows $(compute-projects-to-test 1 ${modified_projects}))
120-
windows_check_targets=$(check-targets ${windows_projects_to_test} | sort | uniq | tr -d '\r' | tr '\n' ' ')
121-
windows_projects=$(add-dependencies ${windows_projects_to_test} | sort | uniq | tr -d '\r' | tr '\n' ';')
122-
123-
if [[ "${windows_projects}" == "" ]]; then
93+
if [[ "${projects_to_build}" == "" ]]; then
12494
echo "No projects to build"
12595
fi
12696
127-
echo "Building projects: ${windows_projects}"
128-
echo "Running project checks targets: ${windows_check_targets}"
97+
echo "Building projects: ${projects_to_build}"
98+
echo "Running project checks targets: ${project_check_targets}"
12999
130-
echo "windows-projects=${windows_projects}" >> $GITHUB_OUTPUT
131-
echo "windows-check-targets=${windows_check_targets}" >> $GITHUB_OUTPUT
100+
echo "windows-projects=${projects_to_build}" >> $GITHUB_OUTPUT
101+
echo "windows-check-targets=${project_check_targets}" >> $GITHUB_OUTPUT
132102
- name: Build and Test
133103
# Mark the job as a success even if the step fails so that people do
134104
# not get notified while the new premerge pipeline is in an
@@ -165,45 +135,23 @@ jobs:
165135
uses: llvm/actions/install-ninja@main
166136
- name: Build and Test
167137
run: |
168-
modified_files=$(git diff --name-only HEAD~1...HEAD)
169-
modified_dirs=$(echo "$modified_files" | cut -d'/' -f1 | sort -u)
170-
171-
echo $modified_files
172-
echo $modified_dirs
173-
174-
. ./.ci/compute-projects.sh
175-
176-
all_projects="clang clang-tools-extra lld lldb llvm mlir"
177-
modified_projects="$(keep-modified-projects ${all_projects})"
178-
179-
# We have to disable the runtimes builds due to https://github.com/llvm/llvm-project/issues/90568
180-
# and the lldb tests depend on libcxx, so we need to skip them.
181-
mac_check_targets=$(check-targets ${modified_projects} | sort | uniq | tr '\n' ' ' | sed -e 's/check-lldb //g')
182-
mac_projects=$(add-dependencies ${modified_projects} | sort | uniq | tr '\n' ' ')
183-
184-
mac_runtimes_to_test=$(compute-runtimes-to-test ${modified_projects})
185-
mac_runtime_check_targets=$(check-targets ${mac_runtimes_to_test} | sort | uniq | tr '\n' ' ')
186-
mac_runtimes=$(echo ${mac_runtimes_to_test} | tr ' ' '\n' | sort | uniq | tr '\n' ' ')
138+
source <(git diff --name-only HEAD~2..HEAD | python3 .ci/compute_projects.py)
187139
188-
if [[ "${mac_projects}" == "" ]]; then
140+
if [[ "${projects_to_build}" == "" ]]; then
189141
echo "No projects to build"
190142
exit 0
191143
fi
192144
193-
echo "Projects to test: ${modified_projects}"
194-
echo "Runtimes to test: ${mac_runtimes_to_test}"
195-
echo "Building projects: ${mac_projects}"
196-
echo "Running project checks targets: ${mac_check_targets}"
197-
echo "Building runtimes: ${mac_runtimes}"
198-
echo "Running runtimes checks targets: ${mac_runtime_check_targets}"
145+
echo "Building projects: ${projects_to_build}"
146+
echo "Running project checks targets: ${project_check_targets}"
199147
200148
# -DLLVM_DISABLE_ASSEMBLY_FILES=ON is for
201149
# https://github.com/llvm/llvm-project/issues/81967
202150
# Disable sharding in lit so that the LIT_XFAIL environment var works.
203151
cmake -G Ninja \
204152
-B build \
205153
-S llvm \
206-
-DLLVM_ENABLE_PROJECTS="$(echo ${mac_projects} | tr ' ' ';')" \
154+
-DLLVM_ENABLE_PROJECTS="${projects_to_build}" \
207155
-DLLVM_DISABLE_ASSEMBLY_FILES=ON \
208156
-DCMAKE_BUILD_TYPE=Release \
209157
-DLLDB_INCLUDE_TESTS=OFF \
@@ -212,4 +160,4 @@ jobs:
212160
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
213161
214162
# The libcxx tests fail, so we are skipping the runtime targets.
215-
ninja -C build $mac_check_targets
163+
ninja -C build ${project_check_targets}

0 commit comments

Comments
 (0)