@@ -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,21 @@ 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+ with :
19+ workspaces : |
20+ rust
21+ - name : Install system packages
22+ run : |
23+ sudo apt-get update
24+ sudo apt-get install -y libsnappy-dev libzzip-dev zlib1g-dev libboost-all-dev
25+ - name : Code fomatting
26+ run : cargo fmt --manifest-path rust/Cargo.toml -- --check
27+ - name : Build
28+ run : cargo build --verbose --manifest-path rust/Cargo.toml
29+ - name : Run tests
30+ run : cargo test --verbose --manifest-path rust/Cargo.toml
2731
2832 build_latest_deps :
2933 name : Latest Dependencies
3337 CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS : allow
3438 steps :
3539 - uses : actions/checkout@v5
40+ - uses : swatinem/rust-cache@v2
41+ with :
42+ workspaces : |
43+ rust
3644 - name : Install system packages
3745 run : |
3846 sudo apt-get update
4250 - run : cargo build --verbose --manifest-path rust/Cargo.toml
4351 - run : cargo test --verbose --manifest-path rust/Cargo.toml
4452
53+ publish :
54+ name : Publish to crates.io
55+
56+ runs-on : ubuntu-latest
57+ if : github.event_name == 'release'
58+ needs : build
59+ environment :
60+ name : crates.io
61+ permissions :
62+ id-token : write
63+
64+ steps :
65+ - uses : actions/checkout@v5
66+ - uses : swatinem/rust-cache@v2
67+ with :
68+ workspaces : |
69+ rust
70+ - name : Install system packages
71+ run : |
72+ sudo apt-get update
73+ sudo apt-get install -y libsnappy-dev libzzip-dev zlib1g-dev libboost-all-dev
74+
75+ - uses : rust-lang/crates-io-auth-action@v1
76+ id : auth
77+
78+ - name : Publish
79+ run : >
80+ cargo publish
81+ --verbose
82+ --manifest-path rust/Cargo.toml
83+ --locked
84+ env :
85+ CARGO_REGISTRY_TOKEN : ${{ steps.auth.outputs.token }}
0 commit comments