Skip to content

Commit 66e1329

Browse files
committed
fixup! ci: Test with gnu and musl targets
1 parent 47cdef0 commit 66e1329

File tree

1 file changed

+28
-7
lines changed

1 file changed

+28
-7
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,46 @@ jobs:
2525
steps:
2626
- uses: actions/checkout@v4
2727

28+
- run: |
29+
if [[ "${{ matrix.linux-target }}" == "musl" ]]; then
30+
# If we're using the musl target, we know we're
31+
# running on the ubuntu-latest runner
32+
33+
sudo apt-get update
34+
sudo apt-get -y install musl-tools musl-dev
35+
36+
mkdir -p ${HOME}/.cargo/
37+
echo -e '[build]' > ${HOME}/.cargo/config.toml
38+
echo -e 'target = "x86_64-unknown-linux-musl"' >> ${HOME}/.cargo/config.toml
39+
echo -e 'rustflags = ["-C", "target-feature=+crt-static"]' >> ${HOME}/.cargo/config.toml
40+
echo -e '[target.x86_64-unknown-linux-musl]' >> ${HOME}/.cargo/config.toml
41+
echo -e 'linker = "musl-gcc"' >> ${HOME}/.cargo/config.toml
42+
fi
43+
44+
rustup toolchain install nightly
45+
rustup toolchain install nightly --component rustfmt
46+
if [[ "${{ matrix.linux-target }}" == "musl" ]]; then
47+
rustup target add x86_64-unknown-linux-musl --toolchain nightly
48+
fi
49+
2850
- run: ./scripts/install-protobuf.sh
2951
shell: bash
3052

3153
- run: |
32-
case ${{ matrix.os }} in
33-
macos-latest)
34-
rustup toolchain install nightly --component rustfmt
35-
;;
54+
case ${{ matrix.os }} in
3655
ubuntu-latest)
37-
rustup toolchain install nightly --component rustfmt --target x86_64-unknown-linux-${{ matrix.linux-target }}
56+
cargo +nightly-x86_64-unknown-linux-${{ matrix.linux-target }} fmt --all -- --check
57+
;;
58+
*)
59+
cargo +nightly fmt --all -- --check
3860
;;
3961
esac
40-
- run: cargo +nightly fmt --all -- --check
4162
4263
# the "runc" and "containerd-shim" crates have `sync` code that is not covered by the workspace
4364
- run: cargo check -p runc --all-targets
4465
- run: cargo clippy -p runc --all-targets -- -D warnings
4566
- run: cargo check -p containerd-shim --all-targets
46-
- run: cargo clippy -p containerd-shim --all-targets -- -D warnings
67+
- run: cargo clippy -p containerd-shim --all-targets -- -D warnings
4768

4869
# check the workspace
4970
- run: cargo check --examples --tests --all-targets

0 commit comments

Comments
 (0)