From ac43a668475e6b8aec04da20394f9b952770dd16 Mon Sep 17 00:00:00 2001 From: Vincent Potucek Date: Wed, 3 Dec 2025 14:23:10 +0100 Subject: [PATCH 1/2] =?UTF-8?q?[UX]=20add=20node=20name=20and=20icon;=20li?= =?UTF-8?q?ke=20junit=20build=20to=20improve=20CI=20UX=20=E2=9C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 64 +++++++++---------- gradle/spotless.gradle | 14 ++-- .../diffplug/spotless/extra/GitRatchet.java | 11 ++-- 3 files changed, 42 insertions(+), 47 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4557925e43..c711f92060 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,51 +1,47 @@ -# BUILDCACHE_USER -# BUILDCACHE_PASS -# - rw access to buildcache.diffplug.com - +name: CI โ™ป๏ธ on: pull_request: push: branches: [main, release] workflow_dispatch: - concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: sanity-check: - name: SanityCheck + name: SanityCheck ๐Ÿ•Š๏ธ runs-on: ubuntu-latest env: buildcacheuser: ${{ secrets.BUILDCACHE_USER }} buildcachepass: ${{ secrets.BUILDCACHE_PASS }} steps: - - name: Checkout + - name: Checkout ๐Ÿ“ฅ uses: actions/checkout@v6 with: fetch-depth: 0 - - uses: actions/setup-java@v5 + - name: Setup Java โ˜•๏ธ + uses: actions/setup-java@v5 with: distribution: "temurin" java-version: 21 - - name: gradle caching + - name: Gradle Caching ๐Ÿ’พ uses: gradle/actions/setup-gradle@v5 - - name: spotlessCheck + - name: Spotless Check โœจ run: ./gradlew spotlessCheck - - name: rewriteDryRun + - name: Rewrite Dry Run ๐ŸŒ€ run: ./gradlew rewriteDryRun - - name: assemble testClasses + - name: Assemble TestClasses โš™๏ธ run: ./gradlew assemble testClasses build: + name: Build ๐Ÿ—๏ธ needs: sanity-check strategy: fail-fast: false matrix: kind: [maven, gradle] - # Test on the latest Java version once Gradle & Maven support it. - jre: [17, 21, 24] + jre: [17, 21, 24] # Test on the latest Java version once Gradle & Maven support it. os: [ubuntu-latest, windows-latest] - include: - # npm on linux only (crazy slow on windows) + include: # npm on linux only (crazy slow on windows) - kind: npm jre: 17 os: ubuntu-latest @@ -58,36 +54,37 @@ jobs: os: ubuntu-latest runs-on: ${{ matrix.os }} steps: - - name: Checkout + - name: Checkout ๐Ÿ“ฅ uses: actions/checkout@v6 - - uses: actions/setup-java@v5 + - name: Setup Java โ˜•๏ธ + uses: actions/setup-java@v5 with: distribution: "temurin" java-version: ${{ matrix.jre }} - - name: gradle caching + - name: Gradle Caching ๐Ÿ’พ uses: gradle/actions/setup-gradle@v5 - - name: build (maven-only) + - name: Build (Maven) ๐Ÿ—๏ธ if: matrix.kind == 'maven' run: ./gradlew :plugin-maven:build -x spotlessCheck -x rewriteDryRun - - name: build (everything-but-maven) + - name: Build (Gradle) ๐Ÿ—๏ธ if: matrix.kind == 'gradle' run: ./gradlew build -x spotlessCheck -x rewriteDryRun -PSPOTLESS_EXCLUDE_MAVEN=true - - name: test npm + - name: Test NPM ๐Ÿงช if: matrix.kind == 'npm' run: ./gradlew testNpm - - name: Setup go + - name: Setup Go ๐Ÿฆซ if: matrix.kind == 'shfmt' uses: actions/setup-go@v6 with: go-version: 'stable' - - name: Install shfmt + - name: Install shfmt ๐Ÿ”ง if: matrix.kind == 'shfmt' run: | go install mvdan.cc/sh/v3/cmd/shfmt@${{ matrix.shfmt-version }} - - name: Test shfmt + - name: Test shfmt ๐Ÿงช if: matrix.kind == 'shfmt' run: ./gradlew testShfmt - - name: Test idea + - name: Test IntelliJ IDEA ๐Ÿงช if: matrix.kind == 'idea' run: | download_link=$(curl https://data.services.jetbrains.com/products/releases\?code\=IIC\&latest\=true\&type\=release | jq -r '.IIC[0].downloads.linux.link') @@ -97,27 +94,26 @@ jobs: export PATH=${PATH}:$(pwd)/bin cd .. ./gradlew testIdea - - name: junit result + - name: Test Results ๐Ÿ“Š uses: mikepenz/action-junit-report@v6 if: always() # always run even if the previous step fails with: - check_name: JUnit ${{ matrix.kind }} ${{ matrix.jre }} ${{ matrix.os }} + check_name: JUnit (Build ๐Ÿ— ${{ matrix.kind }}๏ธ, Java โ˜•๏ธ ${{ matrix.jre }}, OS ๐Ÿ’ฟ ${{ matrix.os }}) report_paths: '*/build/test-results/*/TEST-*.xml' check_retries: true - - # Status check that is required in branch protection rules. - final-status: + final-status: # Status check that is required in branch protection rules. + name: Final Status ๐ŸŽฏ needs: - sanity-check - build runs-on: ubuntu-latest if: always() steps: - - name: Check + - name: Check All Jobs โœ… run: | results=$(tr -d '\n' <<< '${{ toJSON(needs.*.result) }}') if ! grep -q -v -E '(failure|cancelled)' <<< "$results"; then - echo "One or more required jobs failed" + echo "One or more required jobs failed โŒ" exit 1 fi - echo "All required jobs completed successfully." + echo "All required jobs completed successfully. โœ…" diff --git a/gradle/spotless.gradle b/gradle/spotless.gradle index 4202d3e62b..9702525665 100644 --- a/gradle/spotless.gradle +++ b/gradle/spotless.gradle @@ -3,16 +3,16 @@ spotless { if (project != rootProject) { // the rootProject doesn't have any java java { - ratchetFrom 'origin/main' bumpThisNumberIfACustomStepChanges(1) - licenseHeaderFile rootProject.file('gradle/spotless.license') - importOrderFile rootProject.file('gradle/spotless.importorder') eclipse().configFile rootProject.file('gradle/spotless.eclipseformat.xml') - trimTrailingWhitespace() - removeUnusedImports() - formatAnnotations() - forbidWildcardImports() forbidRegex('ForbidGradleInternal', 'import org\\.gradle\\.api\\.internal\\.(.*)', "Don't use Gradle's internal API") + forbidWildcardImports() + formatAnnotations() + importOrderFile rootProject.file('gradle/spotless.importorder') + licenseHeaderFile rootProject.file('gradle/spotless.license') + ratchetFrom 'origin/main' + removeUnusedImports() + trimTrailingWhitespace() } } groovyGradle { diff --git a/lib-extra/src/main/java/com/diffplug/spotless/extra/GitRatchet.java b/lib-extra/src/main/java/com/diffplug/spotless/extra/GitRatchet.java index 76d8652b1f..7381f8890a 100644 --- a/lib-extra/src/main/java/com/diffplug/spotless/extra/GitRatchet.java +++ b/lib-extra/src/main/java/com/diffplug/spotless/extra/GitRatchet.java @@ -15,6 +15,9 @@ */ package com.diffplug.spotless.extra; +import static com.diffplug.spotless.FileSignature.pathNativeToUnix; +import static org.eclipse.jgit.treewalk.TreeWalk.forPath; + import java.io.File; import java.io.IOException; import java.util.HashMap; @@ -45,7 +48,6 @@ import com.diffplug.common.base.Errors; import com.diffplug.common.collect.HashBasedTable; import com.diffplug.common.collect.Table; -import com.diffplug.spotless.FileSignature; /** * How to use: @@ -57,9 +59,7 @@ public abstract class GitRatchet implements AutoCloseable { public boolean isClean(Project project, ObjectId treeSha, File file) throws IOException { - Repository repo = repositoryFor(project); - String relativePath = FileSignature.pathNativeToUnix(repo.getWorkTree().toPath().relativize(file.toPath()).toString()); - return isClean(project, treeSha, relativePath); + return isClean(project, treeSha, pathNativeToUnix(repositoryFor(project).getWorkTree().toPath().relativize(file.toPath()).toString())); } private final Map dirCaches = new HashMap<>(); @@ -210,8 +210,7 @@ public synchronized ObjectId subtreeShaOf(Project project, ObjectId rootTreeSha) if (repo.getWorkTree().equals(directory)) { subtreeSha = rootTreeSha; } else { - String subpath = FileSignature.pathNativeToUnix(repo.getWorkTree().toPath().relativize(directory.toPath()).toString()); - TreeWalk treeWalk = TreeWalk.forPath(repo, subpath, rootTreeSha); + TreeWalk treeWalk = forPath(repo, pathNativeToUnix(repo.getWorkTree().toPath().relativize(directory.toPath()).toString()), rootTreeSha); subtreeSha = treeWalk == null ? ObjectId.zeroId() : treeWalk.getObjectId(0); } subtreeShaCache.put(project, subtreeSha.copy()); From d5684feff55e370cc1bd13026ff1154bc26f17b7 Mon Sep 17 00:00:00 2001 From: Vincent Potucek Date: Wed, 3 Dec 2025 16:34:35 +0100 Subject: [PATCH 2/2] new step to expand java wildcard imports #2744 #2594 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c711f92060..c08e85d09e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: - name: Assemble TestClasses โš™๏ธ run: ./gradlew assemble testClasses build: - name: Build ๐Ÿ—๏ธ + name: Build ๐Ÿ— ${{ matrix.kind }}๏ธ, Java โ˜•๏ธ ${{ matrix.jre }}, OS ๐Ÿ’ฟ ${{ matrix.os }} needs: sanity-check strategy: fail-fast: false