From af97403eb737deb550da488c97297525d9237fe6 Mon Sep 17 00:00:00 2001 From: PuppyTransGirl <74014559+PuppyTransGirl@users.noreply.github.com> Date: Thu, 19 Feb 2026 20:04:07 +0100 Subject: [PATCH 1/4] Add coverage testing --- .github/workflows/coverage.yml | 49 ++++++++++++++++++++++++++++++++++ build.gradle.kts | 18 +++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..4a51e52 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,49 @@ +name: Coverage Check + +on: + pull_request: + paths-ignore: + - ".gitignore" + - "LICENSE" + - "README.md" + - ".coderabbit.yaml" + - ".github/renovate.json" + branches: [ '**' ] + push: + paths-ignore: + - ".gitignore" + - "LICENSE" + - "README.md" + - ".coderabbit.yaml" + - ".github/renovate.json" + branches: [ 'master' ] + +jobs: + coverage: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + + - name: Set up GraalVM JDK 21 + uses: actions/setup-java@v5 + with: + java-version: 21 + distribution: 'graalvm' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v5 + + - name: Run unit tests + run: ./gradlew jacocoTestReport --refresh-dependencies + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + - name: Upload test results to Codecov + if: ${{ !cancelled() }} + uses: codecov/test-results-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: build/test-results/test/TEST-*.xml \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 625b297..d7259e4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,6 +6,7 @@ plugins { id("xyz.jpenilla.run-paper") version "3.0.2" id("com.gradleup.shadow") version "9.3.1" id("maven-publish") + id("jacoco") } val minecraftVersion: String by project @@ -84,6 +85,23 @@ tasks { } } + check { + dependsOn(jacocoTestReport) + } + + jacocoTestReport { + dependsOn(test) + reports { + xml.required.set(true) + html.required.set(true) + html.outputLocation.set(layout.buildDirectory.dir("jacocoHtml")) + } + } + + jacoco { + toolVersion = "0.8.14" + } + javadoc { isFailOnError = false options.encoding = "UTF-8" From 4f1a04e05e5a6cc52b95080f02f26c9f93656d06 Mon Sep 17 00:00:00 2001 From: PuppyTransGirl <74014559+PuppyTransGirl@users.noreply.github.com> Date: Thu, 19 Feb 2026 20:14:27 +0100 Subject: [PATCH 2/4] Test --- .github/workflows/coverage.yml | 20 +++++++++++++++++--- codecov.yml | 4 ++++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 codecov.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 4a51e52..dd11c6e 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -23,13 +23,25 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Cache Gradle + uses: actions/cache@v5 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- - name: Set up GraalVM JDK 21 uses: actions/setup-java@v5 with: + distribution: graalvm java-version: 21 - distribution: 'graalvm' + cache: gradle - name: Setup Gradle uses: gradle/actions/setup-gradle@v5 @@ -41,9 +53,11 @@ jobs: uses: codecov/codecov-action@v5 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + - name: Upload test results to Codecov if: ${{ !cancelled() }} uses: codecov/test-results-action@v1 with: token: ${{ secrets.CODECOV_TOKEN }} - files: build/test-results/test/TEST-*.xml \ No newline at end of file + files: build/test-results/test/TEST-*.xml + codecov_yml_path: ./codecov.yml \ No newline at end of file diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..7ddfe77 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,4 @@ +github_checks: true + +comment: + layout: "header, diff, flags, components" \ No newline at end of file From 06e5706b526dfb3ad53d3833579f92f22208bd1f Mon Sep 17 00:00:00 2001 From: PuppyTransGirl <74014559+PuppyTransGirl@users.noreply.github.com> Date: Thu, 19 Feb 2026 20:17:23 +0100 Subject: [PATCH 3/4] Test 2 --- .github/workflows/build-test.yml | 44 -------------------------------- .github/workflows/coverage.yml | 2 +- 2 files changed, 1 insertion(+), 45 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 2a6a4bc..2442b6a 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -20,50 +20,6 @@ on: jobs: - test: - name: Test - runs-on: ubuntu-latest - - permissions: - contents: write - checks: write - - steps: - - name: Checkout repository - uses: actions/checkout@v6 - - - name: Cache Gradle - uses: actions/cache@v5 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - name: Set up GraalVM JDK 21 - uses: actions/setup-java@v5 - with: - distribution: graalvm - java-version: 21 - cache: gradle - - - name: Make gradlew executable - run: chmod +x ./gradlew - - - name: Run Tests with Gradle - run: ./gradlew test --no-daemon --stacktrace - - - name: Report test results - uses: dorny/test-reporter@v2 - if: always() - with: - name: Gradle Tests - path: build/test-results/test/*.xml - reporter: java-junit - fail-on-error: true - build: name: Build runs-on: ubuntu-latest diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index dd11c6e..62f2a19 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -47,7 +47,7 @@ jobs: uses: gradle/actions/setup-gradle@v5 - name: Run unit tests - run: ./gradlew jacocoTestReport --refresh-dependencies + run: ./gradlew jacocoTestReport --refresh-dependencies --no-daemon - name: Upload coverage to Codecov uses: codecov/codecov-action@v5 From 86fe5873240b785f91ad41b4174e466b10a29911 Mon Sep 17 00:00:00 2001 From: PuppyTransGirl <74014559+PuppyTransGirl@users.noreply.github.com> Date: Thu, 19 Feb 2026 20:25:10 +0100 Subject: [PATCH 4/4] Test 3 --- .github/workflows/coverage.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 62f2a19..266ebc4 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -26,22 +26,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v6 - - name: Cache Gradle - uses: actions/cache@v5 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - name: Set up GraalVM JDK 21 uses: actions/setup-java@v5 with: distribution: graalvm java-version: 21 - cache: gradle - name: Setup Gradle uses: gradle/actions/setup-gradle@v5