Add CI test results summary as PR comment #2306
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: CI Run | |
| concurrency: | |
| group: pr-ci_${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| on: | |
| push: | |
| branches: | |
| - '*' | |
| tags-ignore: | |
| - v* | |
| pull_request: | |
| types: [opened, synchronize, reopened, labeled] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| actions: read | |
| jobs: | |
| check-for-pr: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| skip: ${{ steps.check.outputs.skip }} | |
| steps: | |
| - name: Check if PR exists for this branch (skip push if PR exists) | |
| id: check | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| HEAD_REF: ${{ github.ref_name }} | |
| run: | | |
| # On push events, base_ref is empty; skip if a PR already exists for this branch | |
| if [ -z "${{ github.base_ref }}" ]; then | |
| prs=$(gh pr list \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --json headRefName \ | |
| --jq "[.[] | select(.headRefName == env.HEAD_REF)] | length") | |
| if ((prs > 0)); then | |
| echo "skip=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| fi | |
| check-formatting: | |
| runs-on: ubuntu-22.04 | |
| needs: check-for-pr | |
| if: needs.check-for-pr.outputs.skip != 'true' | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup OS | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y clang-format-11 | |
| # we need this to make sure we are actually using clang-format v. 11 | |
| sudo mv /usr/bin/clang-format /usr/bin/clang-format-14 | |
| sudo mv /usr/bin/clang-format-11 /usr/bin/clang-format | |
| - name: Cache Gradle Wrapper Binaries | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.gradle/wrapper/dists | |
| key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| gradle-wrapper-${{ runner.os }}- | |
| - name: Cache Gradle User Home | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.gradle/caches | |
| key: gradle-caches-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| gradle-caches-${{ runner.os }}- | |
| - name: Check | |
| run: | | |
| ./gradlew spotlessCheck --no-daemon --parallel --build-cache --no-watch-fs | |
| check-javadoc: | |
| runs-on: ubuntu-22.04 | |
| needs: check-for-pr | |
| if: needs.check-for-pr.outputs.skip != 'true' | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup Java | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '21' | |
| - name: Setup OS | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y curl zip unzip binutils | |
| - name: Cache Gradle Wrapper Binaries | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.gradle/wrapper/dists | |
| key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| gradle-wrapper-${{ runner.os }}- | |
| - name: Cache Gradle User Home | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.gradle/caches | |
| key: gradle-caches-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| gradle-caches-${{ runner.os }}- | |
| - name: Validate Javadoc | |
| run: | | |
| # Note: javadoc task depends on copyReleaseLibs which requires building native libraries | |
| # This ensures javadoc validation matches the exact conditions used during publishing | |
| ./gradlew :ddprof-lib:javadoc --no-daemon --parallel --build-cache --no-watch-fs | |
| compute-configurations: | |
| runs-on: ubuntu-latest | |
| needs: check-for-pr | |
| if: needs.check-for-pr.outputs.skip != 'true' | |
| outputs: | |
| configurations: ${{ steps.compute.outputs.configurations }} | |
| steps: | |
| - name: Debounce label events | |
| if: github.event.action == 'labeled' | |
| run: | | |
| echo "Waiting 30s to allow adding multiple labels..." | |
| sleep 30 | |
| - name: Compute test configurations from PR labels | |
| id: compute | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Always include debug | |
| configs='["debug"' | |
| # For PRs, check labels; for push/workflow_dispatch, use debug only | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| labels=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }} --jq '.labels[].name' 2>/dev/null) || labels="" | |
| if echo "$labels" | grep -Fq "test:release"; then | |
| configs="$configs"',"release"' | |
| fi | |
| if echo "$labels" | grep -Fq "test:asan"; then | |
| configs="$configs"',"asan"' | |
| fi | |
| if echo "$labels" | grep -Fq "test:tsan"; then | |
| configs="$configs"',"tsan"' | |
| fi | |
| fi | |
| configs="$configs]" | |
| echo "configurations=$configs" >> $GITHUB_OUTPUT | |
| echo "Test configurations: $configs" | |
| test-matrix: | |
| needs: [check-for-pr, check-formatting, compute-configurations] | |
| if: needs.check-for-pr.outputs.skip != 'true' | |
| uses: ./.github/workflows/test_workflow.yml | |
| with: | |
| configuration: ${{ needs.compute-configurations.outputs.configurations }} | |
| summarize-tests: | |
| needs: [test-matrix] | |
| if: always() && github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| actions: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Generate test summary | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| .github/scripts/generate-test-summary.sh \ | |
| "${{ github.run_id }}" \ | |
| "test-summary.md" | |
| - name: Post PR comment | |
| uses: ./.github/actions/upsert-pr-comment | |
| with: | |
| body-file: test-summary.md | |
| comment-id: ci-test-results | |