Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 9dd3156

Browse files
committed
Enable more targets on CI
This brings the targets tested here in line with those tested in `compiler-builtins`.
1 parent ee24e88 commit 9dd3156

File tree

2 files changed

+142
-42
lines changed

2 files changed

+142
-42
lines changed

.github/workflows/main.yml

+101-29
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,114 @@ name: CI
22
on: [push, pull_request]
33

44
env:
5+
CARGO_TERM_VERBOSE: true
56
RUSTDOCFLAGS: -Dwarnings
67
RUSTFLAGS: -Dwarnings
8+
RUST_BACKTRACE: full
79

810
jobs:
911
docker:
1012
name: Docker
11-
runs-on: ubuntu-latest
13+
timeout-minutes: 10
1214
strategy:
15+
fail-fast: false
1316
matrix:
14-
target:
15-
- aarch64-unknown-linux-gnu
16-
- arm-unknown-linux-gnueabi
17-
- arm-unknown-linux-gnueabihf
18-
- armv7-unknown-linux-gnueabihf
19-
# - i686-unknown-linux-gnu
20-
# MIPS targets disabled since they are dropped to tier 3.
21-
# See https://github.com/rust-lang/compiler-team/issues/648
22-
#- mips-unknown-linux-gnu
23-
#- mips64-unknown-linux-gnuabi64
24-
#- mips64el-unknown-linux-gnuabi64
25-
- powerpc-unknown-linux-gnu
26-
- powerpc64-unknown-linux-gnu
27-
- powerpc64le-unknown-linux-gnu
28-
- x86_64-unknown-linux-gnu
17+
include:
18+
- target: aarch64-apple-darwin
19+
os: macos-latest
20+
- target: aarch64-unknown-linux-gnu
21+
os: ubuntu-latest
22+
- target: aarch64-pc-windows-msvc
23+
os: windows-latest
24+
build_only: 1
25+
- target: arm-unknown-linux-gnueabi
26+
os: ubuntu-latest
27+
- target: arm-unknown-linux-gnueabihf
28+
os: ubuntu-latest
29+
- target: armv7-unknown-linux-gnueabihf
30+
os: ubuntu-latest
31+
- target: i586-unknown-linux-gnu
32+
os: ubuntu-latest
33+
- target: i686-unknown-linux-gnu
34+
os: ubuntu-latest
35+
- target: powerpc-unknown-linux-gnu
36+
os: ubuntu-latest
37+
- target: powerpc64-unknown-linux-gnu
38+
os: ubuntu-latest
39+
- target: powerpc64le-unknown-linux-gnu
40+
os: ubuntu-latest
41+
- target: riscv64gc-unknown-linux-gnu
42+
os: ubuntu-latest
43+
- target: thumbv6m-none-eabi
44+
os: ubuntu-latest
45+
- target: thumbv7em-none-eabi
46+
os: ubuntu-latest
47+
- target: thumbv7em-none-eabihf
48+
os: ubuntu-latest
49+
- target: thumbv7m-none-eabi
50+
os: ubuntu-latest
51+
- target: x86_64-unknown-linux-gnu
52+
os: ubuntu-latest
53+
- target: x86_64-apple-darwin
54+
os: macos-13
55+
- target: i686-pc-windows-msvc
56+
os: windows-latest
57+
- target: x86_64-pc-windows-msvc
58+
os: windows-latest
59+
- target: i686-pc-windows-gnu
60+
os: windows-latest
61+
channel: nightly-i686-gnu
62+
- target: x86_64-pc-windows-gnu
63+
os: windows-latest
64+
channel: nightly-x86_64-gnu
65+
runs-on: ${{ matrix.os }}
2966
steps:
30-
- uses: actions/checkout@master
31-
- name: Install Rust
32-
run: rustup update nightly && rustup default nightly
33-
- run: rustup target add ${{ matrix.target }}
34-
- run: rustup target add x86_64-unknown-linux-musl
35-
- run: cargo generate-lockfile
36-
- run: ./ci/run-docker.sh ${{ matrix.target }}
67+
- name: Print runner information
68+
run: uname -a
69+
- uses: actions/checkout@v4
70+
- name: Install Rust (rustup)
71+
shell: bash
72+
run: |
73+
channel="nightly"
74+
# Account for channels that have required components (MinGW)
75+
[ -n "${{ matrix.channel }}" ] && channel="${{ matrix.channel }}"
76+
rustup update "$channel" --no-self-update
77+
rustup default "$channel"
78+
rustup target add ${{ matrix.target }}
79+
rustup component add llvm-tools-preview
80+
- uses: Swatinem/rust-cache@v2
81+
with:
82+
key: ${{ matrix.target }}
83+
84+
- name: Download musl source
85+
run: ./ci/download-musl.sh
86+
shell: bash
87+
88+
# Non-linux tests just use our raw script
89+
- name: Run locally
90+
run: ./ci/run.sh ${{ matrix.target }}
91+
if: matrix.os != 'ubuntu-latest'
92+
shell: bash
93+
env:
94+
BUILD_ONLY: ${{ matrix.build_only }}
95+
96+
# Otherwise we use our docker containers to run builds
97+
- name: Run in Docker
98+
if: matrix.os == 'ubuntu-latest'
99+
run: |
100+
rustup target add x86_64-unknown-linux-musl
101+
cargo generate-lockfile && ./ci/run-docker.sh ${{ matrix.target }}
37102
38103
rustfmt:
39104
name: Rustfmt
40105
runs-on: ubuntu-latest
41106
steps:
42107
- uses: actions/checkout@master
43108
- name: Install Rust
44-
run: rustup update stable && rustup default stable && rustup component add rustfmt
109+
run: |
110+
rustup update stable --no-self-update
111+
rustup default stable
112+
rustup component add rustfmt
45113
- run: cargo fmt -- --check
46114

47115
wasm:
@@ -50,17 +118,19 @@ jobs:
50118
steps:
51119
- uses: actions/checkout@master
52120
- name: Install Rust
53-
run: rustup update nightly && rustup default nightly
121+
run: rustup update nightly --no-self-update && rustup default nightly
54122
- run: rustup target add wasm32-unknown-unknown
123+
- name: Download MUSL source
124+
run: ./ci/download-musl.sh
55125
- run: cargo build --target wasm32-unknown-unknown
56126

57-
cb:
127+
builtins:
58128
name: "The compiler-builtins crate works"
59129
runs-on: ubuntu-latest
60130
steps:
61131
- uses: actions/checkout@master
62132
- name: Install Rust
63-
run: rustup update nightly && rustup default nightly
133+
run: rustup update nightly --no-self-update && rustup default nightly
64134
- run: cargo build -p cb
65135

66136
benchmarks:
@@ -69,15 +139,17 @@ jobs:
69139
steps:
70140
- uses: actions/checkout@master
71141
- name: Install Rust
72-
run: rustup update nightly && rustup default nightly
142+
run: rustup update nightly --no-self-update && rustup default nightly
143+
- name: Download MUSL source
144+
run: ./ci/download-musl.sh
73145
- run: cargo bench --all
74146

75147
success:
76148
needs:
77149
- docker
78150
- rustfmt
79151
- wasm
80-
- cb
152+
- builtins
81153
- benchmarks
82154
runs-on: ubuntu-latest
83155
# GitHub branch protection is exceedingly silly and treats "jobs skipped because a dependency

ci/run.sh

+41-13
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,49 @@
22

33
set -eux
44

5-
target="$1"
6-
7-
cmd="cargo test --all --target $target"
8-
5+
export RUST_BACKTRACE="${RUST_BACKTRACE:-full}"
96
# Needed for no-panic to correct detect a lack of panics
107
export RUSTFLAGS="$RUSTFLAGS -Ccodegen-units=1"
118

12-
# stable by default
13-
$cmd
14-
$cmd --release
9+
target="${1:-}"
10+
11+
if [ -z "$target" ]; then
12+
host_target=$(rustc -vV | awk '/^host/ { print $2 }')
13+
echo "Defaulted to host target $host_target"
14+
target="$host_target"
15+
fi
16+
17+
18+
# We nceed to specifically skip tests for this crate on systems that can't
19+
# build musl since otherwise `--all` will activate it.
20+
case "$target" in
21+
*msvc*) exclude_flag="--exclude musl-math-sys" ;;
22+
*wasm*) exclude_flag="--exclude musl-math-sys" ;;
23+
*thumb*) exclude_flag="--exclude musl-math-sys" ;;
24+
*) exclude_flag="" ;;
25+
esac
26+
27+
if [ "${BUILD_ONLY:-}" = "1" ]; then
28+
cmd="cargo build --target $target --package libm"
29+
$cmd
30+
$cmd --features 'unstable'
31+
32+
echo "no tests to run for no_std"
33+
else
34+
cmd="cargo test --all --target $target $exclude_flag"
35+
36+
37+
# stable by default
38+
$cmd
39+
$cmd --release
1540

16-
# unstable with a feature
17-
$cmd --features 'unstable'
18-
$cmd --release --features 'unstable'
41+
# unstable with a feature
42+
$cmd --features 'unstable'
43+
$cmd --release --features 'unstable'
1944

20-
# also run the reference tests
21-
$cmd --features 'unstable libm-test/musl-bitwise-tests'
22-
$cmd --release --features 'unstable libm-test/musl-bitwise-tests'
45+
if [ "$(uname -a)" = "Linux" ]; then
46+
# also run the reference tests when we can. requires a Linux host.
47+
$cmd --features 'unstable libm-test/musl-bitwise-tests'
48+
$cmd --release --features 'unstable libm-test/musl-bitwise-tests'
49+
fi
50+
fi

0 commit comments

Comments
 (0)