Skip to content

Commit 906603f

Browse files
committed
Merge remote-tracking branch 'origin/main' into vplan-runtime-checks
2 parents b7b43a8 + 624cc70 commit 906603f

File tree

3,118 files changed

+77360
-30507
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,118 files changed

+77360
-30507
lines changed

.ci/generate_test_report.py

Lines changed: 84 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# python3 -m unittest discover -p generate_test_report.py
66

77
import argparse
8+
import os
89
import subprocess
910
import unittest
1011
from io import StringIO
@@ -267,6 +268,46 @@ def test_report_dont_list_failures(self):
267268
),
268269
)
269270

271+
def test_report_dont_list_failures_link_to_log(self):
272+
self.assertEqual(
273+
_generate_report(
274+
"Foo",
275+
[
276+
junit_from_xml(
277+
dedent(
278+
"""\
279+
<?xml version="1.0" encoding="UTF-8"?>
280+
<testsuites time="0.02">
281+
<testsuite name="Bar" tests="1" failures="1" skipped="0" time="0.02">
282+
<testcase classname="Bar/test_1" name="test_1" time="0.02">
283+
<failure><![CDATA[Output goes here]]></failure>
284+
</testcase>
285+
</testsuite>
286+
</testsuites>"""
287+
)
288+
)
289+
],
290+
list_failures=False,
291+
buildkite_info={
292+
"BUILDKITE_ORGANIZATION_SLUG": "organization_slug",
293+
"BUILDKITE_PIPELINE_SLUG": "pipeline_slug",
294+
"BUILDKITE_BUILD_NUMBER": "build_number",
295+
"BUILDKITE_JOB_ID": "job_id",
296+
},
297+
),
298+
(
299+
dedent(
300+
"""\
301+
# Foo
302+
303+
* 1 test failed
304+
305+
Failed tests and their output was too large to report. [Download](https://buildkite.com/organizations/organization_slug/pipelines/pipeline_slug/builds/build_number/jobs/job_id/download.txt) the build's log file to see the details."""
306+
),
307+
"error",
308+
),
309+
)
310+
270311
def test_report_size_limit(self):
271312
self.assertEqual(
272313
_generate_report(
@@ -308,7 +349,13 @@ def test_report_size_limit(self):
308349
# listed. This minimal report will always fit into an annotation.
309350
# If include failures is False, total number of test will be reported but their names
310351
# and output will not be.
311-
def _generate_report(title, junit_objects, size_limit=1024 * 1024, list_failures=True):
352+
def _generate_report(
353+
title,
354+
junit_objects,
355+
size_limit=1024 * 1024,
356+
list_failures=True,
357+
buildkite_info=None,
358+
):
312359
if not junit_objects:
313360
return ("", "success")
314361

@@ -354,11 +401,21 @@ def plural(num_tests):
354401
report.append(f"* {tests_failed} {plural(tests_failed)} failed")
355402

356403
if not list_failures:
404+
if buildkite_info is not None:
405+
log_url = (
406+
"https://buildkite.com/organizations/{BUILDKITE_ORGANIZATION_SLUG}/"
407+
"pipelines/{BUILDKITE_PIPELINE_SLUG}/builds/{BUILDKITE_BUILD_NUMBER}/"
408+
"jobs/{BUILDKITE_JOB_ID}/download.txt".format(**buildkite_info)
409+
)
410+
download_text = f"[Download]({log_url})"
411+
else:
412+
download_text = "Download"
413+
357414
report.extend(
358415
[
359416
"",
360417
"Failed tests and their output was too large to report. "
361-
"Download the build's log file to see the details.",
418+
f"{download_text} the build's log file to see the details.",
362419
]
363420
)
364421
elif failures:
@@ -381,13 +438,23 @@ def plural(num_tests):
381438

382439
report = "\n".join(report)
383440
if len(report.encode("utf-8")) > size_limit:
384-
return _generate_report(title, junit_objects, size_limit, list_failures=False)
441+
return _generate_report(
442+
title,
443+
junit_objects,
444+
size_limit,
445+
list_failures=False,
446+
buildkite_info=buildkite_info,
447+
)
385448

386449
return report, style
387450

388451

389-
def generate_report(title, junit_files):
390-
return _generate_report(title, [JUnitXml.fromfile(p) for p in junit_files])
452+
def generate_report(title, junit_files, buildkite_info):
453+
return _generate_report(
454+
title,
455+
[JUnitXml.fromfile(p) for p in junit_files],
456+
buildkite_info=buildkite_info,
457+
)
391458

392459

393460
if __name__ == "__main__":
@@ -399,7 +466,18 @@ def generate_report(title, junit_files):
399466
parser.add_argument("junit_files", help="Paths to JUnit report files.", nargs="*")
400467
args = parser.parse_args()
401468

402-
report, style = generate_report(args.title, args.junit_files)
469+
# All of these are required to build a link to download the log file.
470+
env_var_names = [
471+
"BUILDKITE_ORGANIZATION_SLUG",
472+
"BUILDKITE_PIPELINE_SLUG",
473+
"BUILDKITE_BUILD_NUMBER",
474+
"BUILDKITE_JOB_ID",
475+
]
476+
buildkite_info = {k: v for k, v in os.environ.items() if k in env_var_names}
477+
if len(buildkite_info) != len(env_var_names):
478+
buildkite_info = None
479+
480+
report, style = generate_report(args.title, args.junit_files, buildkite_info)
403481

404482
if report:
405483
p = subprocess.Popen(

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

Lines changed: 40 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -18,95 +18,70 @@ on:
1818
- '.github/workflows/containers/github-action-ci/**'
1919

2020
jobs:
21-
# TODO(boomanaiden154): Switch this back to a single stage build when we can
22-
# run this on the self-hosted runners and don't have to do it this way to
23-
# avoid timeouts.
24-
build-ci-container-stage1:
21+
build-ci-container:
2522
if: github.repository_owner == 'llvm'
26-
runs-on: ubuntu-latest
23+
runs-on: depot-ubuntu-22.04-16
24+
outputs:
25+
container-name: ${{ steps.vars.outputs.container-name }}
26+
container-name-tag: ${{ steps.vars.outputs.container-name-tag }}
27+
container-filename: ${{ steps.vars.outputs.container-filename }}
2728
steps:
2829
- name: Checkout LLVM
2930
uses: actions/checkout@v4
3031
with:
3132
sparse-checkout: .github/workflows/containers/github-action-ci/
32-
- name: Change podman Root Direcotry
33-
run: |
34-
mkdir -p ~/.config/containers
35-
sudo mkdir -p /mnt/podman
36-
sudo chown `whoami`:`whoami` /mnt/podman
37-
cp ./.github/workflows/containers/github-action-ci/storage.conf ~/.config/containers/storage.conf
38-
podman info
39-
- name: Build container stage1
40-
working-directory: ./.github/workflows/containers/github-action-ci/
41-
run: |
42-
podman build -t stage1-toolchain --target stage1-toolchain -f stage1.Dockerfile .
43-
- name: Save container image
44-
run: |
45-
podman save stage1-toolchain > stage1-toolchain.tar
46-
- name: Upload container image
47-
uses: actions/upload-artifact@v4
48-
with:
49-
name: stage1-toolchain
50-
path: stage1-toolchain.tar
51-
retention-days: 1
52-
build-ci-container-stage2:
53-
if: github.repository_owner == 'llvm'
54-
runs-on: ubuntu-latest
55-
needs: build-ci-container-stage1
56-
permissions:
57-
packages: write
58-
steps:
5933
- name: Write Variables
6034
id: vars
6135
run: |
6236
tag=`date +%s`
6337
container_name="ghcr.io/$GITHUB_REPOSITORY_OWNER/ci-ubuntu-22.04"
6438
echo "container-name=$container_name" >> $GITHUB_OUTPUT
6539
echo "container-name-tag=$container_name:$tag" >> $GITHUB_OUTPUT
66-
67-
- name: Checkout LLVM
68-
uses: actions/checkout@v4
69-
with:
70-
sparse-checkout: .github/workflows/containers/github-action-ci/
71-
72-
- name: Change podman Root Direcotry
40+
echo "container-filename=$(echo $container_name:$tag | sed -e 's/\//-/g' -e 's/:/-/g').tar" >> $GITHUB_OUTPUT
41+
- name: Build container
42+
working-directory: ./.github/workflows/containers/github-action-ci/
7343
run: |
74-
mkdir -p ~/.config/containers
75-
sudo mkdir -p /mnt/podman
76-
sudo chown `whoami`:`whoami` /mnt/podman
77-
cp ./.github/workflows/containers/github-action-ci/storage.conf ~/.config/containers/storage.conf
78-
podman info
44+
podman build -t ${{ steps.vars.outputs.container-name-tag }} .
7945
80-
# Download the container image into /mnt/podman rather than
81-
# $GITHUB_WORKSPACE to avoid space limitations on the default drive
82-
# and use the permissions setup for /mnt/podman.
83-
- name: Download stage1-toolchain
84-
uses: actions/download-artifact@v4
85-
with:
86-
name: stage1-toolchain
87-
path: /mnt/podman
88-
89-
- name: Load stage1-toolchain
46+
# Save the container so we have it in case the push fails. This also
47+
# allows us to separate the push step into a different job so we can
48+
# maintain minimal permissions while building the container.
49+
- name: Save container image
9050
run: |
91-
podman load -i /mnt/podman/stage1-toolchain.tar
51+
podman save ${{ steps.vars.outputs.container-name-tag }} > ${{ steps.vars.outputs.container-filename }}
9252
93-
- name: Build Container
94-
working-directory: ./.github/workflows/containers/github-action-ci/
95-
run: |
96-
podman build -t ${{ steps.vars.outputs.container-name-tag }} -f stage2.Dockerfile .
97-
podman tag ${{ steps.vars.outputs.container-name-tag }} ${{ steps.vars.outputs.container-name }}:latest
53+
- name: Upload container image
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: container
57+
path: ${{ steps.vars.outputs.container-filename }}
58+
retention-days: 14
9859

9960
- name: Test Container
10061
run: |
10162
for image in ${{ steps.vars.outputs.container-name-tag }} ${{ steps.vars.outputs.container-name }}; do
10263
podman run --rm -it $image /usr/bin/bash -x -c 'printf '\''#include <iostream>\nint main(int argc, char **argv) { std::cout << "Hello\\n"; }'\'' | clang++ -x c++ - && ./a.out | grep Hello'
10364
done
10465
66+
push-ci-container:
67+
if: github.event_name == 'push'
68+
needs:
69+
- build-ci-container
70+
permissions:
71+
packages: write
72+
runs-on: ubuntu-24.04
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
steps:
76+
- name: Download container
77+
uses: actions/download-artifact@v4
78+
with:
79+
name: container
80+
10581
- name: Push Container
106-
if: github.event_name == 'push'
107-
env:
108-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10982
run: |
83+
podman load -i ${{ needs.build-ci-container.outptus.container-filename }}
84+
podman tag ${{ steps.vars.outputs.container-name-tag }} ${{ steps.vars.outputs.container-name }}:latest
11085
podman login -u ${{ github.actor }} -p $GITHUB_TOKEN ghcr.io
111-
podman push ${{ steps.vars.outputs.container-name-tag }}
112-
podman push ${{ steps.vars.outputs.container-name }}:latest
86+
podman push ${{ needs.build-ci-container.outputs.container-name-tag }}
87+
podman push ${{ needs.build-ci-container.outputs.container-name }}:latest
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
FROM docker.io/library/ubuntu:22.04 as base
2+
ENV LLVM_SYSROOT=/opt/llvm
3+
4+
FROM base as stage1-toolchain
5+
ENV LLVM_VERSION=19.1.2
6+
7+
RUN apt-get update && \
8+
apt-get install -y \
9+
wget \
10+
gcc \
11+
g++ \
12+
cmake \
13+
ninja-build \
14+
python3 \
15+
git \
16+
curl
17+
18+
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
19+
20+
WORKDIR /llvm-project-llvmorg-$LLVM_VERSION
21+
22+
# Patch to enable better PGO profile data.
23+
# TODO: Remove this for llvm 20
24+
ADD https://github.com/llvm/llvm-project/commit/738250989ce516f02f809bdfde474a039c77e81f.patch .
25+
26+
RUN patch -p1 < 738250989ce516f02f809bdfde474a039c77e81f.patch
27+
28+
RUN cmake -B ./build -G Ninja ./llvm \
29+
-C ./clang/cmake/caches/BOLT-PGO.cmake \
30+
-DBOOTSTRAP_LLVM_ENABLE_LLD=ON \
31+
-DBOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_LLD=ON \
32+
-DPGO_INSTRUMENT_LTO=Thin \
33+
-DLLVM_ENABLE_RUNTIMES="compiler-rt" \
34+
-DCMAKE_INSTALL_PREFIX="$LLVM_SYSROOT" \
35+
-DLLVM_ENABLE_PROJECTS="bolt;clang;lld;clang-tools-extra" \
36+
-DLLVM_DISTRIBUTION_COMPONENTS="lld;compiler-rt;clang-format;scan-build" \
37+
-DCLANG_DEFAULT_LINKER="lld"
38+
39+
RUN ninja -C ./build stage2-clang-bolt stage2-install-distribution && ninja -C ./build install-distribution
40+
41+
FROM base
42+
43+
COPY --from=stage1-toolchain $LLVM_SYSROOT $LLVM_SYSROOT
44+
45+
# Need to install curl for hendrikmuhs/ccache-action
46+
# Need nodejs for some of the GitHub actions.
47+
# Need perl-modules for clang analyzer tests.
48+
# Need git for SPIRV-Tools tests.
49+
RUN apt-get update && \
50+
apt-get install -y \
51+
binutils \
52+
cmake \
53+
curl \
54+
git \
55+
libstdc++-11-dev \
56+
ninja-build \
57+
nodejs \
58+
perl-modules \
59+
python3-psutil
60+
61+
ENV LLVM_SYSROOT=$LLVM_SYSROOT
62+
ENV PATH=${LLVM_SYSROOT}/bin:${PATH}

.github/workflows/containers/github-action-ci/bootstrap.patch

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

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

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

0 commit comments

Comments
 (0)