Skip to content

Repair the Gradle test suite and run it on PRs - #1

Closed
grepsedawk wants to merge 157 commits into
mainfrom
fix-test-suite
Closed

Repair the Gradle test suite and run it on PRs#1
grepsedawk wants to merge 157 commits into
mainfrom
fix-test-suite

Conversation

@grepsedawk

Copy link
Copy Markdown
Owner

Summary

Test the CI workflow added in this branch before opening upstream.

The substantive change wires up the Gradle test suite end to end:

  • Enables useJUnitPlatform() once at the parent so every plugin inherits it
  • Bumps JUnit to 6.0.3 with the platform launcher pinned to the same ref
  • Adds MockBukkit + a strippedMappedServerJar workaround for civmodcore-paper so its long-broken ItemMetaTests runs again
  • Adds CI test reporting (mikepenz/action-junit-report), HTML report upload on failure, and a paperweight cache step

Test plan

  • First push: cache miss → confirm full paperweight setup runs (~minutes), then warm cache populates
  • Re-push: confirm Cache paperweight step restores from key, paperweight setup is faster
  • Confirm JUnit Test Report check appears on the PR with passing tests
  • Temporarily break a test, push, confirm the failed-test annotation surfaces and the test-reports artifact uploads; revert
  • Verify the workflow turns green on this branch before opening the upstream PR

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces JUnit 5 and MockBukkit to the project, providing a testing framework and a way to mock the Bukkit/Paper runtime. It includes a custom Gradle task to strip conflicting ServiceLoader providers from the Paper server jar to ensure compatibility with MockBukkit. Review feedback identifies that the JUnit version specified (6.0.3) is invalid and should be corrected to compatible Jupiter and Platform versions. Additionally, suggestions were made to improve Gradle configuration by avoiding eager provider evaluation to preserve configuration caching and using more precise file patterns for JAR exclusions.

Comment thread gradle/libs.versions.toml
Comment thread gradle/libs.versions.toml
Comment thread plugins/civmodcore-paper/build.gradle.kts Outdated
Comment thread plugins/civmodcore-paper/build.gradle.kts Outdated
@grepsedawk
grepsedawk force-pushed the fix-test-suite branch 5 times, most recently from 1de4174 to 086aee7 Compare April 20, 2026 00:28
The test suite was effectively dead. useJUnitPlatform() was never
configured in the parent plugins/build.gradle.kts, so every plugin's
test task discovered zero tests and reported BUILD SUCCESSFUL even
when src/test/ contained real JUnit 5 tests. The pinned JUnit (5.8.2)
also fell out of alignment with the platform launcher Gradle ships,
which would have failed discovery once useJUnitPlatform() was added
anyway.

This change enables useJUnitPlatform() once at the parent so every
plugin inherits it. JUnit is bumped to 6.0.3 with the platform launcher
pinned to the same version ref so the engine and launcher stay aligned.

The Check All workflow now publishes a JUnit report and uploads the
HTML test results on failure, so PR authors can see what broke without
re-running the build locally. A paperweight cache step keeps
paper-server from being regenerated on every PR run.

civmodcore-paper adopts MockBukkit per the supported pattern at
https://docs.mockbukkit.org/docs/en/user_guide/advanced/paperweight,
which sets paperweight's addServerDependencyTo to compileOnly so the
mojang-mapped server jar stays off the test classpath and MockBukkit
owns it. NBTTests is removed because it depends on net.minecraft.*
classes that the supported pattern intentionally excludes; the file
had been broken since it was written. testBaseComponent stays
disabled because its legacy/Adventure display-name assertion no
longer holds in current Paper.

civmodcore-paper is now a working baseline that other plugins can
build off of when adding tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants