Skip to content

Commit 5e7146f

Browse files
committed
ci: add code coverage and modernize caching
1 parent da30dee commit 5e7146f

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

.github/workflows/sqlformat.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,7 @@ jobs:
3737
with:
3838
toolchain: ${{ matrix.toolchain }}
3939
components: clippy, rustfmt
40-
- name: Cache cargo registry
41-
uses: actions/cache@v4
42-
with:
43-
path: ~/.cargo/registry/cache
44-
key: ${{ runner.os }}-${{ matrix.conf }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
45-
restore-keys: |
46-
${{ runner.os }}-${{ matrix.conf }}-cargo-registry-
40+
- uses: Swatinem/rust-cache@v2
4741
- name: Run rustfmt
4842
if: matrix.toolchain == 'stable'
4943
run: |
@@ -57,3 +51,23 @@ jobs:
5751
run: cargo test
5852
- name: Build docs
5953
run: cargo doc --no-deps
54+
code-coverage:
55+
needs: [build-test-unix]
56+
runs-on: ubuntu-latest
57+
steps:
58+
- uses: actions/checkout@v4
59+
- name: Install stable
60+
uses: dtolnay/rust-toolchain@stable
61+
- uses: Swatinem/rust-cache@v2
62+
- name: Install cargo-llvm-cov
63+
uses: taiki-e/install-action@v2
64+
with:
65+
tool: cargo-llvm-cov
66+
- name: Generate code coverage
67+
run: cargo llvm-cov --codecov --output-path codecov.json --ignore-filename-regex tests\.rs
68+
- name: Upload coverage to Codecov
69+
uses: codecov/codecov-action@v5
70+
with:
71+
token: ${{ secrets.CODECOV_TOKEN }}
72+
files: codecov.json
73+
fail_ci_if_error: false

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/target
22
Cargo.lock
33
/.idea
4+
codecov.json

0 commit comments

Comments
 (0)