File tree Expand file tree Collapse file tree 2 files changed +146
-0
lines changed Expand file tree Collapse file tree 2 files changed +146
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : CI
2
+
3
+ on :
4
+ push :
5
+ branches : [main]
6
+ pull_request :
7
+ branches : [main]
8
+
9
+ env :
10
+ CARGO_TERM_COLOR : always
11
+
12
+ jobs :
13
+ test :
14
+ name : Test
15
+ runs-on : ubuntu-latest
16
+ strategy :
17
+ matrix :
18
+ rust :
19
+ - stable
20
+ - beta
21
+ - nightly
22
+ steps :
23
+ - uses : actions/checkout@v4
24
+
25
+ - name : Install Rust
26
+ uses : dtolnay/rust-toolchain@master
27
+ with :
28
+ toolchain : ${{ matrix.rust }}
29
+
30
+ - name : Cache dependencies
31
+ uses : actions/cache@v4
32
+ with :
33
+ path : |
34
+ ~/.cargo/registry
35
+ ~/.cargo/git
36
+ target
37
+ key : ${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
38
+
39
+ - name : Run tests
40
+ run : cargo test --verbose
41
+
42
+ - name : Run examples
43
+ run : |
44
+ cargo check --examples
45
+
46
+ fmt :
47
+ name : Rustfmt
48
+ runs-on : ubuntu-latest
49
+ steps :
50
+ - uses : actions/checkout@v4
51
+ - uses : dtolnay/rust-toolchain@stable
52
+ with :
53
+ components : rustfmt
54
+ - name : Check formatting
55
+ run : cargo fmt --all -- --check
56
+
57
+ clippy :
58
+ name : Clippy
59
+ runs-on : ubuntu-latest
60
+ steps :
61
+ - uses : actions/checkout@v4
62
+ - uses : dtolnay/rust-toolchain@stable
63
+ with :
64
+ components : clippy
65
+ - name : Cache dependencies
66
+ uses : actions/cache@v4
67
+ with :
68
+ path : |
69
+ ~/.cargo/registry
70
+ ~/.cargo/git
71
+ target
72
+ key : ${{ runner.os }}-cargo-stable-${{ hashFiles('**/Cargo.lock') }}
73
+ - name : Run clippy
74
+ run : cargo clippy --all-targets --all-features -- -D warnings
75
+
76
+ docs :
77
+ name : Docs
78
+ runs-on : ubuntu-latest
79
+ steps :
80
+ - uses : actions/checkout@v4
81
+ - uses : dtolnay/rust-toolchain@stable
82
+ - name : Cache dependencies
83
+ uses : actions/cache@v4
84
+ with :
85
+ path : |
86
+ ~/.cargo/registry
87
+ ~/.cargo/git
88
+ target
89
+ key : ${{ runner.os }}-cargo-stable-${{ hashFiles('**/Cargo.lock') }}
90
+ - name : Check docs
91
+ run : cargo doc --no-deps --document-private-items
Original file line number Diff line number Diff line change
1
+ name : Release
2
+
3
+ on :
4
+ push :
5
+ tags :
6
+ - " v*.*.*"
7
+
8
+ env :
9
+ CARGO_TERM_COLOR : always
10
+
11
+ jobs :
12
+ release :
13
+ name : Release
14
+ runs-on : ubuntu-latest
15
+ steps :
16
+ - uses : actions/checkout@v4
17
+
18
+ - name : Install Rust
19
+ uses : dtolnay/rust-toolchain@stable
20
+
21
+ - name : Cache dependencies
22
+ uses : actions/cache@v4
23
+ with :
24
+ path : |
25
+ ~/.cargo/registry
26
+ ~/.cargo/git
27
+ target
28
+ key : ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
29
+
30
+ - name : Verify version matches tag
31
+ run : |
32
+ CARGO_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
33
+ TAG_VERSION=${GITHUB_REF#refs/tags/v}
34
+ if [ "$CARGO_VERSION" != "$TAG_VERSION" ]; then
35
+ echo "Version mismatch: Cargo.toml has $CARGO_VERSION but tag is $TAG_VERSION"
36
+ exit 1
37
+ fi
38
+
39
+ - name : Run tests
40
+ run : cargo test --release
41
+
42
+ - name : Build release
43
+ run : cargo build --release
44
+
45
+ - name : Publish to crates.io
46
+ run : cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
47
+
48
+ - name : Create GitHub Release
49
+ uses : softprops/action-gh-release@v1
50
+ with :
51
+ generate_release_notes : true
52
+ draft : false
53
+ prerelease : false
54
+ env :
55
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments