Parallel, hierarchical, and layered execution of data-processing algorithms
[The contribution policy is currently under development.]
Except in rare circumstances, changes to the phlex repository are proposed and considered through GitHub pull requests (PRs).
Note
- Both external contributors and framework developers are expected to abide by this contribution policy.
- Even if you are a contributor with merge privileges, your PR should be reviewed by someone else before being merged into the
mainbranch.
Phlex supports comprehensive code coverage measurement using CMake's built-in coverage support:
# Configure with coverage enabled
cmake -DCMAKE_BUILD_TYPE=Coverage -DENABLE_COVERAGE=ON /path/to/phlex/source
# Build and run tests
cmake --build . -j $(nproc)
ctest -j $(nproc)
# Generate coverage reports
ninja coverage-xml # XML report for CI/Codecov
ninja coverage-html # HTML report for local viewing
ninja coverage # Basic coverage info via ctest
ninja coverage-clean # Clean coverage data filesThe coverage system:
- Uses GCC's built-in
gcovfor instrumentation - Generates reports with
gcovr(XML) andlcov(HTML) - Automatically filters to project sources only
- Handles known GCC coverage bugs gracefully
- Integrates with VS Code coverage extensions
For convenience, the scripts/coverage.sh script automates the entire coverage workflow:
# Complete workflow (recommended)
./scripts/coverage.sh all
# Individual commands
./scripts/coverage.sh setup # Configure and build with coverage
./scripts/coverage.sh test # Run tests with coverage
./scripts/coverage.sh xml # Generate XML report
./scripts/coverage.sh html # Generate HTML report
./scripts/coverage.sh view # Open HTML report in browser
./scripts/coverage.sh summary # Show coverage summary
./scripts/coverage.sh upload # Upload to Codecov
# Chain multiple commands
./scripts/coverage.sh setup test html viewImportant: Coverage data becomes stale when source files change. Always rebuild before generating reports:
./scripts/coverage.sh setup test html # Rebuild → test → generate HTMLThe script automatically:
- Detects standalone vs. multi-project build configurations
- Sources environment setup scripts (
setup-env.sh) - Detects stale instrumentation and rebuilds when needed
- Handles generated source files via temporary symlink trees
- Normalizes coverage paths for Codecov compatibility
The coverage system handles generated C/C++ files (e.g., from code generators) by:
- Creating a temporary symlink tree at
.coverage-generated/in the repository root - Mapping build-directory paths to repository-relative paths using
--path-map - Normalizing XML paths with
normalize_coverage_xml.pybefore upload
This ensures Codecov can match coverage data to the correct files in your repository.
After generating HTML coverage, the script copies lcov.info to the workspace root for VS Code extensions like Coverage Gutters. Install the extension and open any source file to see coverage indicators in the gutter.
To upload coverage manually:
# Set your token (choose one method)
export CODECOV_TOKEN='your-token'
echo 'your-token' > ~/.codecov_token && chmod 600 ~/.codecov_token
# Upload
./scripts/coverage.sh xml uploadThe upload command uses the Codecov CLI and automatically normalizes paths for repository compatibility.
The project automatically runs coverage analysis on every PR and push to main/develop branches. The workflow:
- Builds with
-DCMAKE_BUILD_TYPE=Coverage -DENABLE_COVERAGE=ON - Runs all tests via
ctest - Generates XML coverage report using
cmake --build . --target coverage-xml - Normalizes paths for generated files using
normalize_coverage_xml.py - Uploads to Codecov via
codecov/codecov-action@v4
Coverage reports are uploaded to Codecov for tracking and PR integration, with automatic comments on PRs showing coverage changes.