Skip to content

Commit 305778c

Browse files
Rollup merge of #153726 - Kobzol:parallel-frontend-tests-optional, r=jieyouxu
Add optional CI job to build the compiler with the parallel frontend Discussed on [Zulip](https://rust-lang.zulipchat.com/#narrow/channel/187679-t-compiler.2Fparallel-rustc/topic/Add.20the.20parallel.20front-end.20test.20suite/with/578684794). Note: this only builds the compiler, stdlib, etc. with 2 threads. UI tests are still compiled serially. I'd add that in a follow-up PR if we see that this new job works well (and if optional auto jobs work well in the first place). r? @jieyouxu
2 parents d1ee5e5 + b3333b3 commit 305778c

File tree

4 files changed

+53
-4
lines changed

4 files changed

+53
-4
lines changed

src/ci/citool/src/jobs.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,14 @@ fn validate_job_database(db: &JobDatabase) -> anyhow::Result<()> {
200200
equivalent_modulo_carve_out(pr_job, auto_job)?;
201201
}
202202

203-
// Auto CI jobs must all "fail-fast" to avoid wasting Auto CI resources. For instance, `tidy`.
203+
// Auto CI should "fail-fast" to avoid wasting Auto CI resources.
204+
// However, some experimental auto jobs can be made optional, for example if we are unsure about
205+
// their flakiness. Those have to be prefixed with `optional-`.
204206
for auto_job in &db.auto_jobs {
205-
if auto_job.continue_on_error == Some(true) {
207+
if auto_job.continue_on_error == Some(true) && !auto_job.name.starts_with("optional-") {
206208
return Err(anyhow!(
207-
"Auto job `{}` cannot have `continue_on_error: true`",
208-
auto_job.name
209+
"Auto job `{job}` cannot have `continue_on_error: true`. If the job should be optional, name it `optional-{job}`.",
210+
job = auto_job.name
209211
));
210212
}
211213
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM ubuntu:22.04
2+
3+
ARG DEBIAN_FRONTEND=noninteractive
4+
RUN apt-get update && apt-get install -y --no-install-recommends \
5+
g++ \
6+
make \
7+
ninja-build \
8+
file \
9+
curl \
10+
ca-certificates \
11+
python3 \
12+
git \
13+
cmake \
14+
sudo \
15+
gdb \
16+
libssl-dev \
17+
pkg-config \
18+
xz-utils \
19+
mingw-w64 \
20+
zlib1g-dev \
21+
libzstd-dev \
22+
&& rm -rf /var/lib/apt/lists/*
23+
24+
COPY scripts/sccache.sh /scripts/
25+
RUN sh /scripts/sccache.sh
26+
27+
ENV RUST_CONFIGURE_ARGS \
28+
--build=x86_64-unknown-linux-gnu \
29+
--enable-sanitizers \
30+
--enable-profiler \
31+
--enable-compiler-docs \
32+
--set llvm.libzstd=true
33+
34+
# Build the toolchain with multiple parallel frontend threads and then run tests
35+
# Tests are still compiled serially at the moment (intended to be changed in follow-ups).
36+
ENV SCRIPT python3 ../x.py --stage 2 test --set rust.parallel-frontend-threads=4

src/ci/github-actions/jobs.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,11 @@ auto:
348348
- name: x86_64-gnu
349349
<<: *job-linux-4c
350350

351+
- name: optional-x86_64-gnu-parallel-frontend
352+
# This test can be flaky, so do not cancel CI if it fails, for now.
353+
continue_on_error: true
354+
<<: *job-linux-4c
355+
351356
- name: x86_64-gnu-gcc
352357
doc_url: https://rustc-dev-guide.rust-lang.org/tests/codegen-backend-tests/cg_gcc.html
353358
<<: *job-linux-4c

src/doc/rustc-dev-guide/src/tests/ci.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ The live results can be seen on [the GitHub Actions workflows page].
109109
At any given time, at most a single `auto` build is being executed.
110110
Find out more in [Merging PRs serially with bors](#merging-prs-serially-with-bors).
111111

112+
Normally, when an auto job fails, the whole CI workflow immediately ends. However, it can be useful to
113+
create auto jobs that are "non-blocking", or optional, to test them on CI for some time before blocking
114+
merges on them. This can be useful if those jobs can be flaky.
115+
116+
To do that, prefix such a job with `optional-`, and set `continue_on_error: true` for it in [`jobs.yml`].
117+
112118
[platform tiers]: https://forge.rust-lang.org/release/platform-support.html#rust-platform-support
113119
[auto]: https://github.com/rust-lang/rust/tree/automation/bors/auto
114120

0 commit comments

Comments
 (0)