Skip to content

Commit 5ad89c4

Browse files
committed
Merge remote-tracking branch 'origin/main' into vplan-hoist-single-scalar-load
2 parents 3d4eb1b + 1f58cbe commit 5ad89c4

File tree

1,584 files changed

+85014
-57280
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,584 files changed

+85014
-57280
lines changed

.ci/all_requirements.txt

Lines changed: 192 additions & 2 deletions
Large diffs are not rendered by default.

.ci/premerge_advisor_explain.py

Lines changed: 97 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,90 @@
44
"""Script for getting explanations from the premerge advisor."""
55

66
import argparse
7-
import os
87
import platform
98
import sys
9+
import json
10+
11+
# TODO(boomanaiden154): Remove the optional call once we can require Python
12+
# 3.10.
13+
from typing import Optional
1014

1115
import requests
16+
import github
17+
import github.PullRequest
1218

1319
import generate_test_report_lib
1420

1521
PREMERGE_ADVISOR_URL = (
1622
"http://premerge-advisor.premerge-advisor.svc.cluster.local:5000/explain"
1723
)
24+
COMMENT_TAG = "<!--PREMERGE ADVISOR COMMENT: {platform}-->"
25+
26+
27+
def get_comment_id(platform: str, pr: github.PullRequest.PullRequest) -> Optional[int]:
28+
platform_comment_tag = COMMENT_TAG.format(platform=platform)
29+
for comment in pr.as_issue().get_comments():
30+
if platform_comment_tag in comment.body:
31+
return comment.id
32+
return None
33+
34+
35+
def get_comment(
36+
github_token: str,
37+
pr_number: int,
38+
body: str,
39+
) -> dict[str, str]:
40+
repo = github.Github(github_token).get_repo("llvm/llvm-project")
41+
pr = repo.get_issue(pr_number).as_pull_request()
42+
comment = {"body": body}
43+
comment_id = get_comment_id(platform.system(), pr)
44+
if comment_id:
45+
comment["id"] = comment_id
46+
return comment
1847

1948

20-
def main(commit_sha: str, build_log_files: list[str]):
49+
def main(
50+
commit_sha: str,
51+
build_log_files: list[str],
52+
github_token: str,
53+
pr_number: int,
54+
return_code: int,
55+
):
56+
"""The main entrypoint for the script.
57+
58+
This function parses failures from files, requests information from the
59+
premerge advisor, and may write a Github comment depending upon the output.
60+
There are four different scenarios:
61+
1. There has never been a previous failure and the job passes - We do not
62+
create a comment. We write out an empty file to the comment path so the
63+
issue-write workflow knows not to create anything.
64+
2. There has never been a previous failure and the job fails - We create a
65+
new comment containing the failure information and any possible premerge
66+
advisor findings.
67+
3. There has been a previous failure and the job passes - We update the
68+
existing comment by passing its ID and a passed message to the
69+
issue-write workflow.
70+
4. There has been a previous failure and the job fails - We update the
71+
existing comment in the same manner as above, but generate the comment
72+
as if we have a failure.
73+
74+
Args:
75+
commit_sha: The base commit SHA for this PR run.
76+
build_log_files: The list of JUnit XML files and ninja logs.
77+
github_token: The token to use to access the Github API.
78+
pr_number: The number of the PR associated with this run.
79+
return_code: The numerical return code of ninja/CMake.
80+
"""
81+
if return_code == 0:
82+
with open("comment", "w") as comment_file_handle:
83+
comment = get_comment(
84+
github_token,
85+
pr_number,
86+
":white_check_mark: With the latest revision this PR passed "
87+
"the premerge checks.",
88+
)
89+
if "id" in comment:
90+
json.dump([comment], comment_file_handle)
2191
junit_objects, ninja_logs = generate_test_report_lib.load_info_from_files(
2292
build_log_files
2393
)
@@ -45,13 +115,31 @@ def main(commit_sha: str, build_log_files: list[str]):
45115
)
46116
if advisor_response.status_code == 200:
47117
print(advisor_response.json())
118+
comments = [
119+
get_comment(
120+
github_token,
121+
pr_number,
122+
generate_test_report_lib.generate_report(
123+
generate_test_report_lib.compute_platform_title(),
124+
return_code,
125+
junit_objects,
126+
ninja_logs,
127+
failure_explanations_list=advisor_response.json(),
128+
),
129+
)
130+
]
131+
with open("comment", "w") as comment_file_handle:
132+
json.dump(comments, comment_file_handle)
48133
else:
49134
print(advisor_response.reason)
50135

51136

52137
if __name__ == "__main__":
53138
parser = argparse.ArgumentParser()
54139
parser.add_argument("commit_sha", help="The base commit SHA for the test.")
140+
parser.add_argument("return_code", help="The build's return code", type=int)
141+
parser.add_argument("github_token", help="Github authentication token", type=str)
142+
parser.add_argument("pr_number", help="The PR number", type=int)
55143
parser.add_argument(
56144
"build_log_files", help="Paths to JUnit report files and ninja logs.", nargs="*"
57145
)
@@ -62,4 +150,10 @@ def main(commit_sha: str, build_log_files: list[str]):
62150
if platform.machine() == "arm64":
63151
sys.exit(0)
64152

65-
main(args.commit_sha, args.build_log_files)
153+
main(
154+
args.commit_sha,
155+
args.build_log_files,
156+
args.github_token,
157+
args.pr_number,
158+
args.return_code,
159+
)

.ci/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
junitparser==3.2.0
22
google-cloud-storage==3.3.0
3+
PyGithub==2.8.1

.ci/utils.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,18 @@ function at-exit {
3333
# If building fails there will be no results files.
3434
shopt -s nullglob
3535

36-
if [[ "$GITHUB_STEP_SUMMARY" != "" ]]; then
36+
if [[ "$GITHUB_ACTIONS" != "" ]]; then
3737
python "${MONOREPO_ROOT}"/.ci/generate_test_report_github.py \
3838
$retcode "${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log \
3939
>> $GITHUB_STEP_SUMMARY
40+
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_explain.py \
41+
$(git rev-parse HEAD~1) $retcode "${GITHUB_TOKEN}" \
42+
$GITHUB_PR_NUMBER "${BUILD_DIR}"/test-results.*.xml \
43+
"${MONOREPO_ROOT}"/ninja*.log
4044
fi
4145

4246
if [[ "$retcode" != "0" ]]; then
4347
if [[ "$GITHUB_ACTIONS" != "" ]]; then
44-
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_explain.py \
45-
$(git rev-parse HEAD~1) "${BUILD_DIR}"/test-results.*.xml \
46-
"${MONOREPO_ROOT}"/ninja*.log
4748
python "${MONOREPO_ROOT}"/.ci/premerge_advisor_upload.py \
4849
$(git rev-parse HEAD~1) $GITHUB_RUN_NUMBER \
4950
"${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log

.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
HeaderFilterRegex: ''
12
Checks: >
23
-*,
34
clang-diagnostic-*,

.github/workflows/bazel-checks.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,6 @@ jobs:
5252
working-directory: utils/bazel
5353
run: |
5454
bazelisk test --config=ci --sandbox_base="" \
55+
--remote_cache=https://storage.googleapis.com/$CACHE_GCS_BUCKET-bazel \
56+
--google_default_credentials \
5557
@llvm-project//llvm/unittests:adt_tests

.github/workflows/build-ci-container-tooling.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ jobs:
3636
test-command: 'cd $HOME && clang-format --version | grep version && git-clang-format -h | grep usage && black --version | grep black'
3737
- container-name: lint
3838
test-command: 'cd $HOME && clang-tidy --version | grep version && clang-tidy-diff.py -h | grep usage'
39+
- container-name: abi-tests
40+
test-command: 'cd $HOME && abi-compliance-checker --help'
41+
target: abi-tests
3942
steps:
4043
- name: Checkout LLVM
4144
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -52,7 +55,7 @@ jobs:
5255
with:
5356
container-name: ci-ubuntu-24.04-${{ matrix.container-name }}
5457
dockerfile: .github/workflows/containers/github-action-ci-tooling/Dockerfile
55-
target: ci-container-code-${{ matrix.container-name }}
58+
target: ci-container-${{ matrix.target || format('code-{0}', matrix.container-name) }}
5659
test-command: ${{ matrix.test-command }}
5760

5861
push-ci-container:

.github/workflows/containers/github-action-ci-tooling/Dockerfile

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,28 @@ RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
4747
# as root in 'ci-container-code-format' and 'ci-container-code-lint' containers
4848

4949

50+
FROM base AS ci-container-build-tools
51+
ARG LLVM_VERSION
52+
ARG LLVM_VERSION_MAJOR
53+
54+
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-${LLVM_VERSION_MAJOR} \
55+
${LLVM_SYSROOT}/bin/
56+
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/lib/clang/${LLVM_VERSION_MAJOR}/include \
57+
${LLVM_SYSROOT}/lib/clang/${LLVM_VERSION_MAJOR}/include
58+
RUN ln -s ${LLVM_SYSROOT}/bin/clang-${LLVM_VERSION_MAJOR} ${LLVM_SYSROOT}/bin/clang && \
59+
ln -s ${LLVM_SYSROOT}/bin/clang ${LLVM_SYSROOT}/bin/clang++
60+
61+
RUN apt-get update && \
62+
DEBIAN_FRONTEND=noninteractive apt-get install -y \
63+
cmake \
64+
ninja-build && \
65+
apt-get clean && \
66+
rm -rf /var/lib/apt/lists/*
67+
68+
ENV CC=${LLVM_SYSROOT}/bin/clang
69+
ENV CXX=${LLVM_SYSROOT}/bin/clang++
70+
71+
5072
FROM base AS ci-container-code-format
5173
ARG LLVM_VERSION
5274

@@ -63,31 +85,38 @@ USER gha
6385
WORKDIR /home/gha
6486

6587

66-
FROM base AS ci-container-code-lint
88+
FROM ci-container-build-tools AS ci-container-code-lint
6789
ARG LLVM_VERSION
6890
ARG LLVM_VERSION_MAJOR
6991

7092
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-tidy \
71-
/llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-${LLVM_VERSION_MAJOR} \
7293
${LLVM_SYSROOT}/bin/
73-
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/lib/clang/${LLVM_VERSION_MAJOR}/include \
74-
${LLVM_SYSROOT}/lib/clang/${LLVM_VERSION_MAJOR}/include
7594
COPY clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py ${LLVM_SYSROOT}/bin/clang-tidy-diff.py
7695

77-
RUN ln -s ${LLVM_SYSROOT}/bin/clang-${LLVM_VERSION_MAJOR} ${LLVM_SYSROOT}/bin/clang && \
78-
ln -s ${LLVM_SYSROOT}/bin/clang ${LLVM_SYSROOT}/bin/clang++
96+
# Install dependencies for 'pr-code-lint.yml' job
97+
COPY llvm/utils/git/requirements_linting.txt requirements_linting.txt
98+
RUN pip install -r requirements_linting.txt --break-system-packages && \
99+
rm requirements_linting.txt
100+
USER gha
101+
WORKDIR /home/gha
102+
79103

104+
FROM ci-container-build-tools as ci-container-abi-tests
80105

81106
RUN apt-get update && \
82107
DEBIAN_FRONTEND=noninteractive apt-get install -y \
83-
cmake \
84-
ninja-build && \
108+
abi-compliance-checker \
109+
abi-dumper \
110+
autoconf \
111+
parallel \
112+
pkg-config && \
85113
apt-get clean && \
86114
rm -rf /var/lib/apt/lists/*
87115

88-
# Install dependencies for 'pr-code-lint.yml' job
89-
COPY llvm/utils/git/requirements_linting.txt requirements_linting.txt
90-
RUN pip install -r requirements_linting.txt --break-system-packages && \
91-
rm requirements_linting.txt
92-
USER gha
93-
WORKDIR /home/gha
116+
RUN git clone https://github.com/universal-ctags/ctags.git && \
117+
cd ctags && \
118+
./autogen.sh && \
119+
./configure && \
120+
sudo make install && \
121+
rm -Rf ../ctags
122+

.github/workflows/issue-write.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- "Check for private emails used in PRs"
88
- "PR Request Release Note"
99
- "Code lint"
10+
- "CI Checks"
1011
types:
1112
- completed
1213

.github/workflows/libclang-abi-tests.yml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ jobs:
8484
if: github.repository_owner == 'llvm'
8585
needs: abi-dump-setup
8686
runs-on: ubuntu-24.04
87+
container:
88+
image: "ghcr.io/llvm/ci-ubuntu-24.04-abi-tests@sha256:f80125c0f767e29b8616210c0fd5cea2cd1f4fb6f2ca86d89f6016b6329b8d7f" #ghcr.io/llvm/ci-ubuntu-24.04-abi-tests:9524b37c503f
8789
strategy:
8890
matrix:
8991
name:
@@ -101,17 +103,6 @@ jobs:
101103
steps:
102104
- name: Install Ninja
103105
uses: llvm/actions/install-ninja@42d80571b13f4599bbefbc7189728b64723c7f78 # main
104-
- name: Install abi-compliance-checker
105-
run: |
106-
sudo apt-get update
107-
sudo apt-get install -y abi-dumper autoconf pkg-config
108-
- name: Install universal-ctags
109-
run: |
110-
git clone https://github.com/universal-ctags/ctags.git
111-
cd ctags
112-
./autogen.sh
113-
./configure
114-
sudo make install
115106
- name: Download source code
116107
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
117108
with:
@@ -139,6 +130,8 @@ jobs:
139130
abi-compare:
140131
if: github.repository_owner == 'llvm'
141132
runs-on: ubuntu-24.04
133+
container:
134+
image: "ghcr.io/llvm/ci-ubuntu-24.04-abi-tests@sha256:f80125c0f767e29b8616210c0fd5cea2cd1f4fb6f2ca86d89f6016b6329b8d7f" #ghcr.io/llvm/ci-ubuntu-24.04-abi-tests:9524b37c503f
142135
needs:
143136
- abi-dump-setup
144137
- abi-dump
@@ -154,10 +147,6 @@ jobs:
154147
name: build-latest
155148
path: build-latest
156149

157-
- name: Install abi-compliance-checker
158-
run: |
159-
sudo apt-get update
160-
sudo apt-get install -y abi-compliance-checker
161150
- name: Compare ABI
162151
run: |
163152
for lib in ${{ needs.abi-dump-setup.outputs.ABI_LIBS }}; do

0 commit comments

Comments
 (0)