Skip to content

Commit 1d73e5e

Browse files
committed
chore(readme): Fix version
1 parent 3c170e9 commit 1d73e5e

File tree

2 files changed

+63
-9
lines changed

2 files changed

+63
-9
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,17 @@ name: CI
33
on:
44
push:
55
branches: ['**']
6+
paths:
7+
- '**.rs'
8+
- '**/Cargo.toml'
9+
- '**/Cargo.lock'
10+
- '.github/workflows/ci.yml'
611
pull_request:
12+
paths:
13+
- '**.rs'
14+
- '**/Cargo.toml'
15+
- '**/Cargo.lock'
16+
- '.github/workflows/ci.yml'
717

818
env:
919
CARGO_TERM_COLOR: always
@@ -47,13 +57,21 @@ jobs:
4757
-D warnings
4858
4959
test:
50-
name: Test Suite
60+
name: Test Suite with Coverage
5161
runs-on: ubuntu-latest
5262
steps:
5363
- uses: actions/checkout@v5
5464

5565
- name: Install Rust
5666
uses: dtolnay/rust-toolchain@stable
67+
with:
68+
components: llvm-tools-preview
69+
70+
- name: Install cargo-llvm-cov
71+
run: cargo install cargo-llvm-cov
72+
73+
- name: Install rustfilt
74+
run: cargo install rustfilt
5775

5876
- name: Cache cargo registry
5977
uses: actions/cache@v4
@@ -73,8 +91,18 @@ jobs:
7391
path: target
7492
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
7593

76-
- name: Run tests
77-
run: cargo test --all-features --verbose
94+
- name: Generate test coverage
95+
run: cargo llvm-cov --workspace --all-features --lcov --output-path lcov.info --branch
96+
97+
- name: Demangle coverage output
98+
run: rustfilt -i lcov.info -o lcov-demangled.info
99+
100+
- name: Upload coverage to Codecov
101+
uses: codecov/codecov-action@v5
102+
with:
103+
files: lcov-demangled.info
104+
fail_ci_if_error: false
105+
token: ${{ secrets.CODECOV_TOKEN }}
78106

79107
examples:
80108
name: Examples

.github/workflows/release.yml

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ on:
44
push:
55
branches:
66
- main
7+
paths:
8+
- '**.rs'
9+
- '**/Cargo.toml'
10+
- '**/Cargo.lock'
11+
- '.github/workflows/release.yml'
712

813
env:
914
CARGO_TERM_COLOR: always
@@ -28,7 +33,13 @@ jobs:
2833
- name: Install Rust
2934
uses: dtolnay/rust-toolchain@stable
3035
with:
31-
components: clippy
36+
components: clippy, llvm-tools-preview
37+
38+
- name: Install cargo-llvm-cov
39+
run: cargo install cargo-llvm-cov
40+
41+
- name: Install rustfilt
42+
run: cargo install rustfilt
3243

3344
- name: Cache cargo registry
3445
uses: actions/cache@v4
@@ -55,8 +66,18 @@ jobs:
5566
-W clippy::nursery \
5667
-D warnings
5768
58-
- name: Run tests
59-
run: cargo test --all-features --verbose
69+
- name: Generate test coverage
70+
run: cargo llvm-cov --workspace --all-features --lcov --output-path lcov.info --branch
71+
72+
- name: Demangle coverage output
73+
run: rustfilt -i lcov.info -o lcov-demangled.info
74+
75+
- name: Upload coverage to Codecov
76+
uses: codecov/codecov-action@v5
77+
with:
78+
files: lcov-demangled.info
79+
fail_ci_if_error: false
80+
token: ${{ secrets.CODECOV_TOKEN }}
6081

6182
- name: Build all examples
6283
run: cargo build --examples --all-features --verbose
@@ -91,10 +112,15 @@ jobs:
91112
env:
92113
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93114
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}
94-
run: npx semantic-release
115+
run: |
116+
npx semantic-release
117+
echo "new_release_published=$([ -f .semanticRelease ])" >> $GITHUB_OUTPUT
95118
96119
- name: Publish to crates.io
97-
if: steps.semantic.outputs.new_release_published == 'true'
98-
run: cargo publish --token ${{ secrets.CARGO_TOKEN }} --allow-dirty
120+
run: |
121+
if cargo publish --token ${{ secrets.CARGO_TOKEN }} --allow-dirty 2>&1 | grep -q "crate version .* is already uploaded"; then
122+
echo "Version already published, skipping"
123+
exit 0
124+
fi
99125
env:
100126
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}

0 commit comments

Comments
 (0)