Skip to content

Commit 8356d3f

Browse files
authored
Merge branch 'master' into master
2 parents 14c0832 + 60a3084 commit 8356d3f

File tree

13,228 files changed

+320233
-201820
lines changed

Some content is hidden

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

13,228 files changed

+320233
-201820
lines changed

.editorconfig

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ end_of_line = lf
99
charset = utf-8
1010
trim_trailing_whitespace = true
1111
insert_final_newline = true
12+
13+
[!src/llvm-project]
1214
indent_style = space
1315
indent_size = 4
1416

.git-blame-ignore-revs

+2
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ ec2cc761bc7067712ecc7734502f703fe3b024c8
2929
99cb0c6bc399fb94a0ddde7e9b38e9c00d523bad
3030
# reformat with rustfmt edition 2024
3131
c682aa162b0d41e21cc6748f4fecfe01efb69d1f
32+
# reformat with updated edition 2024
33+
1fcae03369abb4c2cc180cd5a49e1f4440a81300

.github/ISSUE_TEMPLATE/bootstrap.md

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
name: Bootstrap (Rust Build System) Report
3+
about: Issues encountered on bootstrap build system
4+
labels: C-bug, T-bootstrap
5+
---
6+
7+
<!--
8+
Thank you for submitting a bootstrap report! Please provide detailed information to help us reproduce and diagnose the issue.
9+
-->
10+
11+
### Summary
12+
13+
<!--
14+
Provide a brief description of the problem you are experiencing.
15+
-->
16+
17+
### Command used
18+
19+
```sh
20+
<command>
21+
```
22+
23+
### Expected behaviour
24+
25+
<!--
26+
Describe what you expected to happen.
27+
-->
28+
29+
### Actual behaviour
30+
31+
<!--
32+
Describe what actually happened.
33+
-->
34+
35+
### Bootstrap configuration (bootstrap.toml)
36+
```toml
37+
<config>
38+
```
39+
40+
### Operating system
41+
42+
<!--
43+
e.g., Ubuntu 22.04, macOS 12, Windows 10
44+
-->
45+
46+
### HEAD
47+
48+
<!--
49+
Output of `git rev-parse HEAD` command, or content of the `git-commit-hash` file if using a tarball source.
50+
-->
51+
52+
### Additional context
53+
<!--
54+
Include any other relevant information (e.g., if you have custom patches or modifications on the project).
55+
-->
56+
57+
58+
<!--
59+
Include the complete build log in the section below.
60+
Enable backtrace and verbose mode if possible for more detailed information e.g., with `RUST_BACKTRACE=1 ./x build -v`.
61+
-->
62+
<details><summary>Build Log</summary>
63+
<p>
64+
65+
```txt
66+
<log>
67+
```
68+
69+
</p>
70+
</details>

.github/workflows/ci.yml

+64-33
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# This file defines our primary CI workflow that runs on pull requests
22
# and also on pushes to special branches (auto, try).
33
#
4-
# The actual definition of the executed jobs is calculated by a Python
5-
# script located at src/ci/github-actions/calculate-job-matrix.py, which
4+
# The actual definition of the executed jobs is calculated by the
5+
# `src/ci/citool` crate, which
66
# uses job definition data from src/ci/github-actions/jobs.yml.
77
# You should primarily modify the `jobs.yml` file if you want to modify
88
# what jobs are executed in CI.
@@ -56,46 +56,32 @@ jobs:
5656
- name: Calculate the CI job matrix
5757
env:
5858
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
59-
run: python3 src/ci/github-actions/calculate-job-matrix.py >> $GITHUB_OUTPUT
59+
run: |
60+
cd src/ci/citool
61+
CARGO_INCREMENTAL=0 cargo test
62+
CARGO_INCREMENTAL=0 cargo run calculate-job-matrix >> $GITHUB_OUTPUT
6063
id: jobs
6164
job:
62-
name: ${{ matrix.name }}
65+
name: ${{ matrix.full_name }}
6366
needs: [ calculate_matrix ]
6467
runs-on: "${{ matrix.os }}"
65-
defaults:
66-
run:
67-
shell: ${{ contains(matrix.os, 'windows') && 'msys2 {0}' || 'bash' }}
6868
timeout-minutes: 360
6969
env:
70-
CI_JOB_NAME: ${{ matrix.image }}
70+
CI_JOB_NAME: ${{ matrix.name }}
71+
CI_JOB_DOC_URL: ${{ matrix.doc_url }}
7172
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
7273
# commit of PR sha or commit sha. `GITHUB_SHA` is not accurate for PRs.
7374
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
7475
DOCKER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7576
SCCACHE_BUCKET: rust-lang-ci-sccache2
77+
SCCACHE_REGION: us-west-1
7678
CACHE_DOMAIN: ci-caches.rust-lang.org
7779
continue-on-error: ${{ matrix.continue_on_error || false }}
7880
strategy:
7981
matrix:
8082
# Check the `calculate_matrix` job to see how is the matrix defined.
8183
include: ${{ fromJSON(needs.calculate_matrix.outputs.jobs) }}
8284
steps:
83-
- if: contains(matrix.os, 'windows')
84-
uses: msys2/[email protected]
85-
with:
86-
# i686 jobs use mingw32. x86_64 and cross-compile jobs use mingw64.
87-
msystem: ${{ contains(matrix.name, 'i686') && 'mingw32' || 'mingw64' }}
88-
# don't try to download updates for already installed packages
89-
update: false
90-
# don't try to use the msys that comes built-in to the github runner,
91-
# so we can control what is installed (i.e. not python)
92-
release: true
93-
# Inherit the full path from the Windows environment, with MSYS2's */bin/
94-
# dirs placed in front. This lets us run Windows-native Python etc.
95-
path-type: inherit
96-
install: >
97-
make
98-
9985
- name: disable git crlf conversion
10086
run: git config --global core.autocrlf false
10187

@@ -109,7 +95,7 @@ jobs:
10995
# intensive jobs to run on free runners, which however also have
11096
# less disk space.
11197
- name: free up disk space
112-
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
98+
run: src/ci/scripts/free-disk-space.sh
11399
if: matrix.free_disk
114100

115101
# Rust Log Analyzer can't currently detect the PR number of a GitHub
@@ -192,9 +178,33 @@ jobs:
192178
- name: ensure the stable version number is correct
193179
run: src/ci/scripts/verify-stable-version-number.sh
194180

181+
# Show the environment just before we run the build
182+
# This makes it easier to diagnose problems with the above install scripts.
183+
- name: show the current environment
184+
run: src/ci/scripts/dump-environment.sh
185+
186+
# Pre-build citool before the following step uninstalls rustup
187+
# Build it into the build directory, to avoid modifying sources
188+
- name: build citool
189+
run: |
190+
cd src/ci/citool
191+
CARGO_INCREMENTAL=0 CARGO_TARGET_DIR=../../../build/citool cargo build
192+
195193
- name: run the build
196-
# Redirect stderr to stdout to avoid reordering the two streams in the GHA logs.
197-
run: src/ci/scripts/run-build-from-ci.sh 2>&1
194+
run: |
195+
set +e
196+
# Redirect stderr to stdout to avoid reordering the two streams in the GHA logs.
197+
src/ci/scripts/run-build-from-ci.sh 2>&1
198+
STATUS=$?
199+
set -e
200+
201+
if [[ "$STATUS" -ne 0 && -n "$CI_JOB_DOC_URL" ]]; then
202+
echo "****************************************************************************"
203+
echo "To find more information about this job, visit the following URL:"
204+
echo "$CI_JOB_DOC_URL"
205+
echo "****************************************************************************"
206+
fi
207+
exit ${STATUS}
198208
env:
199209
AWS_ACCESS_KEY_ID: ${{ env.CACHES_AWS_ACCESS_KEY_ID }}
200210
AWS_SECRET_ACCESS_KEY: ${{ secrets[format('AWS_SECRET_ACCESS_KEY_{0}', env.CACHES_AWS_ACCESS_KEY_ID)] }}
@@ -228,16 +238,37 @@ jobs:
228238
# erroring about invalid credentials instead.
229239
if: github.event_name == 'push' || env.DEPLOY == '1' || env.DEPLOY_ALT == '1'
230240

241+
- name: postprocess metrics into the summary
242+
# This step is not critical, and if some I/O problem happens, we don't want
243+
# to cancel the build.
244+
continue-on-error: true
245+
run: |
246+
if [ -f build/metrics.json ]; then
247+
METRICS=build/metrics.json
248+
elif [ -f obj/build/metrics.json ]; then
249+
METRICS=obj/build/metrics.json
250+
else
251+
echo "No metrics.json found"
252+
exit 0
253+
fi
254+
255+
# Get closest bors merge commit
256+
PARENT_COMMIT=`git rev-list --author='bors <[email protected]>' -n1 --first-parent HEAD^1`
257+
258+
./build/citool/debug/citool postprocess-metrics \
259+
--job-name ${CI_JOB_NAME} \
260+
--parent ${PARENT_COMMIT} \
261+
${METRICS} >> ${GITHUB_STEP_SUMMARY}
262+
231263
- name: upload job metrics to DataDog
264+
# This step is not critical, and if some I/O problem happens, we don't want
265+
# to cancel the build.
266+
continue-on-error: true
232267
if: needs.calculate_matrix.outputs.run_type != 'pr'
233268
env:
234-
DATADOG_SITE: datadoghq.com
235269
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
236-
DD_GITHUB_JOB_NAME: ${{ matrix.name }}
237-
run: |
238-
cd src/ci
239-
npm ci
240-
python3 scripts/upload-build-metrics.py ../../build/cpu-usage.csv
270+
DD_GITHUB_JOB_NAME: ${{ matrix.full_name }}
271+
run: ./build/citool/debug/citool upload-build-metrics build/cpu-usage.csv
241272

242273
# This job isused to tell bors the final status of the build, as there is no practical way to detect
243274
# when a workflow is successful listening to webhooks only in our current bors implementation (homu).

.github/workflows/ghcr.yml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Mirror DockerHub images used by the Rust project to ghcr.io.
2+
# Images are available at https://github.com/orgs/rust-lang/packages.
3+
#
4+
# In some CI jobs, we pull images from ghcr.io instead of Docker Hub because
5+
# Docker Hub has a rate limit, while ghcr.io doesn't.
6+
# Those images are pushed to ghcr.io by this job.
7+
#
8+
# While Docker Hub rate limit *shouldn't* be an issue on GitHub Actions,
9+
# it certainly is for AWS codebuild.
10+
#
11+
# Note that authenticating to DockerHub or other registries isn't possible
12+
# for PR jobs, because forks can't access secrets.
13+
# That's why we use ghcr.io: it has no rate limit and it doesn't require authentication.
14+
15+
name: GHCR image mirroring
16+
17+
on:
18+
workflow_dispatch:
19+
schedule:
20+
# Run daily at midnight UTC
21+
- cron: '0 0 * * *'
22+
23+
jobs:
24+
mirror:
25+
name: DockerHub mirror
26+
runs-on: ubuntu-24.04
27+
if: github.repository == 'rust-lang/rust'
28+
permissions:
29+
# Needed to write to the ghcr.io registry
30+
packages: write
31+
steps:
32+
- uses: actions/checkout@v4
33+
with:
34+
persist-credentials: false
35+
36+
- name: Log in to registry
37+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
38+
39+
# Download crane in the current directory.
40+
# We use crane because it copies the docker image for all the architectures available in
41+
# DockerHub for the image.
42+
# Learn more about crane at
43+
# https://github.com/google/go-containerregistry/blob/main/cmd/crane/README.md
44+
- name: Download crane
45+
run: |
46+
curl -sL "https://github.com/google/go-containerregistry/releases/download/${VERSION}/go-containerregistry_${OS}_${ARCH}.tar.gz" | tar -xzf -
47+
env:
48+
VERSION: v0.20.2
49+
OS: Linux
50+
ARCH: x86_64
51+
52+
- name: Mirror DockerHub
53+
run: |
54+
# List of DockerHub images to mirror to ghcr.io
55+
images=(
56+
# Mirrored because used by the mingw-check-tidy, which doesn't cache Docker images
57+
"ubuntu:22.04"
58+
# Mirrored because used by all linux CI jobs, including mingw-check-tidy
59+
"moby/buildkit:buildx-stable-1"
60+
# Mirrored because used when CI is running inside a Docker container
61+
"alpine:3.4"
62+
# Mirrored because used by dist-x86_64-linux
63+
"centos:7"
64+
)
65+
66+
# Mirror each image from DockerHub to ghcr.io
67+
for img in "${images[@]}"; do
68+
echo "Mirroring ${img}..."
69+
# Remove namespace from the image if any.
70+
# E.g. "moby/buildkit:buildx-stable-1" becomes "buildkit:buildx-stable-1"
71+
dest_image=$(echo "${img}" | cut -d'/' -f2-)
72+
./crane copy \
73+
"docker.io/${img}" \
74+
"ghcr.io/${{ github.repository_owner }}/${dest_image}"
75+
done

.github/workflows/post-merge.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Workflow that runs after a merge to master, analyses changes in test executions
2+
# and posts the result to the merged PR.
3+
4+
name: Post merge analysis
5+
6+
on:
7+
push:
8+
branches:
9+
- master
10+
11+
jobs:
12+
analysis:
13+
runs-on: ubuntu-24.04
14+
if: github.repository == 'rust-lang/rust'
15+
permissions:
16+
pull-requests: write
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
# Make sure that we have enough commits to find the parent merge commit.
21+
# Since all merges should be through merge commits, fetching two commits
22+
# should be enough to get the parent bors merge commit.
23+
fetch-depth: 2
24+
- name: Perform analysis and send PR
25+
env:
26+
GH_TOKEN: ${{ github.token }}
27+
run: |
28+
# Get closest bors merge commit
29+
PARENT_COMMIT=`git rev-list --author='bors <[email protected]>' -n1 --first-parent HEAD^1`
30+
echo "Parent: ${PARENT_COMMIT}"
31+
32+
# Find PR for the current commit
33+
HEAD_PR=`gh pr list --search "${{ github.sha }}" --state merged --json number --jq '.[0].number'`
34+
echo "HEAD: ${{ github.sha }} (#${HEAD_PR})"
35+
36+
cd src/ci/citool
37+
38+
printf "<details>\n<summary>What is this?</summary>\n" >> output.log
39+
printf "This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.\n" >> output.log
40+
printf "</details>\n\n" >> output.log
41+
42+
cargo run --release post-merge-report ${PARENT_COMMIT} ${{ github.sha }} >> output.log
43+
44+
cat output.log
45+
46+
gh pr comment ${HEAD_PR} -F output.log

.gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file should only ignore things that are generated during a `x.py` build,
22
# generated by common IDEs, and optional files controlled by the user that
3-
# affect the build (such as config.toml).
3+
# affect the build (such as bootstrap.toml).
44
# In particular, things like `mir_dump` should not be listed here; they are only
55
# created during manual debugging and many people like to clean up instead of
66
# having git ignore such leftovers. You can use `.git/info/exclude` to
@@ -34,6 +34,7 @@ Session.vim
3434
!/tests/run-make/thumb-none-qemu/example/.cargo
3535

3636
## Configuration
37+
/bootstrap.toml
3738
/config.toml
3839
/Makefile
3940
config.mk
@@ -53,7 +54,10 @@ no_llvm_build
5354
/target
5455
/library/target
5556
/src/bootstrap/target
57+
/src/ci/citool/target
5658
/src/tools/x/target
59+
# Created by `x vendor`
60+
/vendor
5761
# Created by default with `src/ci/docker/run.sh`
5862
/obj/
5963
# Created by nix dev shell / .envrc
@@ -83,6 +87,7 @@ __pycache__/
8387
node_modules
8488
package-lock.json
8589
package.json
90+
/src/doc/rustc-dev-guide/mermaid.min.js
8691

8792
## Rustdoc GUI tests
8893
tests/rustdoc-gui/src/**.lock

0 commit comments

Comments
 (0)