From e3d811ff72368fb3c72929bb5c839b6eeb1dbe58 Mon Sep 17 00:00:00 2001 From: KevFan Date: Tue, 25 Jul 2023 10:12:58 +0100 Subject: [PATCH 1/2] workflow: add codecov --- .github/workflows/rust.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 04bfb626..ec28f3cb 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -53,10 +53,15 @@ jobs: - uses: abelfodil/protoc-action@v1 with: protoc-version: '3.19.4' - - uses: actions-rs/cargo@v1 - with: - command: test - args: --all-features + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + - name: Test and Generate code coverage + run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info + - name: Codecov + uses: codecov/codecov-action@v3 + with: + verbose: true + fail_ci_if_error: true fmt: name: Rustfmt From b7c0c2ba8502695519db082aa5186d1abbaaf102 Mon Sep 17 00:00:00 2001 From: KevFan Date: Tue, 25 Jul 2023 14:13:23 +0100 Subject: [PATCH 2/2] test: nightly with doc test --- .github/workflows/rust.yml | 6 ++++-- README.md | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ec28f3cb..589c5277 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -45,10 +45,12 @@ jobs: - uses: supercharge/redis-github-action@1.1.0 with: redis-version: 5 + # Nightly is required for code coverage with doctests + # https://github.com/taiki-e/cargo-llvm-cov/issues/2 - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: nightly override: true - uses: abelfodil/protoc-action@v1 with: @@ -56,7 +58,7 @@ jobs: - name: Install cargo-llvm-cov uses: taiki-e/install-action@cargo-llvm-cov - name: Test and Generate code coverage - run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info + run: cargo +nightly llvm-cov --all-features --workspace --lcov --doctests --output-path lcov.info - name: Codecov uses: codecov/codecov-action@v3 with: diff --git a/README.md b/README.md index 1c17d76f..7a8c6972 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ [![Crates.io](https://img.shields.io/crates/v/limitador)](https://crates.io/crates/limitador) [![Docker Repository on Quay](https://quay.io/repository/kuadrant/limitador/status "Docker Repository on Quay")](https://quay.io/repository/kuadrant/limitador) +[![codecov](https://codecov.io/gh/Kuadrant/limitador/branch/master/graph/badge.svg?token=CE9LD3XCJT)](https://codecov.io/gh/Kuadrant/limitador) Limitador is a generic rate-limiter written in Rust. It can be used as a library, or as a service. The service exposes HTTP endpoints to apply and observe