Skip to content

Refactor archunit-maven-test build - #1751

Merged
hankem merged 5 commits into
mainfrom
refactor-archunit-maven-test-build
Oct 21, 2026
Merged

hankem merged 5 commits into
mainfrom
refactor-archunit-maven-test-build

Conversation

@hankem

@hankem hankem commented Oct 9, 2026 •

Copy link
Copy Markdown
Member
  • refactor build script to lazy task registration
  • fix publish task ordering (silently broken with 4779b3a)
  • simplify TestResultTest.assertMatchWith, show context of failure
  • redirect Maven test execution into log file (archived as build artifact) to avoid flooding the console output
  • gitignore intermediary files generated by prepareMavenTest* tasks, drop misleading comment

@schulzjo-tng schulzjo-tng self-assigned this Oct 9, 2026

@schulzjo-tng schulzjo-tng left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Very nice overall!

Comment thread archunit-maven-test/build.gradle
Comment thread archunit-maven-test/build.gradle Outdated
Comment thread archunit-maven-test/verification/TestResultTest.java
Comment thread archunit-maven-test/build.gradle Outdated
@hankem
hankem force-pushed the refactor-archunit-maven-test-build branch from d9c618f to 3d7e3ce Compare October 20, 2026 06:24
Replace the deprecated `task` DSL, eager `tasks.create` calls and `tasks.findAll` wiring
with lazy `tasks.register`, keeping the returned `TaskProvider`s in variables
and inlining the task names that were previously built as separate string locals.

`dependsOn`, `onlyIf`, `finalizedBy` and `mustRunAfter` are now set in `configure` blocks,
the aggregate `runMavenTest` depends on the per-config variants via `tasks.named`,
and the JDK log line is attached through `tasks.configureEach`
instead of eagerly realizing every task during configuration.

Signed-off-by: Manfred Hanke <Manfred.Hanke@tngtech.com>
`allprojects` within `archunit-maven-test` only contains the project itself,
so the lookup of release projects for `mustRunAfter` wiring always returned an empty list.

The lookup was correct when it was introduced in 7a1cc96,
as the code then lived in `build-steps/maven-integration-test/`
and was applied from the root project, where `allprojects` spans the whole build.
It silently broke when 4779b3a moved the build config
verbatim into the `archunit-maven-test` subproject, changing the project context of the script.

Use `rootProject.allprojects` to consider the whole build again.

Signed-off-by: Manfred Hanke <Manfred.Hanke@tngtech.com>
Signed-off-by: Manfred Hanke <Manfred.Hanke@tngtech.com>
@hankem
hankem force-pushed the refactor-archunit-maven-test-build branch 2 times, most recently from 147cee6 to 3686029 Compare October 20, 2026 07:10
Redirect `executeRules` stdout and stderr into a log file
under `verificationResultArchivePath/<config.identifier>/`,
keeping the console output limited to the echoed command.

Also print the `verifyRules` command and the `cleanUpMavenTest` copy destination
for better traceability of the Maven integration test run.

Upload the archived `verification-results/` directory
as a GitHub Actions artifact on the `integration-test` job,
so the logs and surefire XML reports remain available
when a Maven integration test fails in CI.

Signed-off-by: Manfred Hanke <Manfred.Hanke@tngtech.com>
@hankem
hankem force-pushed the refactor-archunit-maven-test-build branch from 3686029 to 4e2a44c Compare October 20, 2026 07:21
Comment thread .github/workflows/build.yml
…reMavenTest* tasks

Drop the comment asserting that `cleanUpMavenTest*` runs even when a task fails,
as `finalizedBy` only runs cleanup after a task that actually executes
– it is not a build-level `finally` block,
and may not be reached if tests fail and the build is interrupted.

Signed-off-by: Manfred Hanke <Manfred.Hanke@tngtech.com>
@hankem
hankem force-pushed the refactor-archunit-maven-test-build branch from 4e2a44c to cbb6b51 Compare October 21, 2026 06:22
@hankem
hankem enabled auto-merge October 21, 2026 06:25
@hankem
hankem merged commit 942f7f3 into main Oct 21, 2026
32 checks passed
@hankem
hankem deleted the refactor-archunit-maven-test-build branch October 21, 2026 06:30
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.

2 participants