diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f73b4d13..40b0f3bb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,6 +90,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + - name: Start ClickHouse in Docker uses: hoverkraft-tech/compose-action@v2.2.0 with: @@ -98,10 +102,12 @@ jobs: - run: rustup show active-toolchain -v # TODO: --workspace won't be required after splitting workspace and the main crate - - run: cargo test --workspace - - run: cargo test --workspace --no-default-features - - run: cargo test --workspace --features uuid,time - - run: cargo test --workspace --all-features + - name: Run tests + run: cargo llvm-cov test --workspace --no-report + - name: Run tests without default features + run: cargo llvm-cov test --workspace --no-report --no-default-features + - name: Run tests with all features + run: cargo llvm-cov test --workspace --no-report --all-features - name: Run tests with ClickHouse Cloud env: @@ -112,8 +118,18 @@ jobs: # Temporary runs tests with `cloud_` prefix only until we validate that the rest of the tests are working # `https_errors` should assert ClickHouse Cloud connection errors without enabled TLS features run: | - cargo test cloud_ --features rustls-tls -- --nocapture - cargo test https_errors -- --nocapture + cargo llvm-cov test cloud_ --no-report --features rustls-tls -- --nocapture + cargo llvm-cov test https_errors --no-report -- --nocapture + + - name: Generate code coverage + run: cargo llvm-cov report --codecov --output-path codecov.json + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + with: + files: codecov.json + token: ${{ secrets.CODECOV_TOKEN }} + slug: ClickHouse/clickhouse-rs + fail_ci_if_error: true miri: needs: build diff --git a/README.md b/README.md index ea24f1a5..a9b4ca55 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,9 @@ Official pure Rust typed client for ClickHouse DB. [![Crates.io][crates-badge]][crates-url] [![Documentation][docs-badge]][docs-url] -[![License][license-badge]][license-url] [![Build Status][actions-badge]][actions-url] +[![License][license-badge]][license-url] +[![Codecov][codecov-badge]][codecov-url] [crates-badge]: https://img.shields.io/crates/v/clickhouse.svg [crates-url]: https://crates.io/crates/clickhouse @@ -15,6 +16,8 @@ Official pure Rust typed client for ClickHouse DB. [license-url]: https://github.com/ClickHouse/clickhouse-rs/blob/main/LICENSE-MIT [actions-badge]: https://github.com/ClickHouse/clickhouse-rs/actions/workflows/ci.yml/badge.svg [actions-url]: https://github.com/ClickHouse/clickhouse-rs/actions/workflows/ci.yml +[codecov-badge]: https://codecov.io/gh/ClickHouse/clickhouse-rs/graph/badge.svg?token=3MBXXYL53L +[codecov-url]: https://codecov.io/gh/ClickHouse/clickhouse-rs * Uses `serde` for encoding/decoding rows. * Supports `serde` attributes: `skip_serializing`, `skip_deserializing`, `rename`.