Skip to content

Commit 56c5dd3

Browse files
loydslvrtrn
andauthored
chore(ci): upload coverage to codecov.io (#251)
Co-authored-by: Serge Klochkov <3175289+slvrtrn@users.noreply.github.com>
1 parent 7e56c44 commit 56c5dd3

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

.github/workflows/ci.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ jobs:
9090
runs-on: ubuntu-latest
9191
steps:
9292
- uses: actions/checkout@v4
93+
94+
- name: Install cargo-llvm-cov
95+
uses: taiki-e/install-action@cargo-llvm-cov
96+
9397
- name: Start ClickHouse in Docker
9498
uses: hoverkraft-tech/compose-action@v2.2.0
9599
with:
@@ -98,10 +102,12 @@ jobs:
98102

99103
- run: rustup show active-toolchain -v
100104
# TODO: --workspace won't be required after splitting workspace and the main crate
101-
- run: cargo test --workspace
102-
- run: cargo test --workspace --no-default-features
103-
- run: cargo test --workspace --features uuid,time
104-
- run: cargo test --workspace --all-features
105+
- name: Run tests
106+
run: cargo llvm-cov test --workspace --no-report
107+
- name: Run tests without default features
108+
run: cargo llvm-cov test --workspace --no-report --no-default-features
109+
- name: Run tests with all features
110+
run: cargo llvm-cov test --workspace --no-report --all-features
105111

106112
- name: Run tests with ClickHouse Cloud
107113
env:
@@ -112,8 +118,18 @@ jobs:
112118
# Temporary runs tests with `cloud_` prefix only until we validate that the rest of the tests are working
113119
# `https_errors` should assert ClickHouse Cloud connection errors without enabled TLS features
114120
run: |
115-
cargo test cloud_ --features rustls-tls -- --nocapture
116-
cargo test https_errors -- --nocapture
121+
cargo llvm-cov test cloud_ --no-report --features rustls-tls -- --nocapture
122+
cargo llvm-cov test https_errors --no-report -- --nocapture
123+
124+
- name: Generate code coverage
125+
run: cargo llvm-cov report --codecov --output-path codecov.json
126+
- name: Upload coverage to Codecov
127+
uses: codecov/codecov-action@v5
128+
with:
129+
files: codecov.json
130+
token: ${{ secrets.CODECOV_TOKEN }}
131+
slug: ClickHouse/clickhouse-rs
132+
fail_ci_if_error: true
117133

118134
miri:
119135
needs: build

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ Official pure Rust typed client for ClickHouse DB.
44

55
[![Crates.io][crates-badge]][crates-url]
66
[![Documentation][docs-badge]][docs-url]
7-
[![License][license-badge]][license-url]
87
[![Build Status][actions-badge]][actions-url]
8+
[![License][license-badge]][license-url]
9+
[![Codecov][codecov-badge]][codecov-url]
910

1011
[crates-badge]: https://img.shields.io/crates/v/clickhouse.svg
1112
[crates-url]: https://crates.io/crates/clickhouse
@@ -15,6 +16,8 @@ Official pure Rust typed client for ClickHouse DB.
1516
[license-url]: https://github.com/ClickHouse/clickhouse-rs/blob/main/LICENSE-MIT
1617
[actions-badge]: https://github.com/ClickHouse/clickhouse-rs/actions/workflows/ci.yml/badge.svg
1718
[actions-url]: https://github.com/ClickHouse/clickhouse-rs/actions/workflows/ci.yml
19+
[codecov-badge]: https://codecov.io/gh/ClickHouse/clickhouse-rs/graph/badge.svg?token=3MBXXYL53L
20+
[codecov-url]: https://codecov.io/gh/ClickHouse/clickhouse-rs
1821

1922
* Uses `serde` for encoding/decoding rows.
2023
* Supports `serde` attributes: `skip_serializing`, `skip_deserializing`, `rename`.

0 commit comments

Comments
 (0)