chore(deps): remove OpenSSL 1.1.1 fallback, require OpenSSL 3.0+ #539
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Code Coverage | |
| on: | |
| push: | |
| branches: [ main, phase-* ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| coverage: | |
| name: Coverage Analysis | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout database_system | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Checkout common_system | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: kcenon/common_system | |
| path: common_system | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| # Use GCC 13 for full C++20 std::format support | |
| sudo apt-get install -y cmake ninja-build g++-13 libgtest-dev libgmock-dev lcov pkg-config | |
| - name: Build and install common_system | |
| run: | | |
| cd common_system | |
| cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DUSE_UNIT_TEST=OFF \ | |
| -DCMAKE_C_COMPILER=gcc-13 -DCMAKE_CXX_COMPILER=g++-13 | |
| cmake --build build --config Release | |
| sudo cmake --install build --prefix /usr/local | |
| - name: Configure CMake with coverage | |
| run: | | |
| cmake -B build -G Ninja \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DCMAKE_C_COMPILER=gcc-13 \ | |
| -DCMAKE_CXX_COMPILER=g++-13 \ | |
| -DCMAKE_CXX_FLAGS="--coverage -fprofile-arcs -ftest-coverage" \ | |
| -DCMAKE_C_FLAGS="--coverage -fprofile-arcs -ftest-coverage" \ | |
| -DALLOW_BUILD_WITHOUT_NETWORK_SYSTEM=ON \ | |
| -DUSE_UNIT_TEST=ON \ | |
| -DBUILD_DATABASE_SAMPLES=ON \ | |
| -DDATABASE_BUILD_INTEGRATION_TESTS=OFF \ | |
| -DUSE_POSTGRESQL=OFF | |
| - name: Build with coverage | |
| run: cmake --build build --config Debug | |
| - name: Run tests | |
| timeout-minutes: 5 | |
| run: | | |
| cd build | |
| # Run tests with timeout to prevent hanging | |
| ctest -C Debug --output-on-failure --timeout 30 || true | |
| - name: Generate coverage report | |
| run: | | |
| cd build | |
| # Capture coverage data | |
| # Ubuntu 22.04 lcov 1.14 only supports --ignore-errors source | |
| lcov --directory . --capture --output-file coverage.info --ignore-errors source --rc lcov_branch_coverage=0 2>/dev/null || \ | |
| lcov --directory . --capture --output-file coverage.info 2>/dev/null || true | |
| # Filter out system headers and test files | |
| if [ -f coverage.info ]; then | |
| lcov --remove coverage.info '/usr/*' '*/test/*' '*/tests/*' '*/examples/*' '*/samples/*' '*/googletest/*' \ | |
| --output-file coverage_filtered.info --ignore-errors source 2>/dev/null || true | |
| # Generate HTML report | |
| if [ -f coverage_filtered.info ]; then | |
| genhtml coverage_filtered.info --output-directory coverage_html --ignore-errors source 2>/dev/null || \ | |
| echo "⚠️ HTML coverage report generation skipped" | |
| # Print summary | |
| lcov --list coverage_filtered.info --ignore-errors source 2>/dev/null || \ | |
| echo "⚠️ Coverage summary generation skipped" | |
| fi | |
| else | |
| echo "⚠️ Coverage data file not created" | |
| fi | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./build/coverage_filtered.info | |
| flags: unittests | |
| name: database_system-coverage | |
| fail_ci_if_error: false | |
| verbose: true | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Upload coverage artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: | | |
| build/coverage.info | |
| build/coverage_filtered.info | |
| build/coverage_html/ | |
| retention-days: 7 | |
| - name: Check coverage threshold (80%) | |
| id: coverage-check | |
| run: | | |
| if [ -f build/coverage_filtered.info ]; then | |
| # Extract line coverage percentage | |
| COVERAGE=$(lcov --summary build/coverage_filtered.info 2>&1 | grep "lines" | grep -oP '\d+\.\d+%' | head -1 | tr -d '%') | |
| echo "Line coverage: ${COVERAGE}%" | |
| echo "coverage=${COVERAGE}" >> $GITHUB_OUTPUT | |
| # Check if coverage meets threshold (80%) | |
| if (( $(echo "$COVERAGE >= 80" | bc -l) )); then | |
| echo "Coverage check PASSED: ${COVERAGE}% >= 80%" | |
| echo "status=passed" >> $GITHUB_OUTPUT | |
| else | |
| echo "::warning::Coverage check FAILED: ${COVERAGE}% < 80%" | |
| echo "status=failed" >> $GITHUB_OUTPUT | |
| # Don't fail the build yet - just warn | |
| fi | |
| else | |
| echo "status=skipped" >> $GITHUB_OUTPUT | |
| echo "::warning::Coverage data not available" | |
| fi | |
| - name: Coverage summary | |
| if: always() | |
| run: | | |
| echo "## Coverage Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ -f build/coverage_filtered.info ]; then | |
| echo "Coverage data collected successfully." >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Metric | Value |" >> $GITHUB_STEP_SUMMARY | |
| echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY | |
| echo "| Line Coverage | ${{ steps.coverage-check.outputs.coverage }}% |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Threshold | 80% |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Status | ${{ steps.coverage-check.outputs.status }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ "${{ steps.coverage-check.outputs.status }}" = "failed" ]; then | |
| echo "**Warning:** Coverage is below the 80% threshold." >> $GITHUB_STEP_SUMMARY | |
| fi | |
| else | |
| echo "No coverage data generated." >> $GITHUB_STEP_SUMMARY | |
| fi |