1- name : Rust CI/CD
1+ name : Rust CI with QEMU Emulation
22
33on :
44 push :
@@ -17,24 +17,13 @@ jobs:
1717 strategy :
1818 fail-fast : false
1919 matrix :
20- os : [ubuntu-latest, windows-latest, macos-latest ]
20+ os : [ubuntu-latest]
2121 rust : [stable]
22- include :
23- - os : ubuntu-latest
24- rust : stable
25- target : x86_64-unknown-linux-gnu
26- - os : ubuntu-latest
27- rust : stable
28- target : aarch64-unknown-linux-gnu
29- - os : windows-latest
30- rust : stable
31- target : x86_64-pc-windows-msvc
32- - os : macos-latest
33- rust : stable
34- target : x86_64-apple-darwin
35- - os : macos-latest
36- rust : stable
37- target : aarch64-apple-darwin
22+ target : [aarch64-unknown-linux-gnu]
23+ include :
24+ - os : ubuntu-latest
25+ rust : stable
26+ target : aarch64-unknown-linux-gnu
3827
3928 steps :
4029 - uses : actions/checkout@v3
@@ -67,47 +56,22 @@ jobs:
6756 key : ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
6857 restore-keys : ${{ runner.os }}-${{ matrix.target }}-cargo-
6958
59+ - name : Set up QEMU
60+ uses : docker/setup-qemu-action@v2
61+ with :
62+ platforms : aarch64
63+
7064 - name : Check formatting
7165 run : cargo fmt --all -- --check
7266
7367 - name : Run clippy
7468 run : cargo clippy --target ${{ matrix.target }} -- -D warnings
7569
76- - name : Run tests
70+ - name : Run tests under QEMU emulation
7771 run : cargo test --target ${{ matrix.target }} --verbose
7872
7973 - name : Build
8074 run : cargo build --target ${{ matrix.target }} --verbose
8175
82- # Documentation check
8376 - name : Check documentation
8477 run : cargo doc --no-deps --document-private-items
85-
86- # Publish to crates.io on new tags
87- publish :
88- name : Publish to crates.io
89- needs : test
90- if : startsWith(github.ref, 'refs/tags/v')
91- runs-on : ubuntu-latest
92- steps :
93- - uses : actions/checkout@v3
94-
95- - name : Install Rust toolchain
96- uses : dtolnay/rust-toolchain@stable
97-
98- - name : Verify tag version matches Cargo.toml version
99- run : |
100- CARGO_VERSION=$(cargo pkgid | cut -d# -f2)
101- TAG_VERSION=${GITHUB_REF#refs/tags/v}
102- if [ "$CARGO_VERSION" != "$TAG_VERSION" ]; then
103- echo "Error: Git tag $TAG_VERSION doesn't match Cargo.toml version $CARGO_VERSION"
104- exit 1
105- fi
106-
107- - name : Check package
108- run : cargo package
109-
110- - name : Publish to crates.io
111- run : cargo publish
112- env :
113- CARGO_REGISTRY_TOKEN : ${{ secrets.CARGO_REGISTRY_TOKEN }}
0 commit comments