Skip to content

Commit 3b70ea6

Browse files
authored
Add Code Coverage GH action
1 parent 24d4d7f commit 3b70ea6

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/coverage.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
# trying and staging branches are for BORS config
7+
branches:
8+
- trying
9+
- staging
10+
- main
11+
12+
permissions:
13+
contents: read
14+
issues: write
15+
16+
env:
17+
CARGO_TERM_COLOR: always
18+
19+
jobs:
20+
coverage:
21+
# Will not run if the event is a PR to bump-meilisearch-v* (so a pre-release PR)
22+
# Will still run for each push to bump-meilisearch-v*
23+
if: github.event_name != 'pull_request' || !startsWith(github.base_ref, 'bump-meilisearch-v')
24+
runs-on: ubuntu-latest
25+
name: integration-tests
26+
steps:
27+
- uses: actions/checkout@v4
28+
# Nightly Rust is used for cargo llvm-cov --doc below.
29+
- uses: dtolnay/rust-toolchain@nightly
30+
with:
31+
components: llvm-tools-preview
32+
- name: Install cargo-llvm-cov
33+
uses: taiki-e/install-action@v2
34+
with:
35+
tool: cargo-llvm-cov
36+
- name: Meilisearch (latest version) setup with Docker
37+
run: docker run -d -p 7700:7700 getmeili/meilisearch:latest meilisearch --no-analytics --master-key=masterKey
38+
- name: Collect coverage data
39+
# Generate separate reports for tests and doctests, and combine them.
40+
run: |
41+
cargo llvm-cov --no-report --all-features --workspace
42+
cargo llvm-cov --no-report --doc --all-features --workspace
43+
cargo llvm-cov report --doctests --codecov --output-path codecov.json
44+
- name: Upload coverage reports to Codecov
45+
uses: codecov/codecov-action@v5
46+
with:
47+
token: ${{ secrets.CODECOV_TOKEN }}
48+
files: codecov.json
49+
fail_ci_if_error: true

0 commit comments

Comments
 (0)