From f2c8479bbb0e0e7acbea5d2bcd7ea60d4f05c768 Mon Sep 17 00:00:00 2001 From: Peter Gafert Date: Sun, 10 Dec 2023 17:33:35 +0100 Subject: [PATCH 1/4] remove legacy Windows CI related config Before GitHub offered Windows runners we had to use Jenkins from time to time to run the tests on Windows slaves. This hasn't been used anymore for years and I don't see any reason to maintain this anymore. Signed-off-by: Peter Gafert --- .../archunit.java-testing-conventions.gradle | 2 - ci/Dockerfile | 11 --- ci/README.md | 36 --------- ci/docker-compose.yml | 9 --- ci/jobs/archunit-win/config.xml | 71 ------------------ ci/nodes/WindowsSlave/config.xml | 43 ----------- ci/plugins.txt | 74 ------------------- ci/security.groovy | 17 ----- 8 files changed, 263 deletions(-) delete mode 100644 ci/Dockerfile delete mode 100644 ci/README.md delete mode 100644 ci/docker-compose.yml delete mode 100644 ci/jobs/archunit-win/config.xml delete mode 100644 ci/nodes/WindowsSlave/config.xml delete mode 100644 ci/plugins.txt delete mode 100644 ci/security.groovy diff --git a/buildSrc/src/main/groovy/archunit.java-testing-conventions.gradle b/buildSrc/src/main/groovy/archunit.java-testing-conventions.gradle index b2aa314eea..2d65a44a87 100644 --- a/buildSrc/src/main/groovy/archunit.java-testing-conventions.gradle +++ b/buildSrc/src/main/groovy/archunit.java-testing-conventions.gradle @@ -39,8 +39,6 @@ tasks.withType(Test) { events "failed" exceptionFormat "full" } - - ignoreFailures = project.hasProperty('ignoreTestFailures') } // Add some better test failure reporting on the console diff --git a/ci/Dockerfile b/ci/Dockerfile deleted file mode 100644 index 3b63bd3004..0000000000 --- a/ci/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM jenkins/jenkins:lts - -ENV JAVA_OPTS="-Djenkins.install.runSetupWizard=false" - -COPY security.groovy /usr/share/jenkins/ref/init.groovy.d/security.groovy - -COPY plugins.txt /usr/share/jenkins/ref/plugins.txt -RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt - -COPY nodes/ /usr/share/jenkins/ref/nodes/ -COPY jobs/ /usr/share/jenkins/ref/jobs/ \ No newline at end of file diff --git a/ci/README.md b/ci/README.md deleted file mode 100644 index d26313910e..0000000000 --- a/ci/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# CI configurations - -This is a very simple and INSECURE docker configuration to quickly set up a Jenkins build against -a remote Windows slave for ArchUnit master. - -## Preconditions - -On the windows slave, install and then copy - -* JDK 8 (http://www.oracle.com/technetwork/java/javase/downloads/index.html) - * -copy-> c:\jenkins\jdk -* Git (https://git-scm.com/download/win) - * -copy-> c:\jenkins\Git - -## How to run it - -Start the Jenkins master via - -``` -docker-compose up -``` - -Then login (admin:admin) and either access - -``` -localhost:8080/computer/WindowsSlave -``` - -and execute the displayed command at the windows slave, or -on the windows slave access the Jenkins node - -``` -$JENKINS_URL:8080/computer/WindowsSlave -``` - -and click the Java Webstart button. \ No newline at end of file diff --git a/ci/docker-compose.yml b/ci/docker-compose.yml deleted file mode 100644 index 45af5ab393..0000000000 --- a/ci/docker-compose.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: "3.0" - -services: - jenkins: - build: . - image: archunit/jenkins-win:latest - ports: - - 8080:8080 - - 50000:50000 diff --git a/ci/jobs/archunit-win/config.xml b/ci/jobs/archunit-win/config.xml deleted file mode 100644 index 3788635127..0000000000 --- a/ci/jobs/archunit-win/config.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - false - - - 2 - - - https://github.com/TNG/ArchUnit.git - - - - - */main - - - false - - - - win - false - false - false - false - - - H/5 * * * * - false - - - false - - - - --no-daemon -PallTests -PignoreTestFailures clean build - - - (Default) - true - false - false - - false - - false - - - - - **/test/**/*.xml - false - 1.0 - false - - - peter.gafert+archunit-win@tngtech.com - false - false - - - - - false - - - - - diff --git a/ci/nodes/WindowsSlave/config.xml b/ci/nodes/WindowsSlave/config.xml deleted file mode 100644 index 4c520bb7d7..0000000000 --- a/ci/nodes/WindowsSlave/config.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - WindowsSlave - - c:\jenkins - 1 - NORMAL - - - - false - remoting - false - - - - - - - - - - - - 2 - JAVA_HOME - c:\jenkins\jdk - JAVA_TOOL_OPTIONS - -Dfile.encoding=UTF8 - - - - - - - hudson.plugins.git.GitTool$DescriptorImpl - Default - c:\jenkins\Git\bin\git.exe - - - - - diff --git a/ci/plugins.txt b/ci/plugins.txt deleted file mode 100644 index 1e403fa052..0000000000 --- a/ci/plugins.txt +++ /dev/null @@ -1,74 +0,0 @@ -script-security -command-launcher -bouncycastle-api -structs -workflow-step-api -scm-api -workflow-api -workflow-support -workflow-job -token-macro -build-timeout -credentials -ssh-credentials -plain-credentials -credentials-binding -timestamper -durable-task -workflow-durable-task-step -junit -matrix-project -resource-disposer -ws-cleanup -gradle -pipeline-milestone-step -jquery-detached -jackson2-api -ace-editor -workflow-scm-step -workflow-cps -pipeline-input-step -pipeline-stage-step -pipeline-graph-analysis -pipeline-rest-api -handlebars -momentjs -pipeline-stage-view -pipeline-build-step -pipeline-model-api -pipeline-model-extensions -apache-httpcomponents-client-4-api -windows-slaves -display-url-api -mailer -matrix-auth -antisamy-markup-formatter -jsch -git-client -cloudbees-folder -git-server -workflow-cps-global-lib -branch-api -workflow-multibranch -authentication-tokens -docker-commons -docker-workflow -pipeline-stage-tags-metadata -pipeline-model-declarative-agent -workflow-basic-steps -pipeline-model-definition -workflow-aggregator -github-api -git -github -github-branch-source -pipeline-github-lib -ssh-slaves -email-ext -htmlpublisher -javadoc -maven-plugin -analysis-core -warnings -conditional-buildstep -run-condition diff --git a/ci/security.groovy b/ci/security.groovy deleted file mode 100644 index 675310de86..0000000000 --- a/ci/security.groovy +++ /dev/null @@ -1,17 +0,0 @@ -#!groovy - -import jenkins.model.* -import hudson.security.* -import jenkins.security.s2m.AdminWhitelistRule - -def instance = Jenkins.getInstance() - -def hudsonRealm = new HudsonPrivateSecurityRealm(false) -hudsonRealm.createAccount("admin", "admin") -instance.setSecurityRealm(hudsonRealm) - -def strategy = new FullControlOnceLoggedInAuthorizationStrategy() -instance.setAuthorizationStrategy(strategy) -instance.save() - -Jenkins.instance.getInjector().getInstance(AdminWhitelistRule.class).setMasterKillSwitch(false) From 5a8f5e5b64848007e2487ca91c520c256a92b248 Mon Sep 17 00:00:00 2001 From: Peter Gafert Date: Sun, 10 Dec 2023 23:02:42 +0100 Subject: [PATCH 2/4] add `sourceSets.main.output` to classpath of `jdk9main` Strangely this still worked in many cases, even though `jdk9main` is depending on the output of the regular `main` source set, since it's reusing some of the code. When I tried to run `./gradlew test` alone now, `:archunit:compileJdk9mainJava` constantly failed unless this setting was fixed. Signed-off-by: Peter Gafert --- archunit/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archunit/build.gradle b/archunit/build.gradle index 4754ef02b0..c61fa271ae 100644 --- a/archunit/build.gradle +++ b/archunit/build.gradle @@ -61,7 +61,7 @@ sourceSets { java { srcDirs = jdk9MainDirs } - compileClasspath += sourceSets.main.compileClasspath + compileClasspath += sourceSets.main.compileClasspath + sourceSets.main.output.classesDirs } jdk9test { java { From d8a9077da4252392ee19666f58459c6a30ad5a35 Mon Sep 17 00:00:00 2001 From: Peter Gafert Date: Sun, 24 Mar 2024 19:47:09 +0100 Subject: [PATCH 3/4] fix JUnit 5 tests not being executed in CI When migrating the build configuration to plugins, we accidentally disabled JUnit 5 tests being executed during CI. Since we don't have many such tests and nothing ever broke there, this went unnoticed until now. The reason is that there is a generic piece of configuration in `java-testing-conventions.gradle` that reacts to `archUnitTest.hasSlowTests == true`, and if `true` and the property `allTests` not set, configures JUnit 4 to exclude the Category `Slow`. Unfortunately, this also switches the test execution completely back to JUnit 4, disabling any JUnit 5 tests to be run. And since we configure this in `afterEvaluate`, it actually overwrites the test configuration of the concrete module. Ironically, we don't even have any `Slow` tests in modules where we use JUnit 5. Thus, we can simply disable `archUnitTest.hasSlowTests` for those. We include a check for now to make sure that this will never be set again for modules that contain JUnit 5 tests. Signed-off-by: Peter Gafert --- archunit-junit/junit5/engine-api/build.gradle | 4 ---- archunit-junit/junit5/engine/build.gradle | 4 ---- .../src/main/groovy/archunit.java-testing-conventions.gradle | 1 + 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/archunit-junit/junit5/engine-api/build.gradle b/archunit-junit/junit5/engine-api/build.gradle index efc8b2837d..bbf58faf51 100644 --- a/archunit-junit/junit5/engine-api/build.gradle +++ b/archunit-junit/junit5/engine-api/build.gradle @@ -23,10 +23,6 @@ dependencies { compileJava.dependsOn project(':archunit-junit5-api').finishArchive -archUnitTest { - hasSlowTests = true -} - test { useJUnitPlatform() { excludeEngines 'archunit' diff --git a/archunit-junit/junit5/engine/build.gradle b/archunit-junit/junit5/engine/build.gradle index 341f9d5adf..aa64573444 100644 --- a/archunit-junit/junit5/engine/build.gradle +++ b/archunit-junit/junit5/engine/build.gradle @@ -37,10 +37,6 @@ sourcesJar { from project(':archunit-junit').sourceSets.main.allSource } -archUnitTest { - hasSlowTests = true -} - test { useJUnitPlatform() { excludeEngines 'archunit' diff --git a/buildSrc/src/main/groovy/archunit.java-testing-conventions.gradle b/buildSrc/src/main/groovy/archunit.java-testing-conventions.gradle index 2d65a44a87..4d3090ced3 100644 --- a/buildSrc/src/main/groovy/archunit.java-testing-conventions.gradle +++ b/buildSrc/src/main/groovy/archunit.java-testing-conventions.gradle @@ -23,6 +23,7 @@ afterEvaluate { if (archUnitTest.hasSlowTests) { tasks.withType(Test) { + assert !it.testFramework.class.name.contains('JUnitPlatform'): "Slow tests are not yet supported for JUnit 5 tests" if (!project.hasProperty('allTests')) { useJUnit { excludeCategories 'com.tngtech.archunit.Slow' From 96d38be094438f50fde9aa8af10110cc5084e4eb Mon Sep 17 00:00:00 2001 From: Peter Gafert Date: Sun, 24 Mar 2024 19:48:40 +0100 Subject: [PATCH 4/4] remove slow test configuration for `archunit-junit4` We don't have any slow tests in this module, so we don't need any slow test configuration. Signed-off-by: Peter Gafert --- archunit-junit/junit4/build.gradle | 4 ---- 1 file changed, 4 deletions(-) diff --git a/archunit-junit/junit4/build.gradle b/archunit-junit/junit4/build.gradle index 894575fac4..b9dabb1e86 100644 --- a/archunit-junit/junit4/build.gradle +++ b/archunit-junit/junit4/build.gradle @@ -40,10 +40,6 @@ sourcesJar { } } -archUnitTest { - hasSlowTests = true -} - shadowJar { exclude 'META-INF/**'