Skip to content

Commit d98fb69

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

File tree

1 file changed

+35
-7
lines changed

1 file changed

+35
-7
lines changed

.github/workflows/ci.yml

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

28+
- run: |
29+
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
30+
if [[ "${{ matrix.linux-target }}" == "musl" ]]; then
31+
sudo apt-get remove rustup || true
32+
rustup self uninstall -y || true
33+
rm -rf ${HOME}/.cargo ${HOME}/.rustup
34+
35+
curl https://sh.rustup.rs -sSf | sh -s -- -y
36+
source $HOME/.cargo/env
37+
38+
sudo apt-get update
39+
sudo apt-get -y install musl-tools musl-dev
40+
fi
41+
42+
rustup target add x86_64-unknown-linux-${{ matrix.linux-target }}
43+
mkdir -p ${HOME}/.cargo/
44+
echo -e '[build]' > ${HOME}/.cargo/config.toml
45+
echo -e 'target = "x86_64-unknown-linux-${{ matrix.linux-target }}"' >> ${HOME}/.cargo/config.toml
46+
if [[ "${{ matrix.linux-target }}" == "musl" ]]; then
47+
echo -e 'rustflags = ["-C", "target-feature=+crt-static"]' >> ${HOME}/.cargo/config.toml
48+
echo -e '[target.x86_64-unknown-linux-musl]' >> ${HOME}/.cargo/config.toml
49+
echo -e 'linker = "musl-gcc"' >> ${HOME}/.cargo/config.toml
50+
fi
51+
cat ${HOME}/.cargo/config.toml
52+
fi
53+
54+
rustup toolchain install nightly
55+
rustup toolchain install nightly --component rustfmt
56+
2857
- run: ./scripts/install-protobuf.sh
2958
shell: bash
3059

3160
- run: |
32-
case ${{ matrix.os }} in
33-
macos-latest)
34-
rustup toolchain install nightly --component rustfmt
35-
;;
61+
case ${{ matrix.os }} in
3662
ubuntu-latest)
37-
rustup toolchain install nightly --component rustfmt --target x86_64-unknown-linux-${{ matrix.linux-target }}
63+
cargo +nightly-x86_64-unknown-linux-${{ matrix.linux-target }} fmt --all -- --check
64+
;;
65+
*)
66+
cargo +nightly fmt --all -- --check
3867
;;
3968
esac
40-
- run: cargo +nightly fmt --all -- --check
4169
4270
# the "runc" and "containerd-shim" crates have `sync` code that is not covered by the workspace
4371
- run: cargo check -p runc --all-targets
4472
- run: cargo clippy -p runc --all-targets -- -D warnings
4573
- run: cargo check -p containerd-shim --all-targets
46-
- run: cargo clippy -p containerd-shim --all-targets -- -D warnings
74+
- run: cargo clippy -p containerd-shim --all-targets -- -D warnings
4775

4876
# check the workspace
4977
- run: cargo check --examples --tests --all-targets

0 commit comments

Comments
 (0)