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
41
42
43
44
45
46
47
48
49
name: Codacy
on:
push:
branches:
pull_request:
branches:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
jobs:
codacy:
name: Codacy Coverage Upload
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: Swatinem/rust-cache@v2
- name: Install cargo-llvm-cov
run: cargo install --locked cargo-llvm-cov
- name: Generate coverage (lcov)
run: |
mkdir -p target/coverage
cargo llvm-cov --all-features --workspace --lcov --output-path target/coverage/lcov.info
- name: Upload coverage to Codacy
# PR code may compile and generate coverage, but only a trusted
# default-branch push receives upload credentials.
if: github.event_name == 'push'
uses: codacy/codacy-coverage-reporter-action@v1.3.0
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
CODACY_API_TOKEN: ${{ secrets.CODACY_API_TOKEN }}
with:
coverage-reports: target/coverage/lcov.info
project-token: ${{ env.CODACY_PROJECT_TOKEN }}
api-token: ${{ env.CODACY_API_TOKEN }}
force-coverage-parser: lcov