Skip to content

Commit 313a8bd

Browse files
taiki-eAmanieu
authored andcommitted
ci: Build std_detect on non-Linux & non-x86 targets
1 parent 85572dc commit 313a8bd

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,3 +211,13 @@ jobs:
211211
if: "matrix.os == 'ubuntu-latest' && !startsWith(matrix.target, 'thumb')"
212212
env:
213213
TARGET: ${{ matrix.target }}
214+
215+
build-std-detect:
216+
needs: [style]
217+
name: Build std_detect
218+
runs-on: ubuntu-latest
219+
steps:
220+
- uses: actions/checkout@master
221+
- name: Install Rust
222+
run: rustup update nightly && rustup default nightly
223+
- run: ./ci/build-std-detect.sh

ci/build-std-detect.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
3+
# Build std_detect on non-Linux & non-x86 targets.
4+
#
5+
# In std_detect, non-x86 targets have OS-specific implementations,
6+
# but we can test only Linux in CI. This script builds targets supported
7+
# by std_detect but cannot be tested in CI.
8+
9+
set -ex
10+
cd "$(dirname "$0")"/..
11+
12+
targets=(
13+
# Android
14+
aarch64-linux-android
15+
arm-linux-androideabi
16+
17+
# FreeBSD
18+
aarch64-unknown-freebsd
19+
armv6-unknown-freebsd
20+
powerpc-unknown-freebsd
21+
powerpc64-unknown-freebsd
22+
23+
# OpenBSD
24+
aarch64-unknown-openbsd
25+
26+
# Windows
27+
aarch64-pc-windows-msvc
28+
)
29+
30+
rustup component add rust-src # for -Z build-std
31+
32+
cd crates/std_detect
33+
for target in "${targets[@]}"; do
34+
if rustup target add "${target}" &>/dev/null; then
35+
cargo build --target "${target}"
36+
else
37+
# tier 3 targets requires -Z build-std.
38+
cargo build -Z build-std="core,alloc" --target "${target}"
39+
fi
40+
done

0 commit comments

Comments
 (0)