Skip to content

Commit 4f2dde8

Browse files
committed
ci: 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 * Update the extension to the canonical .yaml * Set AR_ and CC_ environments in docker * Install requirements to build MPFR
1 parent 38bbfbf commit 4f2dde8

File tree

24 files changed

+161
-119
lines changed

24 files changed

+161
-119
lines changed

.github/workflows/main.yml renamed to .github/workflows/main.yaml

+80-93
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,107 @@
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
17-
os: macos-latest
18-
rust: nightly
26+
os: macos-15
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
75+
channel: nightly-i686-gnu
10076
- target: x86_64-pc-windows-gnu
101-
os: windows-latest
102-
rust: nightly-x86_64-gnu
77+
os: windows-2025
78+
channel: nightly-x86_64-gnu
79+
runs-on: ${{ matrix.os }}
80+
env:
81+
BUILD_ONLY: ${{ matrix.build_only }}
82+
TEST_VERBATIM: ${{ matrix.test_verbatim }}
10383
steps:
10484
- name: Print runner information
10585
run: uname -a
10686
- uses: actions/checkout@v4
10787
with:
10888
submodules: true
10989
- name: Install Rust (rustup)
110-
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
11190
shell: bash
112-
- run: rustup target add ${{ matrix.target }}
113-
- run: rustup component add llvm-tools-preview
91+
run: |
92+
channel="nightly"
93+
# Account for channels that have required components (MinGW)
94+
[ -n "${{ matrix.channel }}" ] && channel="${{ matrix.channel }}"
95+
rustup update "$channel" --no-self-update
96+
rustup default "$channel"
97+
rustup target add "${{ matrix.target }}"
98+
rustup component add llvm-tools-preview
11499
- uses: Swatinem/rust-cache@v2
115100
with:
116101
key: ${{ matrix.target }}
117102
- name: Cache Docker layers
118103
uses: actions/cache@v4
119-
if: matrix.os == 'ubuntu-latest'
104+
if: matrix.os == 'ubuntu-24.04'
120105
with:
121106
path: /tmp/.buildx-cache
122107
key: ${{ matrix.target }}-buildx-${{ github.sha }}
@@ -136,33 +121,49 @@ jobs:
136121
shell: bash
137122

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

146129
# Configure buildx to use Docker layer caching
147130
- uses: docker/setup-buildx-action@v3
148-
if: matrix.os == 'ubuntu-latest'
131+
if: matrix.os == 'ubuntu-24.04'
149132

150133
# 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'
134+
- name: Run in Docker
135+
if: matrix.os == 'ubuntu-24.04'
136+
run: cargo generate-lockfile && ./ci/run-docker.sh ${{ matrix.target }}
153137

154138
# Workaround to keep Docker cache smaller
155139
# https://github.com/docker/build-push-action/issues/252
156140
# https://github.com/moby/buildkit/issues/1896
157141
- name: Move Docker cache
158-
if: matrix.os == 'ubuntu-latest'
142+
if: matrix.os == 'ubuntu-24.04'
159143
run: |
160144
rm -rf /tmp/.buildx-cache
161145
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
162146
147+
clippy:
148+
name: Clippy
149+
runs-on: ubuntu-24.04
150+
timeout-minutes: 10
151+
steps:
152+
- uses: actions/checkout@v4
153+
with:
154+
submodules: true
155+
# Unlike rustfmt, stable clippy does not work on code with nightly features.
156+
- name: Install nightly `clippy`
157+
run: |
158+
rustup set profile minimal
159+
rustup default nightly
160+
rustup component add clippy
161+
- uses: Swatinem/rust-cache@v2
162+
- run: cargo clippy -- -D clippy::all
163+
163164
miri:
164165
name: Miri
165-
runs-on: ubuntu-latest
166+
runs-on: ubuntu-24.04
166167
steps:
167168
- uses: actions/checkout@v4
168169
with:
@@ -177,7 +178,7 @@ jobs:
177178

178179
rustfmt:
179180
name: Rustfmt
180-
runs-on: ubuntu-latest
181+
runs-on: ubuntu-24.04
181182
steps:
182183
- uses: actions/checkout@v4
183184
with:
@@ -186,27 +187,13 @@ jobs:
186187
run: rustup set profile minimal && rustup default stable && rustup component add rustfmt
187188
- run: cargo fmt -- --check
188189

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-
203190
success:
204191
needs:
205192
- test
206193
- rustfmt
207194
- clippy
208195
- miri
209-
runs-on: ubuntu-latest
196+
runs-on: ubuntu-24.04
210197
# GitHub branch protection is exceedingly silly and treats "jobs skipped because a dependency
211198
# failed" as success. So we have to do some contortions to ensure the job fails if any of its
212199
# dependencies fails.
File renamed without changes.
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
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
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
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
+2-1
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
+2-1
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

+1
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

+4-1
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
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)