Skip to content

Commit ea36c0c

Browse files
committed
CI: use free runners for i686-gnu jobs
1 parent 0c4f3a4 commit ea36c0c

File tree

4 files changed

+85
-19
lines changed

4 files changed

+85
-19
lines changed

src/ci/docker/host-x86_64/i686-gnu-nopt/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,8 @@ RUN echo "[rust]" > /config/nopt-std-config.toml
2727
RUN echo "optimize = false" >> /config/nopt-std-config.toml
2828

2929
ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu --disable-optimize-tests
30-
ENV SCRIPT python3 ../x.py test --stage 0 --config /config/nopt-std-config.toml library/std \
30+
ARG SCRIPT_ARG
31+
ENV DEFAULT_SCRIPT python3 ../x.py test --stage 0 --config /config/nopt-std-config.toml library/std \
3132
&& python3 ../x.py --stage 2 test
33+
# Set SCRIPT to SCRIPT_ARG if defined, otherwise set SCRIPT to DEFAULT_SCRIPT
34+
ENV SCRIPT=${SCRIPT_ARG:-$DEFAULT_SCRIPT}

src/ci/docker/host-x86_64/i686-gnu/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ COPY scripts/sccache.sh /scripts/
2424
RUN sh /scripts/sccache.sh
2525

2626
ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu
27+
ARG SCRIPT_ARG
2728
# Skip some tests that are unlikely to be platform specific, to speed up
2829
# this slow job.
29-
ENV SCRIPT python3 ../x.py --stage 2 test \
30+
ENV DEFAULT_SCRIPT python3 ../x.py --stage 2 test \
3031
--skip src/bootstrap \
3132
--skip tests/rustdoc-js \
3233
--skip src/tools/error_index_generator \
3334
--skip src/tools/linkchecker
35+
# Set SCRIPT to SCRIPT_ARG if defined, otherwise set SCRIPT to DEFAULT_SCRIPT
36+
ENV SCRIPT=${SCRIPT_ARG:-$DEFAULT_SCRIPT}

src/ci/docker/run.sh

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,23 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
105105
# It seems that it cannot be the same as $IMAGE_TAG, otherwise it overwrites the cache
106106
CACHE_IMAGE_TAG=${REGISTRY}/${REGISTRY_USERNAME}/rust-ci-cache:${cksum}
107107

108+
# Docker build arguments.
109+
build_args=(
110+
"build"
111+
"--rm"
112+
"-t" "rust-ci"
113+
"-f" "$dockerfile"
114+
"$context"
115+
)
116+
117+
# If the environment variable SCRIPT is defined,
118+
# set the build argument SCRIPT_ARG to SCRIPT.
119+
# In this way, we run the SCRIPT defined in CI,
120+
# instead of the one defined in the Dockerfile.
121+
if [ -n "${SCRIPT+x}" ]; then
122+
build_args+=("--build-arg" "SCRIPT_ARG=${SCRIPT}")
123+
fi
124+
108125
# On non-CI jobs, we try to download a pre-built image from the rust-lang-ci
109126
# ghcr.io registry. If it is not possible, we fall back to building the image
110127
# locally.
@@ -115,7 +132,7 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
115132
docker tag "${IMAGE_TAG}" rust-ci
116133
else
117134
echo "Building local Docker image"
118-
retry docker build --rm -t rust-ci -f "$dockerfile" "$context"
135+
retry docker "${build_args[@]}"
119136
fi
120137
# On PR CI jobs, we don't have permissions to write to the registry cache,
121138
# but we can still read from it.
@@ -127,13 +144,9 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
127144
# Build the image using registry caching backend
128145
retry docker \
129146
buildx \
130-
build \
131-
--rm \
132-
-t rust-ci \
133-
-f "$dockerfile" \
147+
"${build_args[@]}" \
134148
--cache-from type=registry,ref=${CACHE_IMAGE_TAG} \
135-
--output=type=docker \
136-
"$context"
149+
--output=type=docker
137150
# On auto/try builds, we can also write to the cache.
138151
else
139152
# Log into the Docker registry, so that we can read/write cache and the final image
@@ -147,14 +160,10 @@ if [ -f "$docker_dir/$image/Dockerfile" ]; then
147160
# Build the image using registry caching backend
148161
retry docker \
149162
buildx \
150-
build \
151-
--rm \
152-
-t rust-ci \
153-
-f "$dockerfile" \
163+
"${build_args[@]}" \
154164
--cache-from type=registry,ref=${CACHE_IMAGE_TAG} \
155165
--cache-to type=registry,ref=${CACHE_IMAGE_TAG},compression=zstd \
156-
--output=type=docker \
157-
"$context"
166+
--output=type=docker
158167

159168
# Print images for debugging purposes
160169
docker images

src/ci/github-actions/jobs.yml

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,62 @@ auto:
212212
- image: dist-x86_64-netbsd
213213
<<: *job-linux-4c
214214

215-
- image: i686-gnu
216-
<<: *job-linux-8c
215+
# The i686-gnu job is split into multiple jobs to run tests in parallel.
216+
#
217+
# The `src/*` and `tests/*` tests are skipped to speed up this slow job.
218+
# These tests can be skipped because they are unlikely to be platform specific.
219+
#
220+
# The other tests are skipped because they run in i686-gnu-2.
221+
- image: i686-gnu-1
222+
env:
223+
IMAGE: i686-gnu
224+
SCRIPT: >-
225+
python3 ../x.py --stage 2 test
226+
--skip compiler
227+
--skip src
228+
--skip tests/rustdoc-js
229+
<<: *job-linux-4c
217230

218-
- image: i686-gnu-nopt
219-
<<: *job-linux-8c
231+
# Skip tests that run in i686-gnu-1
232+
- image: i686-gnu-2
233+
env:
234+
IMAGE: i686-gnu
235+
SCRIPT: >-
236+
python3 ../x.py --stage 2 test
237+
--skip tests
238+
--skip coverage-map
239+
--skip coverage-run
240+
--skip library
241+
--skip tidyselftest
242+
--skip src/bootstrap
243+
--skip src/tools/error_index_generator
244+
--skip src/tools/linkchecker
245+
<<: *job-linux-4c
246+
247+
# The i686-gnu-nopt job is split into multiple jobs to run tests in parallel.
248+
# i686-gnu-nopt-1 skips tests that run in i686-gnu-nopt-2
249+
- image: i686-gnu-nopt-1
250+
env:
251+
IMAGE: i686-gnu-nopt
252+
SCRIPT: >-
253+
python3 ../x.py --stage 2 test
254+
--skip compiler
255+
--skip src
256+
<<: *job-linux-4c
257+
258+
# Skip tests that run in i686-gnu-nopt-1
259+
- image: i686-gnu-nopt-2
260+
env:
261+
IMAGE: i686-gnu-nopt
262+
SCRIPT: >-
263+
python3 ../x.py test --stage 0 --config /config/nopt-std-config.toml library/std &&
264+
python3 ../x.py --stage 2 test
265+
--skip tests
266+
--skip coverage-map
267+
--skip coverage-run
268+
--skip library
269+
--skip tidyselftest
270+
<<: *job-linux-4c
220271

221272
- image: mingw-check
222273
<<: *job-linux-4c

0 commit comments

Comments
 (0)