-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (37 loc) · 1.2 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Tests
on: [push]
jobs:
test:
# See https://github.com/mozilla/grcov#example-how-to-generate-source-based-coverage-for-a-rust-project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.cargo
key: ${{ runner.os }}
- name: Install grcov
run: cargo install grcov
- name: Install llvm-tools-preview
run: rustup component add llvm-tools-preview
- name: Build
run: cargo build --verbose
env:
RUSTFLAGS: "-Cinstrument-coverage"
- name: Run tests
run: cargo test --verbose
env:
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "%p-%m.profraw"
- name: Compute coverage
run: grcov . --binary-path ./target/debug/ --source-dir . --output-path lcov.info --output-type lcov --branch --ignore-not-existing
- uses: codecov/codecov-action@v3
publish:
runs-on: ubuntu-latest
needs: [test]
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
steps:
- uses: actions/checkout@v3
- run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}