@@ -3,7 +3,7 @@ name: Rust
33on :
44 push :
55 pull_request :
6- branches : [ master ]
6+ branches : [master]
77 workflow_dispatch :
88
99env :
@@ -13,17 +13,18 @@ jobs:
1313 build :
1414 runs-on : ubuntu-24.04
1515 steps :
16- - uses : actions/checkout@v5
17- - name : Install system packages
18- run : |
19- sudo apt-get update
20- sudo apt-get install -y libsnappy-dev libzzip-dev zlib1g-dev libboost-all-dev
21- - name : Code fomatting
22- run : cargo fmt --manifest-path rust/Cargo.toml -- --check
23- - name : Build
24- run : cargo build --verbose --manifest-path rust/Cargo.toml
25- - name : Run tests
26- run : cargo test --verbose --manifest-path rust/Cargo.toml
16+ - uses : actions/checkout@v5
17+ - uses : swatinem/rust-cache@v2
18+ - name : Install system packages
19+ run : |
20+ sudo apt-get update
21+ sudo apt-get install -y libsnappy-dev libzzip-dev zlib1g-dev libboost-all-dev
22+ - name : Code fomatting
23+ run : cargo fmt --manifest-path rust/Cargo.toml -- --check
24+ - name : Build
25+ run : cargo build --verbose --manifest-path rust/Cargo.toml
26+ - name : Run tests
27+ run : cargo test --verbose --manifest-path rust/Cargo.toml
2728
2829 build_latest_deps :
2930 name : Latest Dependencies
3334 CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS : allow
3435 steps :
3536 - uses : actions/checkout@v5
37+ - uses : swatinem/rust-cache@v2
3638 - name : Install system packages
3739 run : |
3840 sudo apt-get update
4244 - run : cargo build --verbose --manifest-path rust/Cargo.toml
4345 - run : cargo test --verbose --manifest-path rust/Cargo.toml
4446
47+ publish :
48+ name : Publish to crates.io
49+
50+ runs-on : ubuntu-latest
51+ if : github.event_name == 'release'
52+ needs : build
53+ environment :
54+ name : crates.io
55+
56+ steps :
57+ - uses : actions/checkout@v5
58+ - uses : swatinem/rust-cache@v2
59+ - name : Install system packages
60+ run : |
61+ sudo apt-get update
62+ sudo apt-get install -y libsnappy-dev libzzip-dev zlib1g-dev libboost-all-dev
63+ - name : Publish
64+ run : >
65+ cargo publish
66+ --verbose
67+ --manifest-path rust/Cargo.toml
68+ --locked
69+ --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
0 commit comments