Add new CI job that runs tests with a toolchain built with multiple threads
diff --git a/src/ci/docker/host-x86_64/optional-x86_64-gnu-parallel-frontend/Dockerfile b/src/ci/docker/host-x86_64/optional-x86_64-gnu-parallel-frontend/Dockerfile
new file mode 100644
index 0000000..8f7c7eb
--- /dev/null
+++ b/src/ci/docker/host-x86_64/optional-x86_64-gnu-parallel-frontend/Dockerfile
@@ -0,0 +1,36 @@
+FROM ubuntu:22.04
+
+ARG DEBIAN_FRONTEND=noninteractive
+RUN apt-get update && apt-get install -y --no-install-recommends \
+  g++ \
+  make \
+  ninja-build \
+  file \
+  curl \
+  ca-certificates \
+  python3 \
+  git \
+  cmake \
+  sudo \
+  gdb \
+  libssl-dev \
+  pkg-config \
+  xz-utils \
+  mingw-w64 \
+  zlib1g-dev \
+  libzstd-dev \
+  && rm -rf /var/lib/apt/lists/*
+
+COPY scripts/sccache.sh /scripts/
+RUN sh /scripts/sccache.sh
+
+ENV RUST_CONFIGURE_ARGS \
+ --build=x86_64-unknown-linux-gnu \
+ --enable-sanitizers \
+ --enable-profiler \
+ --enable-compiler-docs \
+ --set llvm.libzstd=true
+
+# Build the toolchain with multiple parallel frontend threads and then run tests
+# Tests are still compiled serially at the moment (intended to be changed in follow-ups).
+ENV SCRIPT python3 ../x.py --stage 2 test --set rust.parallel-frontend-threads=4
diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml
index 0687d14..563083c 100644
--- a/src/ci/github-actions/jobs.yml
+++ b/src/ci/github-actions/jobs.yml
@@ -348,6 +348,11 @@
   - name: x86_64-gnu
     <<: *job-linux-4c
 
+  - name: optional-x86_64-gnu-parallel-frontend
+    # This test can be flaky, so do not cancel CI if it fails, for now.
+    continue_on_error: true
+    <<: *job-linux-4c
+
   - name: x86_64-gnu-gcc
     doc_url: https://rustc-dev-guide.rust-lang.org/tests/codegen-backend-tests/cg_gcc.html
     <<: *job-linux-4c