feat(tcpretrans): rewrite plugin with native cilium/ebpf #8488
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: Test Retina Image | |
| on: | |
| merge_group: | |
| types: [checks_requested] | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| actions: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test-image: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: go.mod | |
| - name: Make Retina Test image | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} | |
| run: | | |
| make test-image IMAGE_NAMESPACE=${{ github.repository }} PLATFORM=linux/amd64 | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: coverage-files | |
| path: ./artifacts/coverage* | |
| - name: Generate coverage summary | |
| run: | | |
| COVERAGE_FILE="./artifacts/coverage.out" | |
| if [ ! -s "$COVERAGE_FILE" ]; then | |
| echo "::warning::Coverage file is empty or missing" | |
| echo "## Test Coverage" >> "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| echo ":warning: No coverage data available." >> "$GITHUB_STEP_SUMMARY" | |
| exit 0 | |
| fi | |
| # Filter out generated files (eBPF, mocks) | |
| grep -Ev '_bpf\.go|_bpfel_x86\.go|_bpfel_arm64\.go|_generated\.go|mock_' "$COVERAGE_FILE" > coverage_filtered.out | |
| # Generate function-level coverage report | |
| go tool cover -func=coverage_filtered.out > coverage_func.out | |
| # Extract total coverage percentage | |
| TOTAL_COVERAGE=$(grep '^total:' coverage_func.out | awk '{print $NF}') | |
| # Write step summary | |
| { | |
| echo "## Test Coverage" | |
| echo "" | |
| echo ":white_check_mark: **Tests passed**" | |
| echo "" | |
| echo "| Metric | Value |" | |
| echo "| --- | --- |" | |
| echo "| Total Coverage | \`${TOTAL_COVERAGE}\` |" | |
| echo "" | |
| echo "<details>" | |
| echo "<summary>Coverage by package (top 20 lowest)</summary>" | |
| echo "" | |
| echo '```' | |
| grep -v '^total:' coverage_func.out | sort -t'%' -k1 -n | head -20 | |
| echo '```' | |
| echo "</details>" | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| - name: Compare coverage with main branch | |
| if: github.event_name == 'pull_request' | |
| continue-on-error: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} | |
| run: | | |
| COVERAGE_FILE="./artifacts/coverage.out" | |
| if [ ! -s "$COVERAGE_FILE" ]; then | |
| echo "Coverage file is empty or missing, skipping comparison" | |
| exit 0 | |
| fi | |
| # Filter generated files and prepare current branch coverage | |
| grep -Ev '_bpf\.go|_bpfel_x86\.go|_bpfel_arm64\.go|_generated\.go|mock_' "$COVERAGE_FILE" > coveragenew.out | |
| cp coveragenew.out coverage.out | |
| go tool cover -func=coveragenew.out -o coverageexpanded.out | |
| # Install Python dependency for GitHub API calls | |
| pip install --quiet requests | |
| # Fetch main branch coverage | |
| python3 scripts/coverage/get_coverage.py | |
| # Check if main branch coverage was downloaded | |
| if [ ! -f mainbranchcoverage/coverage.out ]; then | |
| echo "No main branch coverage found, skipping comparison" | |
| exit 0 | |
| fi | |
| # Filter main branch coverage | |
| grep -Ev '_bpf\.go|_bpfel_x86\.go|_bpfel_arm64\.go|_generated\.go|mock_' mainbranchcoverage/coverage.out > mainbranchcoverage/coverage_filtered.out | |
| mv mainbranchcoverage/coverage_filtered.out mainbranchcoverage/coverage.out | |
| # Generate expanded coverage for main branch | |
| go tool cover -func=mainbranchcoverage/coverage.out -o maincoverageexpanded.out | |
| # Post PR comment with coverage diff | |
| python3 scripts/coverage/compare_cov.py |