-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (97 loc) · 3.71 KB
/
codacy-coverage.yml
File metadata and controls
111 lines (97 loc) · 3.71 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Codacy Coverage
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
coverage:
name: C, Rust, and Go Coverage
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with:
go-version-file: src/go/go.mod
cache: false
- name: Install coverage tools
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends gcovr
- name: Generate coverage reports
run: bash tests/generate-codacy-coverage.sh
- name: Upload coverage report artifact
if: always() && hashFiles('coverage/codacy/*') != ''
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: codacy-coverage-reports
path: coverage/codacy/
retention-days: 5
- name: Verify Codacy account token
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
env:
CODACY_API_TOKEN: ${{ secrets.CODACY_API_TOKEN }}
run: |
if [ -z "${CODACY_API_TOKEN}" ]; then
echo "CODACY_API_TOKEN secret is required to upload coverage to Codacy." >&2
exit 1
fi
- name: Upload C coverage to Codacy
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
env:
CODACY_API_TOKEN: ${{ secrets.CODACY_API_TOKEN }}
CODACY_ORGANIZATION_PROVIDER: gh
CODACY_USERNAME: netdata
CODACY_PROJECT_NAME: plugin-ipc
run: |
bash <(curl -Ls https://coverage.codacy.com/get.sh) report \
--partial \
--force-coverage-parser lcov \
-l C \
-r coverage/codacy/c-lcov.info
- name: Upload Rust coverage to Codacy
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
env:
CODACY_API_TOKEN: ${{ secrets.CODACY_API_TOKEN }}
CODACY_ORGANIZATION_PROVIDER: gh
CODACY_USERNAME: netdata
CODACY_PROJECT_NAME: plugin-ipc
run: |
bash <(curl -Ls https://coverage.codacy.com/get.sh) report \
--partial \
--force-coverage-parser lcov \
-l Rust \
-r coverage/codacy/rust-lcov.info
- name: Upload Go coverage to Codacy
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
env:
CODACY_API_TOKEN: ${{ secrets.CODACY_API_TOKEN }}
CODACY_ORGANIZATION_PROVIDER: gh
CODACY_USERNAME: netdata
CODACY_PROJECT_NAME: plugin-ipc
run: |
bash <(curl -Ls https://coverage.codacy.com/get.sh) report \
--partial \
--force-coverage-parser go \
-r coverage/codacy/go-coverage.out
- name: Finalize Codacy coverage upload
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
env:
CODACY_API_TOKEN: ${{ secrets.CODACY_API_TOKEN }}
CODACY_ORGANIZATION_PROVIDER: gh
CODACY_USERNAME: netdata
CODACY_PROJECT_NAME: plugin-ipc
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) final