Skip to content

Commit ac43a66

Browse files
author
Vincent Potucek
committed
[UX] add node name and icon; like junit build to improve CI UX ✅
1 parent fed07d9 commit ac43a66

File tree

3 files changed

+42
-47
lines changed

3 files changed

+42
-47
lines changed

.github/workflows/ci.yml

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,47 @@
1-
# BUILDCACHE_USER
2-
# BUILDCACHE_PASS
3-
# - rw access to buildcache.diffplug.com
4-
1+
name: CI ♻️
52
on:
63
pull_request:
74
push:
85
branches: [main, release]
96
workflow_dispatch:
10-
117
concurrency:
128
group: ${{ github.workflow }}-${{ github.ref }}
139
cancel-in-progress: true
1410
jobs:
1511
sanity-check:
16-
name: SanityCheck
12+
name: SanityCheck 🕊️
1713
runs-on: ubuntu-latest
1814
env:
1915
buildcacheuser: ${{ secrets.BUILDCACHE_USER }}
2016
buildcachepass: ${{ secrets.BUILDCACHE_PASS }}
2117
steps:
22-
- name: Checkout
18+
- name: Checkout 📥
2319
uses: actions/checkout@v6
2420
with:
2521
fetch-depth: 0
26-
- uses: actions/setup-java@v5
22+
- name: Setup Java ☕️
23+
uses: actions/setup-java@v5
2724
with:
2825
distribution: "temurin"
2926
java-version: 21
30-
- name: gradle caching
27+
- name: Gradle Caching 💾
3128
uses: gradle/actions/setup-gradle@v5
32-
- name: spotlessCheck
29+
- name: Spotless Check ✨
3330
run: ./gradlew spotlessCheck
34-
- name: rewriteDryRun
31+
- name: Rewrite Dry Run 🌀
3532
run: ./gradlew rewriteDryRun
36-
- name: assemble testClasses
33+
- name: Assemble TestClasses ⚙️
3734
run: ./gradlew assemble testClasses
3835
build:
36+
name: Build 🏗️
3937
needs: sanity-check
4038
strategy:
4139
fail-fast: false
4240
matrix:
4341
kind: [maven, gradle]
44-
# Test on the latest Java version once Gradle & Maven support it.
45-
jre: [17, 21, 24]
42+
jre: [17, 21, 24] # Test on the latest Java version once Gradle & Maven support it.
4643
os: [ubuntu-latest, windows-latest]
47-
include:
48-
# npm on linux only (crazy slow on windows)
44+
include: # npm on linux only (crazy slow on windows)
4945
- kind: npm
5046
jre: 17
5147
os: ubuntu-latest
@@ -58,36 +54,37 @@ jobs:
5854
os: ubuntu-latest
5955
runs-on: ${{ matrix.os }}
6056
steps:
61-
- name: Checkout
57+
- name: Checkout 📥
6258
uses: actions/checkout@v6
63-
- uses: actions/setup-java@v5
59+
- name: Setup Java ☕️
60+
uses: actions/setup-java@v5
6461
with:
6562
distribution: "temurin"
6663
java-version: ${{ matrix.jre }}
67-
- name: gradle caching
64+
- name: Gradle Caching 💾
6865
uses: gradle/actions/setup-gradle@v5
69-
- name: build (maven-only)
66+
- name: Build (Maven) 🏗️
7067
if: matrix.kind == 'maven'
7168
run: ./gradlew :plugin-maven:build -x spotlessCheck -x rewriteDryRun
72-
- name: build (everything-but-maven)
69+
- name: Build (Gradle) 🏗️
7370
if: matrix.kind == 'gradle'
7471
run: ./gradlew build -x spotlessCheck -x rewriteDryRun -PSPOTLESS_EXCLUDE_MAVEN=true
75-
- name: test npm
72+
- name: Test NPM 🧪
7673
if: matrix.kind == 'npm'
7774
run: ./gradlew testNpm
78-
- name: Setup go
75+
- name: Setup Go 🦫
7976
if: matrix.kind == 'shfmt'
8077
uses: actions/setup-go@v6
8178
with:
8279
go-version: 'stable'
83-
- name: Install shfmt
80+
- name: Install shfmt 🔧
8481
if: matrix.kind == 'shfmt'
8582
run: |
8683
go install mvdan.cc/sh/v3/cmd/shfmt@${{ matrix.shfmt-version }}
87-
- name: Test shfmt
84+
- name: Test shfmt 🧪
8885
if: matrix.kind == 'shfmt'
8986
run: ./gradlew testShfmt
90-
- name: Test idea
87+
- name: Test IntelliJ IDEA 🧪
9188
if: matrix.kind == 'idea'
9289
run: |
9390
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:
9794
export PATH=${PATH}:$(pwd)/bin
9895
cd ..
9996
./gradlew testIdea
100-
- name: junit result
97+
- name: Test Results 📊
10198
uses: mikepenz/action-junit-report@v6
10299
if: always() # always run even if the previous step fails
103100
with:
104-
check_name: JUnit ${{ matrix.kind }} ${{ matrix.jre }} ${{ matrix.os }}
101+
check_name: JUnit (Build 🏗 ${{ matrix.kind }}️, Java ☕️ ${{ matrix.jre }}, OS 💿 ${{ matrix.os }})
105102
report_paths: '*/build/test-results/*/TEST-*.xml'
106103
check_retries: true
107-
108-
# Status check that is required in branch protection rules.
109-
final-status:
104+
final-status: # Status check that is required in branch protection rules.
105+
name: Final Status 🎯
110106
needs:
111107
- sanity-check
112108
- build
113109
runs-on: ubuntu-latest
114110
if: always()
115111
steps:
116-
- name: Check
112+
- name: Check All Jobs ✅
117113
run: |
118114
results=$(tr -d '\n' <<< '${{ toJSON(needs.*.result) }}')
119115
if ! grep -q -v -E '(failure|cancelled)' <<< "$results"; then
120-
echo "One or more required jobs failed"
116+
echo "One or more required jobs failed"
121117
exit 1
122118
fi
123-
echo "All required jobs completed successfully."
119+
echo "All required jobs completed successfully."

gradle/spotless.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ spotless {
33
if (project != rootProject) {
44
// the rootProject doesn't have any java
55
java {
6-
ratchetFrom 'origin/main'
76
bumpThisNumberIfACustomStepChanges(1)
8-
licenseHeaderFile rootProject.file('gradle/spotless.license')
9-
importOrderFile rootProject.file('gradle/spotless.importorder')
107
eclipse().configFile rootProject.file('gradle/spotless.eclipseformat.xml')
11-
trimTrailingWhitespace()
12-
removeUnusedImports()
13-
formatAnnotations()
14-
forbidWildcardImports()
158
forbidRegex('ForbidGradleInternal', 'import org\\.gradle\\.api\\.internal\\.(.*)', "Don't use Gradle's internal API")
9+
forbidWildcardImports()
10+
formatAnnotations()
11+
importOrderFile rootProject.file('gradle/spotless.importorder')
12+
licenseHeaderFile rootProject.file('gradle/spotless.license')
13+
ratchetFrom 'origin/main'
14+
removeUnusedImports()
15+
trimTrailingWhitespace()
1616
}
1717
}
1818
groovyGradle {

lib-extra/src/main/java/com/diffplug/spotless/extra/GitRatchet.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
*/
1616
package com.diffplug.spotless.extra;
1717

18+
import static com.diffplug.spotless.FileSignature.pathNativeToUnix;
19+
import static org.eclipse.jgit.treewalk.TreeWalk.forPath;
20+
1821
import java.io.File;
1922
import java.io.IOException;
2023
import java.util.HashMap;
@@ -45,7 +48,6 @@
4548
import com.diffplug.common.base.Errors;
4649
import com.diffplug.common.collect.HashBasedTable;
4750
import com.diffplug.common.collect.Table;
48-
import com.diffplug.spotless.FileSignature;
4951

5052
/**
5153
* How to use:
@@ -57,9 +59,7 @@
5759
public abstract class GitRatchet<Project> implements AutoCloseable {
5860

5961
public boolean isClean(Project project, ObjectId treeSha, File file) throws IOException {
60-
Repository repo = repositoryFor(project);
61-
String relativePath = FileSignature.pathNativeToUnix(repo.getWorkTree().toPath().relativize(file.toPath()).toString());
62-
return isClean(project, treeSha, relativePath);
62+
return isClean(project, treeSha, pathNativeToUnix(repositoryFor(project).getWorkTree().toPath().relativize(file.toPath()).toString()));
6363
}
6464

6565
private final Map<Repository, DirCache> dirCaches = new HashMap<>();
@@ -210,8 +210,7 @@ public synchronized ObjectId subtreeShaOf(Project project, ObjectId rootTreeSha)
210210
if (repo.getWorkTree().equals(directory)) {
211211
subtreeSha = rootTreeSha;
212212
} else {
213-
String subpath = FileSignature.pathNativeToUnix(repo.getWorkTree().toPath().relativize(directory.toPath()).toString());
214-
TreeWalk treeWalk = TreeWalk.forPath(repo, subpath, rootTreeSha);
213+
TreeWalk treeWalk = forPath(repo, pathNativeToUnix(repo.getWorkTree().toPath().relativize(directory.toPath()).toString()), rootTreeSha);
215214
subtreeSha = treeWalk == null ? ObjectId.zeroId() : treeWalk.getObjectId(0);
216215
}
217216
subtreeShaCache.put(project, subtreeSha.copy());

0 commit comments

Comments
 (0)