Skip to content

Commit d3444ed

Browse files
committed
Merge branch 'main' into review/locale-complete-API
2 parents 79525c9 + 733a98d commit d3444ed

File tree

3,316 files changed

+1066991
-84523
lines changed

Some content is hidden

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

3,316 files changed

+1066991
-84523
lines changed

.ci/metrics/metrics.py

Lines changed: 95 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"https://influx-prod-13-prod-us-east-0.grafana.net/api/v1/push/influx/write"
1313
)
1414
GITHUB_PROJECT = "llvm/llvm-project"
15-
WORKFLOWS_TO_TRACK = ["Check code formatting", "LLVM Premerge Checks"]
15+
WORKFLOWS_TO_TRACK = ["LLVM Premerge Checks"]
1616
SCRAPE_INTERVAL_SECONDS = 5 * 60
1717

1818

@@ -26,7 +26,67 @@ class JobMetrics:
2626
workflow_id: int
2727

2828

29-
def get_metrics(github_repo: github.Repository, workflows_to_track: dict[str, int]):
29+
@dataclass
30+
class GaugeMetric:
31+
name: str
32+
value: int
33+
time_ns: int
34+
35+
36+
def get_sampled_workflow_metrics(github_repo: github.Repository):
37+
"""Gets global statistics about the Github workflow queue
38+
39+
Args:
40+
github_repo: A github repo object to use to query the relevant information.
41+
42+
Returns:
43+
Returns a list of GaugeMetric objects, containing the relevant metrics about
44+
the workflow
45+
"""
46+
47+
# Other states are available (pending, waiting, etc), but the meaning
48+
# is not documented (See #70540).
49+
# "queued" seems to be the info we want.
50+
queued_workflow_count = len(
51+
[
52+
x
53+
for x in github_repo.get_workflow_runs(status="queued")
54+
if x.name in WORKFLOWS_TO_TRACK
55+
]
56+
)
57+
running_workflow_count = len(
58+
[
59+
x
60+
for x in github_repo.get_workflow_runs(status="in_progress")
61+
if x.name in WORKFLOWS_TO_TRACK
62+
]
63+
)
64+
65+
workflow_metrics = []
66+
workflow_metrics.append(
67+
GaugeMetric(
68+
"workflow_queue_size",
69+
queued_workflow_count,
70+
time.time_ns(),
71+
)
72+
)
73+
workflow_metrics.append(
74+
GaugeMetric(
75+
"running_workflow_count",
76+
running_workflow_count,
77+
time.time_ns(),
78+
)
79+
)
80+
# Always send a hearbeat metric so we can monitor is this container is still able to log to Grafana.
81+
workflow_metrics.append(
82+
GaugeMetric("metrics_container_heartbeat", 1, time.time_ns())
83+
)
84+
return workflow_metrics
85+
86+
87+
def get_per_workflow_metrics(
88+
github_repo: github.Repository, workflows_to_track: dict[str, int]
89+
):
3090
"""Gets the metrics for specified Github workflows.
3191
3292
This function takes in a list of workflows to track, and optionally the
@@ -43,14 +103,14 @@ def get_metrics(github_repo: github.Repository, workflows_to_track: dict[str, in
43103
Returns a list of JobMetrics objects, containing the relevant metrics about
44104
the workflow.
45105
"""
46-
workflow_runs = iter(github_repo.get_workflow_runs())
47-
48106
workflow_metrics = []
49107

50108
workflows_to_include = set(workflows_to_track.keys())
51109

52-
while len(workflows_to_include) > 0:
53-
workflow_run = next(workflow_runs)
110+
for workflow_run in iter(github_repo.get_workflow_runs()):
111+
if len(workflows_to_include) == 0:
112+
break
113+
54114
if workflow_run.status != "completed":
55115
continue
56116

@@ -139,12 +199,27 @@ def upload_metrics(workflow_metrics, metrics_userid, api_key):
139199
metrics_userid: The userid to use for the upload.
140200
api_key: The API key to use for the upload.
141201
"""
202+
203+
if len(workflow_metrics) == 0:
204+
print("No metrics found to upload.", file=sys.stderr)
205+
return
206+
142207
metrics_batch = []
143208
for workflow_metric in workflow_metrics:
144-
workflow_formatted_name = workflow_metric.job_name.lower().replace(" ", "_")
145-
metrics_batch.append(
146-
f"{workflow_formatted_name} queue_time={workflow_metric.queue_time},run_time={workflow_metric.run_time},status={workflow_metric.status} {workflow_metric.created_at_ns}"
147-
)
209+
if isinstance(workflow_metric, GaugeMetric):
210+
name = workflow_metric.name.lower().replace(" ", "_")
211+
metrics_batch.append(
212+
f"{name} value={workflow_metric.value} {workflow_metric.time_ns}"
213+
)
214+
elif isinstance(workflow_metric, JobMetrics):
215+
name = workflow_metric.job_name.lower().replace(" ", "_")
216+
metrics_batch.append(
217+
f"{name} queue_time={workflow_metric.queue_time},run_time={workflow_metric.run_time},status={workflow_metric.status} {workflow_metric.created_at_ns}"
218+
)
219+
else:
220+
raise ValueError(
221+
f"Unsupported object type {type(workflow_metric)}: {str(workflow_metric)}"
222+
)
148223

149224
request_data = "\n".join(metrics_batch)
150225
response = requests.post(
@@ -176,16 +251,21 @@ def main():
176251
# Enter the main loop. Every five minutes we wake up and dump metrics for
177252
# the relevant jobs.
178253
while True:
179-
current_metrics = get_metrics(github_repo, workflows_to_track)
180-
if len(current_metrics) == 0:
181-
print("No metrics found to upload.", file=sys.stderr)
182-
continue
254+
current_metrics = get_per_workflow_metrics(github_repo, workflows_to_track)
255+
current_metrics += get_sampled_workflow_metrics(github_repo)
256+
# Always send a hearbeat metric so we can monitor is this container is still able to log to Grafana.
257+
current_metrics.append(
258+
GaugeMetric("metrics_container_heartbeat", 1, time.time_ns())
259+
)
183260

184261
upload_metrics(current_metrics, grafana_metrics_userid, grafana_api_key)
185262
print(f"Uploaded {len(current_metrics)} metrics", file=sys.stderr)
186263

187264
for workflow_metric in reversed(current_metrics):
188-
workflows_to_track[workflow_metric.job_name] = workflow_metric.workflow_id
265+
if isinstance(workflow_metric, JobMetrics):
266+
workflows_to_track[
267+
workflow_metric.job_name
268+
] = workflow_metric.workflow_id
189269

190270
time.sleep(SCRAPE_INTERVAL_SECONDS)
191271

.github/CODEOWNERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp @nikic
2828
/llvm/lib/Transforms/InstCombine/ @nikic
2929

30-
/clang/include/clang/Sema/Sema.h @Endilll
3130
/clang/test/CXX/drs/ @Endilll
3231
/clang/www/cxx_dr_status.html @Endilll
3332
/clang/www/make_cxx_dr_status @Endilll

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ jobs:
2323
runs-on: depot-ubuntu-22.04-16
2424
outputs:
2525
container-name: ${{ steps.vars.outputs.container-name }}
26+
container-name-agent: ${{ steps.vars.outputs.container-name-agent }}
2627
container-name-tag: ${{ steps.vars.outputs.container-name-tag }}
28+
container-name-agent-tag: ${{ steps.vars.outputs.container-name-agent-tag }}
2729
container-filename: ${{ steps.vars.outputs.container-filename }}
2830
steps:
2931
- name: Checkout LLVM
@@ -36,19 +38,22 @@ jobs:
3638
tag=`date +%s`
3739
container_name="ghcr.io/$GITHUB_REPOSITORY_OWNER/ci-ubuntu-22.04"
3840
echo "container-name=$container_name" >> $GITHUB_OUTPUT
41+
echo "container-name-agent=$container_name-agent" >> $GITHUB_OUTPUT
3942
echo "container-name-tag=$container_name:$tag" >> $GITHUB_OUTPUT
43+
echo "container-name-agent-tag=$container_name-agent:$tag" >> $GITHUB_OUTPUT
4044
echo "container-filename=$(echo $container_name:$tag | sed -e 's/\//-/g' -e 's/:/-/g').tar" >> $GITHUB_OUTPUT
4145
- name: Build container
4246
working-directory: ./.github/workflows/containers/github-action-ci/
4347
run: |
44-
podman build -t ${{ steps.vars.outputs.container-name-tag }} .
48+
podman build --target ci-container -t ${{ steps.vars.outputs.container-name-tag }} .
49+
podman build --target ci-container-agent -t ${{ steps.vars.outputs.container-name-agent-tag }} .
4550
4651
# Save the container so we have it in case the push fails. This also
4752
# allows us to separate the push step into a different job so we can
4853
# maintain minimal permissions while building the container.
4954
- name: Save container image
5055
run: |
51-
podman save ${{ steps.vars.outputs.container-name-tag }} > ${{ steps.vars.outputs.container-filename }}
56+
podman save ${{ steps.vars.outputs.container-name-tag }} ${{ steps.vars.outputs.container-name-agent-tag }} > ${{ steps.vars.outputs.container-filename }}
5257
5358
- name: Upload container image
5459
uses: actions/upload-artifact@v4
@@ -86,3 +91,7 @@ jobs:
8691
podman login -u ${{ github.actor }} -p $GITHUB_TOKEN ghcr.io
8792
podman push ${{ needs.build-ci-container.outputs.container-name-tag }}
8893
podman push ${{ needs.build-ci-container.outputs.container-name }}:latest
94+
95+
podman tag ${{ needs.build-ci-container.outputs.container-name-agent-tag }} ${{ needs.build-ci-container.outputs.container-name-agent }}:latest
96+
podman push ${{ needs.build-ci-container.outputs.container-name-agent-tag }}
97+
podman push ${{ needs.build-ci-container.outputs.container-name-agent }}:latest

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ RUN choco install -y handle
108108
109109
RUN pip3 install pywin32 buildbot-worker==2.8.4
110110
111-
ARG RUNNER_VERSION=2.319.1
111+
ARG RUNNER_VERSION=2.321.0
112112
ENV RUNNER_VERSION=$RUNNER_VERSION
113113
114114
RUN powershell -Command \

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ RUN apt-get update && \
1313
ninja-build \
1414
python3 \
1515
git \
16-
curl
16+
curl \
17+
zlib1g-dev
1718

1819
RUN curl -O -L https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-$LLVM_VERSION.tar.gz && tar -xf llvmorg-$LLVM_VERSION.tar.gz
1920

@@ -38,7 +39,7 @@ RUN cmake -B ./build -G Ninja ./llvm \
3839

3940
RUN ninja -C ./build stage2-clang-bolt stage2-install-distribution && ninja -C ./build install-distribution
4041

41-
FROM base
42+
FROM base as ci-container
4243

4344
COPY --from=stage1-toolchain $LLVM_SYSROOT $LLVM_SYSROOT
4445

@@ -91,4 +92,15 @@ RUN adduser gha sudo
9192
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
9293

9394
USER gha
95+
WORKDIR /home/gha
96+
97+
FROM ci-container as ci-container-agent
98+
99+
ENV GITHUB_RUNNER_VERSION=2.321.0
100+
101+
RUN mkdir actions-runner && \
102+
cd actions-runner && \
103+
curl -O -L https://github.com/actions/runner/releases/download/v$GITHUB_RUNNER_VERSION/actions-runner-linux-x64-$GITHUB_RUNNER_VERSION.tar.gz && \
104+
tar xzf ./actions-runner-linux-x64-$GITHUB_RUNNER_VERSION.tar.gz && \
105+
rm ./actions-runner-linux-x64-$GITHUB_RUNNER_VERSION.tar.gz
94106

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ jobs:
130130
sed -i 's/LLVM_[0-9]\+/LLVM_NOVERSION/' $lib-${{ matrix.ref }}.abi
131131
done
132132
- name: Upload ABI file
133-
uses: actions/upload-artifact@v3
133+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # 4.6.0
134134
with:
135135
name: ${{ matrix.name }}
136136
path: '*${{ matrix.ref }}.abi'
@@ -143,12 +143,12 @@ jobs:
143143
- abi-dump
144144
steps:
145145
- name: Download baseline
146-
uses: actions/download-artifact@v3
146+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8
147147
with:
148148
name: build-baseline
149149
path: build-baseline
150150
- name: Download latest
151-
uses: actions/download-artifact@v3
151+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8
152152
with:
153153
name: build-latest
154154
path: build-latest
@@ -162,7 +162,7 @@ jobs:
162162
done
163163
- name: Upload ABI Comparison
164164
if: always()
165-
uses: actions/upload-artifact@v3
165+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # 4.6.0
166166
with:
167167
name: compat-report-${{ github.sha }}
168168
path: compat_reports/

.github/workflows/libcxx-restart-preempted-jobs.yaml

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ jobs:
9292
check_run_id: check_run_id
9393
})
9494
95+
// For temporary debugging purposes to see the structure of the annotations.
96+
console.log(annotations);
97+
98+
has_failed_job = false;
99+
saved_failure_message = null;
100+
95101
for (annotation of annotations.data) {
96102
if (annotation.annotation_level != 'failure') {
97103
continue;
@@ -106,15 +112,32 @@ jobs:
106112
107113
const failure_match = annotation.message.match(failure_regex);
108114
if (failure_match != null) {
109-
// We only want to restart the workflow if all of the failures were due to preemption.
110-
// We don't want to restart the workflow if there were other failures.
111-
core.notice('Choosing not to rerun workflow because we found a non-preemption failure' +
112-
'Failure message: "' + annotation.message + '"');
113-
await create_check_run('skipped', 'Choosing not to rerun workflow because we found a non-preemption failure\n'
114-
+ 'Failure message: ' + annotation.message)
115-
return;
115+
has_failed_job = true;
116+
saved_failure_message = annotation.message;
116117
}
117118
}
119+
if (has_failed_job && (! has_preempted_job)) {
120+
// We only want to restart the workflow if all of the failures were due to preemption.
121+
// We don't want to restart the workflow if there were other failures.
122+
//
123+
// However, libcxx runners running inside docker containers produce both a preemption message and failure message.
124+
//
125+
// The desired approach is to ignore failure messages which appear on the same job as a preemption message
126+
// (An job is a single run with a specific configuration, ex generic-gcc, gcc-14).
127+
//
128+
// However, it's unclear that this code achieves the desired approach, and it may ignore all failures
129+
// if a preemption message is found at all on any run.
130+
//
131+
// For now, it's more important to restart preempted workflows than to avoid restarting workflows with
132+
// non-preemption failures.
133+
//
134+
// TODO Figure this out.
135+
core.notice('Choosing not to rerun workflow because we found a non-preemption failure' +
136+
'Failure message: "' + saved_failure_message + '"');
137+
await create_check_run('skipped', 'Choosing not to rerun workflow because we found a non-preemption failure\n'
138+
+ 'Failure message: ' + saved_failure_message)
139+
return;
140+
}
118141
}
119142
120143
if (!has_preempted_job) {

.github/workflows/llvm-tests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,14 @@ jobs:
137137
# Remove symbol versioning from dumps, so we can compare across major versions.
138138
sed -i 's/LLVM_${{ matrix.llvm_version_major }}/LLVM_NOVERSION/' ${{ matrix.ref }}.abi
139139
- name: Upload ABI file
140-
uses: actions/upload-artifact@v3
140+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # 4.6.0
141141
with:
142142
name: ${{ matrix.name }}
143143
path: ${{ matrix.ref }}.abi
144144

145145
- name: Upload symbol list file
146146
if: matrix.name == 'build-baseline'
147-
uses: actions/upload-artifact@v3
147+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # 4.6.0
148148
with:
149149
name: symbol-list
150150
path: llvm.symbols
@@ -157,17 +157,17 @@ jobs:
157157
- abi-dump
158158
steps:
159159
- name: Download baseline
160-
uses: actions/download-artifact@v3
160+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8
161161
with:
162162
name: build-baseline
163163
path: build-baseline
164164
- name: Download latest
165-
uses: actions/download-artifact@v3
165+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8
166166
with:
167167
name: build-latest
168168
path: build-latest
169169
- name: Download symbol list
170-
uses: actions/download-artifact@v3
170+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # 4.1.8
171171
with:
172172
name: symbol-list
173173
path: symbol-list
@@ -186,7 +186,7 @@ jobs:
186186
abi-compliance-checker $EXTRA_ARGS -l libLLVM.so -old build-baseline/*.abi -new build-latest/*.abi || test "${{ needs.abi-dump-setup.outputs.ABI_HEADERS }}" = "llvm-c"
187187
- name: Upload ABI Comparison
188188
if: always()
189-
uses: actions/upload-artifact@v3
189+
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # 4.6.0
190190
with:
191191
name: compat-report-${{ github.sha }}
192192
path: compat_reports/

0 commit comments

Comments
 (0)