Skip to content

Commit 643ca35

Browse files
committed
Generate an upload coverage reports in CI
1 parent 0e03dc2 commit 643ca35

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

.github/workflows/test.yml

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Run test suite
2-
on: pull_request
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- master
37

48
jobs:
59
# Label of the container job
@@ -38,6 +42,7 @@ jobs:
3842
profile: minimal
3943
toolchain: stable
4044
override: true
45+
components: llvm-tools-preview
4146

4247
- name: Install sqlx-cli
4348
uses: actions-rs/cargo@v1
@@ -52,11 +57,26 @@ jobs:
5257
args: migrate run
5358
env:
5459
DATABASE_URL: postgresql://pointercrate:postgres@localhost/postgres
55-
RUST_BACKTRACE: 1
5660

5761
- name: Run tests
5862
uses: actions-rs/cargo@v1
5963
with:
6064
command: test
6165
env:
6266
DATABASE_URL: postgresql://pointercrate:postgres@localhost/postgres
67+
RUST_BACKTRACE: 1
68+
RUSTFLAGS: -Cinstrument-coverage
69+
70+
- name: Install grcov
71+
uses: actions-rs/cargo@v1
72+
with:
73+
command: install
74+
args: grcov
75+
76+
- name: Generate coverage report
77+
run: grcov . -s . --binary-path ./target/debug/ -t lcov --ignore-not-existing -o ./target/debug/coverage.lcov --ignore "*/tests/*" --keep-only "pointercrate-*"
78+
79+
- name: Upload coverage report
80+
uses: codecov/codecov-action@v3
81+
with:
82+
files: ./target/debug/coverage.lcov

0 commit comments

Comments
 (0)