From f4bf20791f4470d3e9b865a53b610b5f277ebb82 Mon Sep 17 00:00:00 2001 From: Sho Sakuma Date: Wed, 25 Feb 2026 22:38:19 +0900 Subject: feat: add Codecov/Jacoco integration and expand test coverage - Add Jacoco plugin to all subprojects with XML report generation - Replace post-test-results.sh with Codecov upload in CI workflow - Add codecov.yml configuration - Add 140 new tests across engine, platform-paper, and platform-velocity Co-Authored-By: Claude Opus 4.6 --- .github/scripts/post-test-results.sh | 101 ----------------------------------- .github/workflows/ci.yaml | 22 ++++---- 2 files changed, 12 insertions(+), 111 deletions(-) delete mode 100755 .github/scripts/post-test-results.sh (limited to '.github') diff --git a/.github/scripts/post-test-results.sh b/.github/scripts/post-test-results.sh deleted file mode 100755 index f8fbdf2..0000000 --- a/.github/scripts/post-test-results.sh +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/bash -set -e - -MARKER="" - -TOTAL_TESTS=0 -PASSED_TESTS=0 -FAILED_TESTS=0 -SKIPPED_TESTS=0 -FAILED_TEST_NAMES="" - -for xml_file in */build/test-results/test/*.xml; do - if [ -f "$xml_file" ]; then - tests=$(sed -n 's/.*tests="\([0-9]*\)".*/\1/p' "$xml_file" | head -n1) - failures=$(sed -n 's/.*failures="\([0-9]*\)".*/\1/p' "$xml_file" | head -n1) - skipped=$(sed -n 's/.*skipped="\([0-9]*\)".*/\1/p' "$xml_file" | head -n1) - - tests=${tests:-0} - failures=${failures:-0} - skipped=${skipped:-0} - - TOTAL_TESTS=$((TOTAL_TESTS + tests)) - FAILED_TESTS=$((FAILED_TESTS + failures)) - SKIPPED_TESTS=$((SKIPPED_TESTS + skipped)) - - if [ "$failures" -gt 0 ]; then - failed_names=$(sed -n 's/.* -" -fi - -COMMENT_BODY="${COMMENT_BODY} - ---- -*Updated at $(date -u '+%Y-%m-%d %H:%M:%S UTC')*" - -echo "$COMMENT_BODY" > /tmp/test-comment.md - -PR_NUMBER="${GITHUB_REF#refs/pull/}" -PR_NUMBER="${PR_NUMBER%/merge}" - -if [ -z "$PR_NUMBER" ] || [ "$PR_NUMBER" = "$GITHUB_REF" ]; then - echo "Not a pull request, skipping comment" - exit 0 -fi - -EXISTING_COMMENT_ID=$(gh api \ - "repos/$GITHUB_REPOSITORY/issues/${PR_NUMBER}/comments" \ - --jq ".[] | select(.body | contains(\"$MARKER\")) | .id" \ - | head -n 1 || echo "") - -if [ -n "$EXISTING_COMMENT_ID" ]; then - echo "Updating existing comment (ID: $EXISTING_COMMENT_ID)" - gh api \ - "repos/$GITHUB_REPOSITORY/issues/comments/${EXISTING_COMMENT_ID}" \ - -X PATCH \ - -f body="$(cat /tmp/test-comment.md)" -else - echo "Creating new comment" - gh pr comment "$PR_NUMBER" --body-file /tmp/test-comment.md -fi - -echo "Test results comment posted successfully" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2f3a9e8..7ab33b6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,16 +29,18 @@ jobs: run: ./gradlew ktlintCheck --no-daemon - name: Run tests - run: ./gradlew test --no-daemon - continue-on-error: true - - - name: Post test results to PR - if: github.event_name == 'pull_request' && always() - env: - GH_TOKEN: ${{ github.token }} - GITHUB_REPOSITORY: ${{ github.repository }} - GITHUB_REF: ${{ github.ref }} - run: .github/scripts/post-test-results.sh + run: ./gradlew test jacocoTestReport --no-daemon + + - name: Upload coverage to Codecov + if: always() + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: | + engine/build/reports/jacoco/test/jacocoTestReport.xml, + platform-paper/build/reports/jacoco/test/jacocoTestReport.xml, + platform-velocity/build/reports/jacoco/test/jacocoTestReport.xml + fail_ci_if_error: false - name: Build with shadowJar run: ./gradlew :platform-paper:shadowJar :platform-velocity:shadowJar --parallel --no-daemon -- cgit v1.2.1