publish-plugin icon indicating copy to clipboard operation
publish-plugin copied to clipboard

Build on latest Java, test through lowest possible - approach 2

Open szpak opened this issue 2 years ago • 1 comments

This is a reworked variant of #254 (I really liked the approach with overriding javaLauncher for test @TWiStErRob! - originally I wanted to publish binaries locally and pass it to another jobs, which javaLauncher is much easier) with the following changes:

  • e2e tests are executed as before with the latest JDK version (to do not put pressure on Sonatype Nexus)
  • compatibility tests are executed also with JDK 8 (even if built with higher JDK) - sample failure generated on CI on purpose:

Caused by: java.lang.UnsupportedClassVersionError: io/github/gradlenexus/publishplugin/TaskOrchestrationTest has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0


This is not as reliable as separate e2eTests executed with lower JDK, but the binaries are built with higher JDK and running tests leverages that binaries.

Downsides:

  • no way to use test libraries requiring JDK 11+ (e.g. newer Mockito versions)
  • more jobs with compatibility tests on CI
  • slightly more complicated stutter configuration (compatTestJavaauto added)
  • problem with stutter configuration if Gradle drops JDK 8 support (even in toolchain, which is probably not planned yet)
  • ?

Maybe you will have an idea how to improve it further.

szpak avatar Jan 16 '24 22:01 szpak

I'm yet to do a full review, thanks for looking @3flex !

TWiStErRob avatar Jan 20 '24 11:01 TWiStErRob