Files
rippled/.github/workflows/doc-coverage.yml
2026-05-14 10:10:39 +02:00

110 lines
3.2 KiB
YAML

name: Documentation Coverage
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'include/**'
- 'src/libxrpl/**'
- 'src/xrpld/**'
- 'docs/Doxyfile'
- '.github/doc-coverage-thresholds.json'
- '.github/workflows/doc-coverage.yml'
concurrency:
group: doc-coverage-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
coverage:
runs-on: ubuntu-latest
container: ghcr.io/xrplf/ci/tools-rippled-documentation:sha-a8c7be1
steps:
- name: Checkout PR branch
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Install coverxygen
run: pip install coverxygen
- name: Determine new C++ files
id: new-files
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
with:
files: |
include/**/*.h
src/**/*.h
src/**/*.cpp
since_last_remote_commit: false
- name: Build Doxygen XML (PR branch)
env:
BUILD_DIR: build-pr
run: |
mkdir -p "${BUILD_DIR}"
cd "${BUILD_DIR}"
cmake -Donly_docs=ON ..
cmake --build . --target docs
- name: Generate coverage report (PR branch)
run: |
python3 -m coverxygen \
--xml-dir build-pr/docs/xml \
--src-dir . \
--output doc-coverage.info \
--kind class,struct,function,enum,typedef,variable \
--scope public
- name: Build Doxygen XML (base branch)
env:
BUILD_DIR: build-base
run: |
git checkout ${{ github.event.pull_request.base.sha }}
mkdir -p "${BUILD_DIR}"
cd "${BUILD_DIR}"
cmake -Donly_docs=ON ..
cmake --build . --target docs || true
git checkout ${{ github.event.pull_request.head.sha }}
- name: Generate coverage report (base branch)
run: |
if [ -d "build-base/docs/xml" ]; then
python3 -m coverxygen \
--xml-dir build-base/docs/xml \
--src-dir . \
--output base-doc-coverage.info \
--kind class,struct,function,enum,typedef,variable \
--scope public || true
fi
- name: Check coverage thresholds
run: |
BASE_FLAG=""
if [ -f "base-doc-coverage.info" ]; then
BASE_FLAG="--base-lcov-file base-doc-coverage.info"
fi
NEW_FILES=""
if [ -n "${{ steps.new-files.outputs.added_files }}" ]; then
NEW_FILES="--new-files ${{ steps.new-files.outputs.added_files }}"
fi
python3 .github/scripts/doc-coverage-check.py \
--lcov-file doc-coverage.info \
--threshold-file .github/doc-coverage-thresholds.json \
--output doc-coverage-report.md \
${BASE_FLAG} \
${NEW_FILES} || true
- name: Post coverage report to PR
if: always()
uses: marocchino/sticky-pull-request-comment@67d0dec7b07ed060a405f9b2a64b8ab319fdd7db # v2.9.2
with:
header: doc-coverage
path: doc-coverage-report.md