Skip to content

Commit cfcba01

Browse files
authored
Merge pull request #2383 from ehuss/musl-fix
CI: Test more targets.
2 parents b960c69 + 3dc40f1 commit cfcba01

File tree

4 files changed

+52
-27
lines changed

4 files changed

+52
-27
lines changed

.github/workflows/deploy.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,9 @@ permissions:
1212

1313
jobs:
1414
release:
15-
name: Deploy Release
1615
runs-on: ${{ matrix.os }}
1716
strategy:
1817
matrix:
19-
target:
20-
- aarch64-unknown-linux-musl
21-
- x86_64-unknown-linux-gnu
22-
- x86_64-unknown-linux-musl
23-
- x86_64-apple-darwin
24-
- x86_64-pc-windows-msvc
2518
include:
2619
- target: aarch64-unknown-linux-musl
2720
os: ubuntu-20.04
@@ -33,8 +26,9 @@ jobs:
3326
os: macos-latest
3427
- target: x86_64-pc-windows-msvc
3528
os: windows-latest
29+
name: Deploy ${{ matrix.target }}
3630
steps:
37-
- uses: actions/checkout@master
31+
- uses: actions/checkout@v4
3832
- name: Install Rust
3933
run: ci/install-rust.sh stable ${{ matrix.target }}
4034
- name: Build asset
@@ -47,7 +41,7 @@ jobs:
4741
name: GitHub Pages
4842
runs-on: ubuntu-latest
4943
steps:
50-
- uses: actions/checkout@master
44+
- uses: actions/checkout@v4
5145
- name: Install Rust (rustup)
5246
run: rustup update stable --no-self-update && rustup default stable
5347
- name: Build book
@@ -64,7 +58,7 @@ jobs:
6458
name: Publish to crates.io
6559
runs-on: ubuntu-latest
6660
steps:
67-
- uses: actions/checkout@master
61+
- uses: actions/checkout@v4
6862
- name: Install Rust (rustup)
6963
run: rustup update stable --no-self-update && rustup default stable
7064
- name: Publish

.github/workflows/main.yml

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,45 +5,67 @@ on:
55

66
jobs:
77
test:
8-
name: Test
98
runs-on: ${{ matrix.os }}
109
strategy:
1110
matrix:
12-
build: [stable, beta, nightly, macos, windows, msrv]
1311
include:
14-
- build: stable
12+
- name: stable linux
1513
os: ubuntu-latest
1614
rust: stable
17-
- build: beta
15+
target: x86_64-unknown-linux-gnu
16+
- name: beta linux
1817
os: ubuntu-latest
1918
rust: beta
20-
- build: nightly
19+
target: x86_64-unknown-linux-gnu
20+
- name: nightly linux
2121
os: ubuntu-latest
2222
rust: nightly
23-
- build: macos
23+
target: x86_64-unknown-linux-gnu
24+
- name: stable x86_64-unknown-linux-musl
25+
os: ubuntu-20.04
26+
rust: stable
27+
target: x86_64-unknown-linux-musl
28+
- name: stable x86_64 macos
29+
os: macos-latest
30+
rust: stable
31+
target: x86_64-apple-darwin
32+
- name: stable aarch64 macos
2433
os: macos-latest
2534
rust: stable
26-
- build: windows
35+
target: aarch64-apple-darwin
36+
- name: stable windows-msvc
2737
os: windows-latest
2838
rust: stable
29-
- build: msrv
39+
target: x86_64-pc-windows-msvc
40+
- name: msrv
3041
os: ubuntu-20.04
3142
# sync MSRV with docs: guide/src/guide/installation.md and Cargo.toml
3243
rust: 1.74.0
44+
target: x86_64-unknown-linux-gnu
45+
name: ${{ matrix.name }}
3346
steps:
34-
- uses: actions/checkout@v3
47+
- uses: actions/checkout@v4
3548
- name: Install Rust
36-
run: bash ci/install-rust.sh ${{ matrix.rust }}
49+
run: bash ci/install-rust.sh ${{ matrix.rust }} ${{ matrix.target }}
3750
- name: Build and run tests
38-
run: cargo test --locked
51+
run: cargo test --locked --target ${{ matrix.target }}
3952
- name: Test no default
40-
run: cargo test --no-default-features
53+
run: cargo test --no-default-features --target ${{ matrix.target }}
54+
55+
aarch64-cross-builds:
56+
runs-on: ubuntu-20.04
57+
steps:
58+
- uses: actions/checkout@v4
59+
- name: Install Rust
60+
run: bash ci/install-rust.sh stable aarch64-unknown-linux-musl
61+
- name: Build
62+
run: cargo build --locked --target aarch64-unknown-linux-musl
4163

4264
rustfmt:
4365
name: Rustfmt
4466
runs-on: ubuntu-latest
4567
steps:
46-
- uses: actions/checkout@v3
68+
- uses: actions/checkout@v4
4769
- name: Install Rust
4870
run: rustup update stable && rustup default stable && rustup component add rustfmt
4971
- run: cargo fmt --check

ci/install-rust.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ then
2222
rustup component add llvm-tools-preview --toolchain=$TOOLCHAIN
2323
rustup component add rust-std-$TARGET --toolchain=$TOOLCHAIN
2424
fi
25+
if [[ $TARGET == *"musl" ]]
26+
then
27+
# This is needed by libdbus-sys.
28+
sudo apt update -y && sudo apt install musl-dev musl-tools -y
29+
fi
30+
if [[ $TARGET == "aarch64-unknown-linux-musl" ]]
31+
then
32+
echo CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=rust-lld >> $GITHUB_ENV
33+
# This `CC` is some nonsense needed for libdbus-sys (via opener).
34+
# I don't know if this is really the right thing to do, but it seems to work.
35+
sudo apt install gcc-aarch64-linux-gnu -y
36+
echo CC=aarch64-linux-gnu-gcc >> $GITHUB_ENV
37+
fi
2538
fi
2639

2740
rustup default $TOOLCHAIN

ci/make-release-asset.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ TAG=${GITHUB_REF#*/tags/}
1212

1313
host=$(rustc -Vv | grep ^host: | sed -e "s/host: //g")
1414
target=$2
15-
if [ "$host" != "$target" ]
16-
then
17-
export "CARGO_TARGET_$(echo $target | tr a-z- A-Z_)_LINKER"=rust-lld
18-
fi
1915
export CARGO_PROFILE_RELEASE_LTO=true
2016
cargo build --locked --bin mdbook --release --target $target
2117
cd target/$target/release

0 commit comments

Comments
 (0)