Commit 967e108
authored
Optimize build and CI pipeline, remove redundant or dead code (#7560)
* Enable parallel forks for test and itest tasks
Set maxParallelForks to half the available cores for utest and itest.
Slowtest and integration test variants intentionally keep the global
default of 1 since they share data files and call Main.main() per test.
* Refactor build.gradle: update converterJar task and improve parallel test forks calculation
Signed-off-by: Vest <Vest@users.noreply.github.com>
* Remove commented-out repository declarations
Drop the dead Ivy repo for PCGen Base/Formula sourceforge jars (we now
get those from project dependencies) and the freehep maven repo, which
was already disabled and never re-enabled.
* Remove unused localOnly property and stale version comment
The localOnly property is not referenced from any Gradle script, source,
or properties file. The commented-out 6.09.06-SNAPSHOT version is
obsolete history.
* Remove calls to undefined commitFile() in release tasks
The updateVersionRelease and updateVersionToNext tasks called a
commitFile() helper that was never defined anywhere in the build,
so they would have failed at runtime. Drop the broken calls and
leave a comment that the version change should be committed manually.
* Remove dead testZip task and unused jreImage copySpec
testZip was registered but never depended on by any other task or
workflow, and jreImage was defined but never applied via copySpec.with.
Both are leftovers from the pre-jpackage distribution layout.
* Remove dead NSIS installer scaffolding from release.gradle
The NSIS-based Windows installer was retired in favor of jpackage, but
the supporting copySpecs (baseLibs, lib32, lib64, pdfLibs, basePlugins,
gmgenPlugins, nonPdfOutput, pdfOutput, baseData, optionalData), the
nsisBaseFolder/nsisOptionFolder paths, the installerVerNum derivation,
and the genDataList task that wrote installers/win-installer/data.nsh
were left behind. None of them are referenced anywhere outside
release.gradle. Drop them along with the now-unused FixCrLfFilter and
DefaultCopySpec imports.
* Remove dead programDistsImage launch4j copySpec
programDistsImage copied build/launch4j/pcgen.exe, but the launch4j
plugin was removed in favor of jpackage and that directory is never
produced. The copySpec contributed zero files to programZip and
installDist, so drop both the copySpec and its applications.
* Scope TestFX/Monocle JVM args to the test task
The TestFX/Monocle-specific flags (testfx.* sysprops, prism.order=sw,
the four --add-exports/--add-opens for monocle, prism.verbose) were
applied to every Test task via configureEach, even though only the
unit test source set (code/src/utest) contains TestFX-based tests.
itest and slowtest don't use TestFX and don't need them.
Move the TestFX-specific args onto the test task itself. Keep the
JavaFX module loading args (--module-path, --add-modules, native
access) on configureEach because the production code still requires
the JavaFX modules to be on the path for class loading.
Also drop -Dprism.verbose=true so test output stays quieter.
* Promote testcommon to a dedicated source set
code/src/testcommon was listed as a srcDir in three source sets (test,
itest, slowtest), so its 22 files were compiled three times. Extract
it into its own testcommon source set; have test/itest/slowtest
consume its compiled output via classpath instead.
Wire testcommonImplementation/RuntimeOnly/CompileOnly to extend the
matching test configurations so testcommon picks up the same JUnit and
test-helper dependencies.
* Use JUnit BOM and align platform/jupiter versions
Previously each junit-platform/junit-jupiter coordinate listed its own
version, with junit-platform-runner pinned to a stale 1.14.4 while the
others moved to 6.0.3. junit-platform-runner is for legacy
@RunWith(JUnitPlatform.class) interop and isn't used anywhere, so drop
it.
Adopt org.junit:junit-bom:6.0.3 to source the version once for all
junit-platform / junit-jupiter modules.
About 870 tests still use the JUnit 4 API. They were compiling before
because junit-platform-runner pulled junit:junit transitively. Add an
explicit junit:junit:4.13.2 declaration plus junit-vintage-engine so
those tests keep compiling and running on the JUnit Platform.
* Loop-generate per-game inttest tasks
The five per-game inttest variants (sfinttest, pfinttest, rsrdinttest,
srdinttest, msrdinttest) were copy-pasted with only the include pattern
differing. Replace them with a map-driven loop. Task names are stable
(CI references pfinttest), and the resolved configuration is identical.
Pre-existing: the include pattern uses a "slowtest/" path prefix that
doesn't exist in compiled classes, so these tasks have always reported
NO-SOURCE. Behavior is preserved here; fixing the pattern is a separate
change.
* Bump CodeQL action versions to v3 and checkout to v4
github/codeql-action v2 has been deprecated; runs emit warnings and
will fail once GitHub retires the v2 endpoints. v3 is a drop-in
upgrade for init, autobuild, and analyze. actions/checkout is bumped
to v4 to match the other workflows in this repo.
* Align release workflow cache restore-keys with primary key
The primary cache key was prefixed with \${{ runner.os }} (e.g. Linux,
macOS, Windows) while the restore-keys used \${{ matrix.os }} (e.g.
ubuntu-latest, macos-latest). Restore-keys must be a prefix of the
primary key to ever match, so the fallback restore was dead code and
every run cold-started build/jre and build/libs.
* Rename tag-triggered release workflow to disambiguate from manual
Both gradle-release.yml and gradle-release-manual.yml declared the
same workflow name "Create Release with Manual Tag", which made them
indistinguishable in the Actions UI. The manual one creates a tag on
demand; this one fires when a tag is pushed (or dispatched against an
existing tag). Renaming this one to reflect that.
* Drop redundant 'test' from PR test workflow
./gradlew build already runs the test task via the standard Java
lifecycle (build → check → test). The follow-up step then re-invoked
test alongside itest/datatest/slowtest. The re-invocation is a no-op
under up-to-date checks, but it still spins up a fresh Gradle daemon
step and clutters the run summary. Drop it and rename the step to
reflect what it actually adds.
* Drop default and harmful Gradle cache flags from PR workflow
cache-disabled: false and cache-read-only: false are setup-gradle's
defaults. cache-overwrite-existing: true is actively harmful for PR
workflows: it forces every PR run to overwrite the shared
Linux-runner Gradle cache, so concurrent PRs trash each other's
warm caches. The intended behavior on PRs is to read the cache
populated by master and write back only if the run is on the default
branch — which is exactly what setup-gradle does by default.
* Split release pipeline into stages and drop redundant tasks
The compound was:
./gradlew clean build copyToOutput test compileSlowtest \
datatest pfinttest allReports buildDist prepareRelease pcgenRelease
Several entries were already in the dependency graph of pcgenRelease:
- pcgenRelease dependsOn prepareRelease, assembleArtifacts, checksum
- prepareRelease dependsOn build
- assembleArtifacts dependsOn build, jlinkZip, sourcesJar
- sourcesJar dependsOn classes, copyToOutput, distTar, distZip, startScripts
- build (Java lifecycle) dependsOn check -> test
So build, test, copyToOutput, and prepareRelease were all redundant
when pcgenRelease was invoked at the end of the same command. The
fact that they ran first only meant Gradle short-circuited later
invocations under up-to-date checks, which still costs daemon time
and obscures the failure point if any single step fails.
The split makes each stage's purpose explicit and gives the GitHub
Actions UI a real timeline of where time is being spent.
* Collapse triple-overlapping CI cache to setup-gradle only
Each workflow stacked three caches:
1. actions/setup-java cache: gradle -> caches ~/.gradle/{caches,wrapper}
2. gradle/actions/setup-gradle@v4 -> caches ~/.gradle/{caches,wrapper,configuration-cache}
3. actions/cache@v4 for build/jre + build/libs
Layers 1 and 2 cover the same paths; setup-gradle is the canonical
choice and adds Gradle-aware features (configuration cache, dep
reports, write-once-on-default-branch semantics). Layer 3 caches
*build outputs* across runs, which:
- is unsafe (stale jars from a different commit can leak in)
- is unused (build/jre is no longer produced; the 'jre' task is a
no-op aggregator that just dependsOn downloadJavaFXMods)
- duplicates Gradle's own up-to-date checks for build/libs
Drop layers 1 and 3, keep setup-gradle. Release workflows keep their
cache-overwrite-existing: true since they run from tagged commits on
master and should refresh the shared cache.
* Attach release artifacts to GitHub Release
Both release workflows produced artifacts in build/release/ but only
uploaded a subset of them as workflow artifacts (and only for macOS),
leaving the actual GitHub Release empty. The original intent was
sketched out in commented-out softprops/action-gh-release blocks at
the bottom of gradle-release.yml.
This wires the release.gradle output (sources jar, image zips,
jpackage installers) directly to the GitHub Release using the same
tag the create_release job used. softprops/action-gh-release is
idempotent against an existing release with the same tag_name, so
each matrix OS appends its own platform-specific artifacts.
Workflow artifacts are kept too, so debugging a failed release run
still works without having to publish.
* Update README to clarify test suite commands and remove redundancy
Signed-off-by: Vest <Vest@users.noreply.github.com>
* Cache downloaded JDK and JavaFX archives in release workflows
The release pipeline downloads ~1.5 GB of cross-platform JDK and
JavaFX jmod archives on every CI run (5 platforms, on each of 4 OS
runners). The downloads are pinned by javaVersion in gradle.properties
and the URL templates in build.gradle, so they are perfectly cacheable
between runs.
Add an actions/cache@v4 step keyed on the hash of those two files, so
the cache invalidates exactly when the JDK or JavaFX version changes
and never serves stale archives otherwise. Only the archive files are
cached (.tar.gz / .zip) -- extracted JDK directories are 5x larger and
Gradle's extractJdk_* tasks have proper up-to-date checks, so we let
extraction run locally each time.
Scoped to the two release workflows; the PR test workflow does not
run jpackage and never populates jdks/.
---------
Signed-off-by: Vest <Vest@users.noreply.github.com>1 parent 0da501f commit 967e108
9 files changed
Lines changed: 154 additions & 469 deletions
File tree
- .github/workflows
- code/gradle
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
| 153 | + | |
| 154 | + | |
163 | 155 | | |
164 | 156 | | |
165 | 157 | | |
| |||
168 | 160 | | |
169 | 161 | | |
170 | 162 | | |
171 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
172 | 171 | | |
173 | 172 | | |
174 | | - | |
175 | | - | |
176 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
177 | 177 | | |
178 | | - | |
179 | | - | |
| 178 | + | |
180 | 179 | | |
181 | | - | |
182 | | - | |
183 | | - | |
| 180 | + | |
| 181 | + | |
184 | 182 | | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
190 | 191 | | |
191 | | - | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
192 | 196 | | |
193 | | - | |
194 | 197 | | |
195 | | - | |
196 | | - | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
197 | 201 | | |
198 | | - | |
199 | | - | |
200 | | - | |
| 202 | + | |
| 203 | + | |
201 | 204 | | |
202 | | - | |
203 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
| 123 | + | |
| 124 | + | |
133 | 125 | | |
134 | 126 | | |
135 | 127 | | |
| |||
138 | 130 | | |
139 | 131 | | |
140 | 132 | | |
141 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
142 | 141 | | |
143 | 142 | | |
144 | | - | |
145 | | - | |
146 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
147 | 147 | | |
148 | | - | |
149 | | - | |
| 148 | + | |
150 | 149 | | |
151 | | - | |
152 | | - | |
153 | | - | |
| 150 | + | |
| 151 | + | |
154 | 152 | | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
161 | 161 | | |
162 | | - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
163 | 166 | | |
164 | | - | |
165 | 167 | | |
166 | | - | |
167 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
168 | 171 | | |
169 | | - | |
170 | | - | |
171 | | - | |
| 172 | + | |
| 173 | + | |
172 | 174 | | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | 25 | | |
34 | | - | |
| 26 | + | |
35 | 27 | | |
36 | 28 | | |
37 | 29 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | 30 | | |
53 | 31 | | |
54 | 32 | | |
55 | 33 | | |
56 | | - | |
57 | | - | |
| 34 | + | |
| 35 | + | |
58 | 36 | | |
59 | 37 | | |
60 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
| 196 | + | |
197 | 197 | | |
198 | | - | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
199 | 202 | | |
200 | 203 | | |
201 | 204 | | |
| |||
0 commit comments