Skip to content

Commit a658ec4

Browse files
authored
Merge pull request #678 from meilisearch/codecov
Add Code Coverage GH action
2 parents b9567c6 + 56f121a commit a658ec4

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

.github/workflows/tests.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,36 @@ jobs:
8383
uses: ibiqlik/action-yamllint@v3
8484
with:
8585
config_file: .yamllint.yml
86+
87+
coverage:
88+
# Will not run if the actor is Dependabot (dependabot PRs)
89+
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
90+
if: github.actor != 'dependabot[bot]' && !( github.event_name == 'pull_request' && startsWith(github.base_ref, 'bump-meilisearch-v') )
91+
runs-on: ubuntu-latest
92+
needs: integration_tests
93+
name: Code Coverage
94+
steps:
95+
- uses: actions/checkout@v4
96+
# Nightly Rust is used for cargo llvm-cov --doc below.
97+
- uses: dtolnay/rust-toolchain@nightly
98+
with:
99+
components: llvm-tools-preview
100+
- name: Install cargo-llvm-cov
101+
uses: taiki-e/install-action@v2
102+
with:
103+
tool: cargo-llvm-cov
104+
- name: Meilisearch (latest version) setup with Docker
105+
run: docker run -d -p 7700:7700 getmeili/meilisearch:latest meilisearch --no-analytics --master-key=masterKey
106+
- name: Collect coverage data
107+
# Generate separate reports for tests and doctests, and combine them.
108+
run: |
109+
set -euo pipefail
110+
cargo llvm-cov --no-report --all-features --workspace
111+
cargo llvm-cov --no-report --doc --all-features --workspace
112+
cargo llvm-cov report --doctests --codecov --output-path codecov.json
113+
- name: Upload coverage reports to Codecov
114+
uses: codecov/codecov-action@v5
115+
with:
116+
token: ${{ secrets.CODECOV_TOKEN }}
117+
files: codecov.json
118+
fail_ci_if_error: true

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<a href="https://github.com/meilisearch/meilisearch-rust/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-informational" alt="License"></a>
2525
<a href="https://github.com/meilisearch/meilisearch/discussions" alt="Discussions"><img src="https://img.shields.io/badge/github-discussions-red" /></a>
2626
<a href="https://ms-bors.herokuapp.com/repositories/62"><img src="https://bors.tech/images/badge_small.svg" alt="Bors enabled"></a>
27+
<a href="https://codecov.io/gh/meilisearch/meilisearch-rust" ><img src="https://codecov.io/gh/meilisearch/meilisearch-rust/graph/badge.svg?token=NVO9OI8JMG"/></a>
2728
</p>
2829

2930
<p align="center">⚡ The Meilisearch API client written for Rust 🦀</p>

0 commit comments

Comments
 (0)