Skip to content

Commit 3b8d6be

Browse files
committed
Make CI configuration more similar to libm
Apply a handful of changes to reduce the diff between the two: * Cancel running jobs on new pushes * Enable log color and backtraces * Add timeouts * Specify CI runner versions * Add an armv7 job * Replace the name NO_STD with BUILD_ONLY * Set AR_ and CC_ environments in docker * Install requirements to build MPFR
1 parent 38bbfbf commit 3b8d6be

File tree

23 files changed

+159
-118
lines changed

23 files changed

+159
-118
lines changed

.github/workflows/main.yml

Lines changed: 78 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,106 @@
11
name: CI
2-
on: [push, pull_request]
2+
on:
3+
push: { branches: [master] }
4+
pull_request:
5+
6+
concurrency:
7+
# Make sure that new pushes cancel running jobs
8+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
9+
cancel-in-progress: true
310

411
env:
12+
CARGO_TERM_COLOR: always
513
RUSTDOCFLAGS: -Dwarnings
614
RUSTFLAGS: -Dwarnings
15+
RUST_BACKTRACE: full
716

817
jobs:
918
test:
10-
name: Test
11-
runs-on: ${{ matrix.os }}
19+
name: Build and test
20+
timeout-minutes: 60
1221
strategy:
1322
fail-fast: false
1423
matrix:
1524
include:
1625
- target: aarch64-apple-darwin
1726
os: macos-latest
18-
rust: nightly
1927
- target: aarch64-unknown-linux-gnu
20-
os: ubuntu-latest
21-
rust: nightly
28+
os: ubuntu-24.04-arm
2229
- target: aarch64-pc-windows-msvc
23-
os: windows-latest
24-
rust: nightly
30+
os: windows-2025
2531
test_verbatim: 1
26-
no_std: 1
32+
build_only: 1
2733
- target: arm-unknown-linux-gnueabi
28-
os: ubuntu-latest
29-
rust: nightly
34+
os: ubuntu-24.04
3035
- target: arm-unknown-linux-gnueabihf
31-
os: ubuntu-latest
32-
rust: nightly
36+
os: ubuntu-24.04
37+
- target: armv7-unknown-linux-gnueabihf
38+
os: ubuntu-24.04
3339
- target: i586-unknown-linux-gnu
34-
os: ubuntu-latest
35-
rust: nightly
40+
os: ubuntu-24.04
3641
- target: i686-unknown-linux-gnu
37-
os: ubuntu-latest
38-
rust: nightly
42+
os: ubuntu-24.04
3943
- target: loongarch64-unknown-linux-gnu
40-
os: ubuntu-latest
41-
rust: nightly
42-
# MIPS targets disabled since they are dropped to tier 3.
43-
# See https://github.com/rust-lang/compiler-team/issues/648
44-
#- target: mips-unknown-linux-gnu
45-
# os: ubuntu-latest
46-
# rust: nightly
47-
#- target: mips64-unknown-linux-gnuabi64
48-
# os: ubuntu-latest
49-
# rust: nightly
50-
#- target: mips64el-unknown-linux-gnuabi64
51-
# os: ubuntu-latest
52-
# rust: nightly
53-
#- target: mipsel-unknown-linux-gnu
54-
# os: ubuntu-latest
55-
# rust: nightly
44+
os: ubuntu-24.04
5645
- target: powerpc-unknown-linux-gnu
57-
os: ubuntu-latest
58-
rust: nightly
46+
os: ubuntu-24.04
5947
- target: powerpc64-unknown-linux-gnu
60-
os: ubuntu-latest
61-
rust: nightly
48+
os: ubuntu-24.04
6249
- target: powerpc64le-unknown-linux-gnu
63-
os: ubuntu-latest
64-
rust: nightly
50+
os: ubuntu-24.04
6551
- target: riscv64gc-unknown-linux-gnu
66-
os: ubuntu-latest
67-
rust: nightly
52+
os: ubuntu-24.04
6853
- target: thumbv6m-none-eabi
69-
os: ubuntu-latest
70-
rust: nightly
54+
os: ubuntu-24.04
7155
- target: thumbv7em-none-eabi
72-
os: ubuntu-latest
73-
rust: nightly
56+
os: ubuntu-24.04
7457
- target: thumbv7em-none-eabihf
75-
os: ubuntu-latest
76-
rust: nightly
58+
os: ubuntu-24.04
7759
- target: thumbv7m-none-eabi
78-
os: ubuntu-latest
79-
rust: nightly
60+
os: ubuntu-24.04
8061
- target: wasm32-unknown-unknown
81-
os: ubuntu-latest
82-
rust: nightly
62+
os: ubuntu-24.04
8363
- target: x86_64-unknown-linux-gnu
84-
os: ubuntu-latest
85-
rust: nightly
64+
os: ubuntu-24.04
8665
- target: x86_64-apple-darwin
8766
os: macos-13
88-
rust: nightly
8967
- target: i686-pc-windows-msvc
90-
os: windows-latest
91-
rust: nightly
68+
os: windows-2025
9269
test_verbatim: 1
9370
- target: x86_64-pc-windows-msvc
94-
os: windows-latest
95-
rust: nightly
71+
os: windows-2025
9672
test_verbatim: 1
9773
- target: i686-pc-windows-gnu
98-
os: windows-latest
99-
rust: nightly-i686-gnu
74+
os: windows-2025
10075
- target: x86_64-pc-windows-gnu
101-
os: windows-latest
102-
rust: nightly-x86_64-gnu
76+
os: windows-2025
77+
channel: nightly-x86_64-gnu
78+
runs-on: ${{ matrix.os }}
79+
env:
80+
BUILD_ONLY: ${{ matrix.build_only }}
81+
TEST_VERBATIM: ${{ matrix.test_verbatim }}
10382
steps:
10483
- name: Print runner information
10584
run: uname -a
10685
- uses: actions/checkout@v4
10786
with:
10887
submodules: true
10988
- name: Install Rust (rustup)
110-
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
11189
shell: bash
112-
- run: rustup target add ${{ matrix.target }}
113-
- run: rustup component add llvm-tools-preview
90+
run: |
91+
channel="nightly"
92+
# Account for channels that have required components (MinGW)
93+
[ -n "${{ matrix.channel }}" ] && channel="${{ matrix.channel }}"
94+
rustup update "$channel" --no-self-update
95+
rustup default "$channel"
96+
rustup target add "${{ matrix.target }}"
97+
rustup component add llvm-tools-preview
11498
- uses: Swatinem/rust-cache@v2
11599
with:
116100
key: ${{ matrix.target }}
117101
- name: Cache Docker layers
118102
uses: actions/cache@v4
119-
if: matrix.os == 'ubuntu-latest'
103+
if: matrix.os == 'ubuntu-24.04'
120104
with:
121105
path: /tmp/.buildx-cache
122106
key: ${{ matrix.target }}-buildx-${{ github.sha }}
@@ -136,33 +120,49 @@ jobs:
136120
shell: bash
137121

138122
# Non-linux tests just use our raw script
139-
- run: ./ci/run.sh ${{ matrix.target }}
140-
if: matrix.os != 'ubuntu-latest'
123+
- name: Run locally
124+
if: matrix.os != 'ubuntu-24.04'
141125
shell: bash
142-
env:
143-
NO_STD: ${{ matrix.no_std }}
144-
TEST_VERBATIM: ${{ matrix.test_verbatim }}
126+
run: ./ci/run.sh ${{ matrix.target }}
145127

146128
# Configure buildx to use Docker layer caching
147129
- uses: docker/setup-buildx-action@v3
148-
if: matrix.os == 'ubuntu-latest'
130+
if: matrix.os == 'ubuntu-24.04'
149131

150132
# Otherwise we use our docker containers to run builds
151-
- run: cargo generate-lockfile && ./ci/run-docker.sh ${{ matrix.target }}
152-
if: matrix.os == 'ubuntu-latest'
133+
- name: Run in Docker
134+
if: matrix.os == 'ubuntu-24.04'
135+
run: cargo generate-lockfile && ./ci/run-docker.sh ${{ matrix.target }}
153136

154137
# Workaround to keep Docker cache smaller
155138
# https://github.com/docker/build-push-action/issues/252
156139
# https://github.com/moby/buildkit/issues/1896
157140
- name: Move Docker cache
158-
if: matrix.os == 'ubuntu-latest'
141+
if: matrix.os == 'ubuntu-24.04'
159142
run: |
160143
rm -rf /tmp/.buildx-cache
161144
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
162145
146+
clippy:
147+
name: Clippy
148+
runs-on: ubuntu-24.04
149+
timeout-minutes: 10
150+
steps:
151+
- uses: actions/checkout@v4
152+
with:
153+
submodules: true
154+
# Unlike rustfmt, stable clippy does not work on code with nightly features.
155+
- name: Install nightly `clippy`
156+
run: |
157+
rustup set profile minimal
158+
rustup default nightly
159+
rustup component add clippy
160+
- uses: Swatinem/rust-cache@v2
161+
- run: cargo clippy -- -D clippy::all
162+
163163
miri:
164164
name: Miri
165-
runs-on: ubuntu-latest
165+
runs-on: ubuntu-24.04
166166
steps:
167167
- uses: actions/checkout@v4
168168
with:
@@ -177,7 +177,7 @@ jobs:
177177

178178
rustfmt:
179179
name: Rustfmt
180-
runs-on: ubuntu-latest
180+
runs-on: ubuntu-24.04
181181
steps:
182182
- uses: actions/checkout@v4
183183
with:
@@ -186,27 +186,13 @@ jobs:
186186
run: rustup set profile minimal && rustup default stable && rustup component add rustfmt
187187
- run: cargo fmt -- --check
188188

189-
clippy:
190-
name: Clippy
191-
runs-on: ubuntu-latest
192-
steps:
193-
- uses: actions/checkout@v4
194-
with:
195-
submodules: true
196-
# Unlike rustfmt, stable clippy does not work on code with nightly features.
197-
- name: Install nightly `clippy`
198-
run: |
199-
rustup set profile minimal && rustup default nightly && rustup component add clippy
200-
- uses: Swatinem/rust-cache@v2
201-
- run: cargo clippy -- -D clippy::all
202-
203189
success:
204190
needs:
205191
- test
206192
- rustfmt
207193
- clippy
208194
- miri
209-
runs-on: ubuntu-latest
195+
runs-on: ubuntu-24.04
210196
# GitHub branch protection is exceedingly silly and treats "jobs skipped because a dependency
211197
# failed" as success. So we have to do some contortions to ensure the job fails if any of its
212198
# dependencies fails.
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
ARG IMAGE=ubuntu:24.04
22
FROM $IMAGE
3+
34
RUN apt-get update && \
45
apt-get install -y --no-install-recommends \
56
gcc libc6-dev ca-certificates \
6-
gcc-aarch64-linux-gnu libc6-dev-arm64-cross \
7+
gcc-aarch64-linux-gnu m4 make libc6-dev-arm64-cross \
78
qemu-user-static
8-
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
9+
10+
ENV TOOLCHAIN_PREFIX=aarch64-linux-gnu-
11+
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER="$TOOLCHAIN_PREFIX"gcc \
912
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER=qemu-aarch64-static \
13+
AR_aarch64_unknown_linux_gnu="$TOOLCHAIN_PREFIX"ar \
14+
CC_aarch64_unknown_linux_gnu="$TOOLCHAIN_PREFIX"gcc \
1015
QEMU_LD_PREFIX=/usr/aarch64-linux-gnu \
1116
RUST_TEST_THREADS=1
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
ARG IMAGE=ubuntu:24.04
22
FROM $IMAGE
3+
34
RUN apt-get update && \
45
apt-get install -y --no-install-recommends \
56
gcc libc6-dev ca-certificates \
67
gcc-arm-linux-gnueabi libc6-dev-armel-cross qemu-user-static
7-
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_LINKER=arm-linux-gnueabi-gcc \
8+
9+
ENV TOOLCHAIN_PREFIX=arm-linux-gnueabi-
10+
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_LINKER="$TOOLCHAIN_PREFIX"gcc \
811
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABI_RUNNER=qemu-arm-static \
12+
AR_arm_unknown_linux_gnueabi="$TOOLCHAIN_PREFIX"ar \
13+
CC_arm_unknown_linux_gnueabi="$TOOLCHAIN_PREFIX"gcc \
914
QEMU_LD_PREFIX=/usr/arm-linux-gnueabi \
1015
RUST_TEST_THREADS=1
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
ARG IMAGE=ubuntu:24.04
22
FROM $IMAGE
3+
34
RUN apt-get update && \
45
apt-get install -y --no-install-recommends \
56
gcc libc6-dev ca-certificates \
67
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user-static
7-
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
8+
9+
ENV TOOLCHAIN_PREFIX=arm-linux-gnueabihf-
10+
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER="$TOOLCHAIN_PREFIX"gcc \
811
CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER=qemu-arm-static \
12+
AR_arm_unknown_linux_gnueabihf="$TOOLCHAIN_PREFIX"ar \
13+
CC_arm_unknown_linux_gnueabihf="$TOOLCHAIN_PREFIX"gcc \
914
QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf \
1015
RUST_TEST_THREADS=1
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
ARG IMAGE=ubuntu:24.04
22
FROM $IMAGE
3+
34
RUN apt-get update && \
45
apt-get install -y --no-install-recommends \
56
gcc libc6-dev ca-certificates \
67
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user-static
7-
ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
8+
9+
ENV TOOLCHAIN_PREFIX=arm-linux-gnueabihf-
10+
ENV CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER="$TOOLCHAIN_PREFIX"gcc \
811
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_RUNNER=qemu-arm-static \
12+
AR_armv7_unknown_linux_gnueabihf="$TOOLCHAIN_PREFIX"ar \
13+
CC_armv7_unknown_linux_gnueabihf="$TOOLCHAIN_PREFIX"gcc \
914
QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf \
1015
RUST_TEST_THREADS=1
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
ARG IMAGE=ubuntu:24.04
22
FROM $IMAGE
3+
34
RUN apt-get update && \
45
apt-get install -y --no-install-recommends \
5-
gcc-multilib libc6-dev ca-certificates
6+
gcc-multilib m4 make libc6-dev ca-certificates
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
ARG IMAGE=ubuntu:24.04
22
FROM $IMAGE
3+
34
RUN apt-get update && \
45
apt-get install -y --no-install-recommends \
5-
gcc-multilib libc6-dev ca-certificates
6+
gcc-multilib m4 make libc6-dev ca-certificates

ci/docker/loongarch64-unknown-linux-gnu/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ RUN apt-get update && \
88

99
ENV CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_LINKER=loongarch64-linux-gnu-gcc-14 \
1010
CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_RUNNER=qemu-loongarch64-static \
11+
AR_loongarch64_unknown_linux_gnu=loongarch64-linux-gnu-ar \
1112
CC_loongarch64_unknown_linux_gnu=loongarch64-linux-gnu-gcc-14 \
1213
QEMU_LD_PREFIX=/usr/loongarch64-linux-gnu \
1314
RUST_TEST_THREADS=1

ci/docker/mips-unknown-linux-gnu/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ RUN apt-get update && \
77
gcc-mips-linux-gnu libc6-dev-mips-cross \
88
binfmt-support qemu-user-static qemu-system-mips
99

10-
ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc \
10+
ENV TOOLCHAIN_PREFIX=mips-linux-gnu-
11+
ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER="$TOOLCHAIN_PREFIX"gcc \
1112
CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_RUNNER=qemu-mips-static \
13+
AR_mips_unknown_linux_gnu="$TOOLCHAIN_PREFIX"ar \
14+
CC_mips_unknown_linux_gnu="$TOOLCHAIN_PREFIX"gcc \
1215
QEMU_LD_PREFIX=/usr/mips-linux-gnu \
1316
RUST_TEST_THREADS=1
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
ARG IMAGE=ubuntu:24.04
22
FROM $IMAGE
3+
34
RUN apt-get update && \
45
apt-get install -y --no-install-recommends \
56
ca-certificates \
@@ -9,8 +10,11 @@ RUN apt-get update && \
910
libc6-dev-mips64-cross \
1011
qemu-user-static \
1112
qemu-system-mips
12-
ENV CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_LINKER=mips64-linux-gnuabi64-gcc \
13+
14+
ENV TOOLCHAIN_PREFIX=mips64-linux-gnuabi64-
15+
ENV CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_LINKER="$TOOLCHAIN_PREFIX"gcc \
1316
CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_RUNNER=qemu-mips64-static \
14-
CC_mips64_unknown_linux_gnuabi64=mips64-linux-gnuabi64-gcc \
17+
AR_mips64_unknown_linux_gnuabi64="$TOOLCHAIN_PREFIX"ar \
18+
CC_mips64_unknown_linux_gnuabi64="$TOOLCHAIN_PREFIX"gcc \
1519
QEMU_LD_PREFIX=/usr/mips64-linux-gnuabi64 \
1620
RUST_TEST_THREADS=1

0 commit comments

Comments
 (0)