refactor(internal): move implementation headers to src/internal/ #692
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: Benchmarks | ||
| on: | ||
| push: | ||
| branches: [ main, phase-* ] | ||
| paths: | ||
| - 'benchmarks/**' | ||
| - 'src/**' | ||
| - 'include/**' | ||
| - '.github/workflows/benchmarks.yml' | ||
| pull_request: | ||
| branches: [ main ] | ||
| paths: | ||
| - 'benchmarks/**' | ||
| - 'src/**' | ||
| - 'include/**' | ||
| - '.github/workflows/benchmarks.yml' | ||
| workflow_dispatch: | ||
| inputs: | ||
| save_baseline: | ||
| description: 'Save as baseline' | ||
| required: false | ||
| default: 'false' | ||
| jobs: | ||
| benchmark: | ||
| name: Run Performance Benchmarks | ||
| runs-on: ${{ matrix.os }} | ||
| timeout-minutes: 30 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-24.04, macos-15] | ||
| compiler: [clang] | ||
| build_type: [Release] | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 # Full history for comparison | ||
| - name: Checkout common_system | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: kcenon/common_system | ||
| path: common_system | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Install dependencies (Ubuntu) | ||
| if: runner.os == 'Linux' | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y cmake ninja-build clang libbenchmark-dev libgtest-dev libfmt-dev libasio-dev | ||
| - name: Install dependencies (macOS) | ||
| if: runner.os == 'macOS' | ||
| run: | | ||
| brew install ninja google-benchmark googletest fmt asio | ||
| - name: Set up compiler | ||
| run: | | ||
| echo "CC=clang" >> $GITHUB_ENV | ||
| echo "CXX=clang++" >> $GITHUB_ENV | ||
| - name: Build common_system dependency | ||
| run: | | ||
| cd common_system | ||
| cmake -B build -G Ninja \ | ||
| -DCMAKE_BUILD_TYPE=Release \ | ||
| -DBUILD_TESTS=OFF \ | ||
| -DBUILD_EXAMPLES=OFF \ | ||
| -DBUILD_SAMPLES=OFF | ||
| cmake --build build | ||
| cmake --install build --prefix ${{ github.workspace }}/deps/install | ||
| - name: Configure CMake | ||
| run: | | ||
| cmake -B build -S . \ | ||
| -GNinja \ | ||
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | ||
| -DCMAKE_PREFIX_PATH=${{ github.workspace }}/deps/install \ | ||
| -DNETWORK_BUILD_BENCHMARKS=ON \ | ||
| -DBUILD_WITH_COMMON_SYSTEM=ON \ | ||
| -DBUILD_WITH_LOGGER_SYSTEM=OFF \ | ||
| -DBUILD_WITH_THREAD_SYSTEM=OFF \ | ||
| -DBUILD_WITH_CONTAINER_SYSTEM=OFF \ | ||
| -DBUILD_MESSAGING_BRIDGE=OFF \ | ||
| -DBUILD_TESTS=OFF \ | ||
| -DBUILD_SAMPLES=OFF | ||
| - name: Build benchmarks | ||
| run: cmake --build build --config ${{ matrix.build_type }} --target network_benchmarks -j | ||
| - name: Run benchmarks | ||
| run: | | ||
| cd build/benchmarks | ||
| # Exclude HTTP benchmarks in CI due to network timing issues | ||
| # HTTP benchmarks can be run manually for performance analysis | ||
| ./network_benchmarks \ | ||
| --benchmark_format=json \ | ||
| --benchmark_out=benchmark_results_${{ matrix.os }}.json \ | ||
| --benchmark_repetitions=3 \ | ||
| --benchmark_report_aggregates_only=true \ | ||
| --benchmark_filter="-HTTP_" | ||
| - name: Run benchmarks (console output) | ||
| run: | | ||
| cd build/benchmarks | ||
| ./network_benchmarks \ | ||
| --benchmark_filter="Message_Create|Connection_Create|Session_Create" \ | ||
| --benchmark_repetitions=3 | ||
| - name: Upload benchmark results | ||
| uses: actions/upload-artifact@v4 | ||
| continue-on-error: true | ||
| with: | ||
| name: benchmark-results-${{ matrix.os }} | ||
| path: build/benchmarks/benchmark_results_${{ matrix.os }}.json | ||
| retention-days: 30 | ||
| - name: Save baseline (if requested) | ||
| if: github.event.inputs.save_baseline == 'true' && github.ref == 'refs/heads/main' | ||
| run: | | ||
| mkdir -p benchmarks/baselines | ||
| cp build/benchmarks/benchmark_results_${{ matrix.os }}.json \ | ||
| benchmarks/baselines/baseline_${{ matrix.os }}_$(date +%Y%m%d).json | ||
| - name: Compare with baseline (if exists) | ||
| if: hashFiles('benchmarks/baselines/baseline_${{ matrix.os }}_*.json') != '' | ||
|
Check warning on line 131 in .github/workflows/benchmarks.yml
|
||
| run: | | ||
| echo "Comparing with baseline..." | ||
| # Create virtual environment for Python dependencies (PEP 668 compliance) | ||
| python3 -m venv .venv | ||
| source .venv/bin/activate | ||
| pip install scipy | ||
| # Find latest baseline | ||
| BASELINE=$(ls -t benchmarks/baselines/baseline_${{ matrix.os }}_*.json | head -1) | ||
| if [ -f "$BASELINE" ]; then | ||
| echo "Baseline: $BASELINE" | ||
| echo "Current: build/benchmarks/benchmark_results_${{ matrix.os }}.json" | ||
| # Download compare.py | ||
| curl -O https://raw.githubusercontent.com/google/benchmark/main/tools/compare.py | ||
| chmod +x compare.py | ||
| # Run comparison | ||
| python3 compare.py \ | ||
| "$BASELINE" \ | ||
| build/benchmarks/benchmark_results_${{ matrix.os }}.json | ||
| fi | ||
| deactivate | ||
| - name: Check for performance regression | ||
| run: | | ||
| echo "Performance regression detection: TBD" | ||
| echo "Will be implemented in Phase 1 with baseline establishment" | ||
| report: | ||
| name: Generate Benchmark Report | ||
| needs: benchmark | ||
| runs-on: ubuntu-24.04 | ||
| if: always() | ||
| steps: | ||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@v4 | ||
| - name: Generate summary | ||
| run: | | ||
| echo "# Benchmark Results Summary" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "## Phase 0: Baseline Measurement" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| for dir in benchmark-results-*; do | ||
| if [ -d "$dir" ]; then | ||
| echo "### $dir" >> $GITHUB_STEP_SUMMARY | ||
| if [ -f "$dir/benchmark_results_"*.json ]; then | ||
| echo "✅ Benchmarks completed" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| else | ||
| echo "❌ No results found" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| fi | ||
| fi | ||
| done | ||
| echo "## Next Steps" >> $GITHUB_STEP_SUMMARY | ||
| echo "- Review benchmark results" >> $GITHUB_STEP_SUMMARY | ||
| echo "- Document baseline in docs/BASELINE.md" >> $GITHUB_STEP_SUMMARY | ||
| echo "- Set performance targets for Phase 1" >> $GITHUB_STEP_SUMMARY | ||