Repository navigation
113 lines (98 loc) · 2.99 KB
/
Copy pathcoverage.yml
File metadata and controls
113 lines (98 loc) · 2.99 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
112
113
# Coverage
#
# Runs all test suites (unit, component validation, CLI, API, behavior,
# integration) with code coverage instrumentation on a single commit. Results
# are merged into one lcov report and uploaded to Datadog. Also runs on a
# weekly schedule to ensure full baseline coverage is always fresh.
#
# Limitation: integration and E2E coverage only instruments the test runner
# (cargo-nextest), not the separately-launched Vector binary inside compose
# services. Instrumenting the service binary would require building it with
# cargo-llvm-cov and merging its runtime profdata, which is out of scope here.
name: Coverage
on:
workflow_call:
inputs:
ref:
description: "Git ref to checkout"
required: false
type: string
schedule:
- cron: "0 2 * * 0" # 2 AM UTC every Sunday
workflow_dispatch:
permissions:
contents: read
env:
CI: true
jobs:
tests:
permissions:
contents: read
id-token: write
uses: ./.github/workflows/unit-tests.yml
with:
ref: ${{ inputs.ref }}
default: true
coverage: true
cli: true
vector-api: true
integration-tests:
permissions:
contents: read
packages: write
id-token: write
uses: ./.github/workflows/integration.yml
with:
run_all: true
coverage: true
ref: ${{ inputs.ref }}
secrets: inherit
coverage-upload:
name: Merge and Upload Coverage
runs-on: ubuntu-24.04
needs:
- tests
- integration-tests
if: ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }}
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.ref }}
- name: Download all coverage artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: coverage-*
path: coverage-artifacts
merge-multiple: false
- uses: ./.github/actions/setup
with:
mold: false
vdev: false
datadog-ci: true
lcov: true
- name: Merge coverage reports
run: |
mapfile -t FILES < <(find coverage-artifacts -name '*.info')
echo "Merging ${#FILES[@]} coverage file(s)"
ARGS=()
for f in "${FILES[@]}"; do
ARGS+=("--add-tracefile" "$f")
done
lcov "${ARGS[@]}" --output-file merged-lcov.info
- name: Upload merged coverage artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
continue-on-error: true
with:
name: archive-merged-lcov-report
path: merged-lcov.info
retention-days: 90
overwrite: true
- uses: ./.github/actions/dd-token
- name: Upload to Datadog
env:
DD_SITE: datadoghq.com
DD_ENV: ci
run: datadog-ci coverage upload merged-lcov.info