Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
coverage:
# Both gates are informational — they show up in PR comments and Codecov
# status checks but never block merge. Flip `informational: false` later
# when we want to enforce a floor.
status:
project:
default:
target: auto
threshold: 1%
informational: true
patch:
default:
target: auto
informational: true

comment:
layout: "diff, flags, files"
behavior: default
require_changes: false

ignore:
# Vendored third-party code we don't own
- "3rd/**"
# Build artifacts and generated headers
- "build/**"
- "**/*.pb.h"
- "**/*.pb.cc"
# Test sources themselves don't need to be coverage targets
- "**/tests/**"
- "**/test_*.cpp"
17 changes: 17 additions & 0 deletions .github/workflows/build_debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Debug Builds
on:
push:
branches: [ develop, master, release/** ]
pull_request:
branches: [ develop ]

env:
CTEST_OUTPUT_ON_FAILURE: 1
Expand All @@ -12,6 +14,10 @@ env:
jobs:
code-coverage:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
outputs:
version_number: ${{ steps.build.outputs.version }}
steps:
Expand Down Expand Up @@ -67,8 +73,18 @@ jobs:
name: pktvisor
verbose: true

- name: Report coverage to PR
if: github.event_name == 'pull_request'
uses: zgosalvez/github-actions-report-lcov@7d72c57ce4bc101a4a0bf9d726b6c435abde8439 #v7.0.10
with:
coverage-files: build/coverage.info
artifact-name: code-coverage-report
github-token: ${{ secrets.GITHUB_TOKEN }}
update-comment: true
Comment on lines +77 to +83
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Skip PR comment upload when token is read-only

This step unconditionally runs on every pull_request, but for forked PRs (and Dependabot PRs) GitHub downgrades GITHUB_TOKEN to read-only, so github-actions-report-lcov cannot update the PR comment and will fail with a 403. That turns the new coverage workflow into a red check for external contributions even when tests and coverage generation succeed; gate this step to non-fork PRs (or make it non-blocking) to avoid breaking contributor PRs.

Useful? React with 👍 / 👎.


build:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v6

Expand Down Expand Up @@ -113,6 +129,7 @@ jobs:
package:
needs: build
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- name: Download to workspace
uses: actions/download-artifact@v8
Expand Down
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ if(CODE_COVERAGE)
setup_target_for_coverage_lcov(
NAME coverage
EXECUTABLE ctest
EXCLUDE "3rd/*" "cmd/*" "libs/*" "${PROJECT_BINARY_DIR}/*")
LCOV_ARGS --ignore-errors unused
EXCLUDE
"3rd/*"
"libs/*"
"${PROJECT_BINARY_DIR}/*"
"/usr/*"
"*/c++/*")
endif()

set(VISOR_STATIC_PLUGINS)
Expand Down
Loading
Loading