-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (86 loc) · 3.2 KB
/
Copy pathcoverage.yml
File metadata and controls
99 lines (86 loc) · 3.2 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
name: Coverage
# LLVM source-based coverage for the core tools (dsdlc, dsdl-opt, unit tests),
# measured while running the full instrumented suite. Runs inside the toolshed
# image (clang-19 present), so there is no per-run LLVM install. All language
# toolchains are added so the complete suite runs under instrumentation.
on:
push:
branches: ["main"]
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: "coverage-${{ github.ref }}"
cancel-in-progress: true
jobs:
coverage:
name: LLVM source coverage
runs-on: ubuntu-26.04
container:
image: ghcr.io/opencyphal/toolshed:ts26.4.2
timeout-minutes: 120
env:
LLVM_DIR: /usr/lib/llvm-22/lib/cmake/llvm
MLIR_DIR: /usr/lib/llvm-22/lib/cmake/mlir
CMAKE_PREFIX_PATH: /usr/lib/llvm-22
CC: clang-22
CXX: clang++-22
steps:
- name: Checkout (with submodules)
uses: actions/checkout@v7
with:
submodules: recursive
- name: Prepare toolchains
uses: ./.github/actions/setup-language-toolchains
- name: Configure (coverage instrumentation)
run: |
cmake -S . -B build/coverage -G "Ninja Multi-Config" \
-DCMAKE_CONFIGURATION_TYPES="Debug;RelWithDebInfo;Release" \
-DLLVM_DIR="${LLVM_DIR}" \
-DMLIR_DIR="${MLIR_DIR}" \
-DLLVMDSDL_ENABLE_LLVM_COVERAGE=ON \
-DLLVMDSDL_ENABLE_PYTHON_ACCELERATOR=ON
- name: Build tools + accelerator (RelWithDebInfo)
run: |
cmake --build build/coverage --config RelWithDebInfo \
--target dsdlc dsdl-opt llvmdsdl-unit-tests build-python-runtime-accelerator
- name: Run instrumented suite + generate coverage report
run: cmake --build build/coverage --config RelWithDebInfo --target coverage-report -j1
- name: Write coverage summary
if: always()
run: |
SUMMARY="build/coverage/coverage/RelWithDebInfo/summary.txt"
{
echo "## LLVM source coverage"
if [ -f "${SUMMARY}" ]; then
echo '```'; tail -n 40 "${SUMMARY}"; echo '```'
else
echo "Coverage summary not found at ${SUMMARY}"
fi
} >> "${GITHUB_STEP_SUMMARY}"
- name: Upload coverage artifacts
if: ${{ always() && !env.ACT }}
uses: actions/upload-artifact@v7
with:
name: coverage-report
path: |
build/coverage/coverage/RelWithDebInfo/summary.txt
build/coverage/coverage/RelWithDebInfo/coverage.lcov
build/coverage/coverage/RelWithDebInfo/html/
if-no-files-found: warn
- name: Check for Codecov token
id: codecov
run: |
if [ -n "${{ secrets.CODECOV_TOKEN }}" ]; then
echo "available=true" >> "${GITHUB_OUTPUT}"
else
echo "available=false" >> "${GITHUB_OUTPUT}"
fi
- name: Upload to Codecov
if: ${{ steps.codecov.outputs.available == 'true' && !env.ACT }}
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: build/coverage/coverage/RelWithDebInfo/coverage.lcov
fail_ci_if_error: false