Skip to content

Commit aafa7b8

Browse files
facontidavideclaude
andcommitted
Use symlinked source tree to restrict Codecov file discovery
Build a curated codecov_root/ with symlinks to only include/ (minus contrib/ and flatbuffers/) and src/. Rewrite coverage.info paths to relative so they resolve against the clean tree. This prevents Codecov from discovering and displaying files outside the intended coverage scope. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 4551d2a commit aafa7b8

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

.github/workflows/cmake_ubuntu.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,28 @@ jobs:
9696
--ignore-errors unused
9797
lcov --list coverage.info
9898
99+
- name: Prepare coverage source tree
100+
run: |
101+
# Build a clean source tree with only the directories we want
102+
# Codecov to see, excluding contrib/ and flatbuffers/
103+
mkdir -p codecov_root/include/behaviortree_cpp
104+
ln -s "$PWD/src" codecov_root/src
105+
for item in include/behaviortree_cpp/*; do
106+
name=$(basename "$item")
107+
case "$name" in
108+
contrib|flatbuffers) continue ;;
109+
esac
110+
ln -s "$PWD/$item" "codecov_root/include/behaviortree_cpp/$name"
111+
done
112+
# Rewrite absolute paths in coverage.info to be relative to codecov_root
113+
sed -i "s|$PWD/||g" coverage.info
114+
99115
- name: Upload coverage reports to Codecov
100116
uses: codecov/codecov-action@v5
101117
with:
102118
files: coverage.info
103119
flags: unittests
104120
disable_search: true
121+
root_dir: codecov_root
122+
plugins: noop
105123
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)