Skip to content

Commit 3e471aa

Browse files
author
Vincent Potucek
committed
[UX] add icons like junit build to improve CI UX ✅
1 parent fed07d9 commit 3e471aa

File tree

3 files changed

+55
-37
lines changed

3 files changed

+55
-37
lines changed

.github/workflows/ci.yml

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# BUILDCACHE_USER
2-
# BUILDCACHE_PASS
3-
# - rw access to buildcache.diffplug.com
1+
name: CI ♻️
42

53
on:
64
pull_request:
@@ -11,30 +9,38 @@ on:
119
concurrency:
1210
group: ${{ github.workflow }}-${{ github.ref }}
1311
cancel-in-progress: true
12+
1413
jobs:
1514
sanity-check:
16-
name: SanityCheck
15+
name: SanityCheck 🕊️
1716
runs-on: ubuntu-latest
1817
env:
1918
buildcacheuser: ${{ secrets.BUILDCACHE_USER }}
2019
buildcachepass: ${{ secrets.BUILDCACHE_PASS }}
2120
steps:
22-
- name: Checkout
21+
- name: Checkout 📥
2322
uses: actions/checkout@v6
2423
with:
2524
fetch-depth: 0
26-
- uses: actions/setup-java@v5
25+
26+
- name: Setup Java ☕
27+
uses: actions/setup-java@v5
2728
with:
2829
distribution: "temurin"
2930
java-version: 21
30-
- name: gradle caching
31+
32+
- name: gradle caching 💾
3133
uses: gradle/actions/setup-gradle@v5
32-
- name: spotlessCheck
34+
35+
- name: spotlessCheck ✨
3336
run: ./gradlew spotlessCheck
34-
- name: rewriteDryRun
37+
38+
- name: rewriteDryRun 🌀
3539
run: ./gradlew rewriteDryRun
36-
- name: assemble testClasses
40+
41+
- name: assemble testClasses ⚙️
3742
run: ./gradlew assemble testClasses
43+
3844
build:
3945
needs: sanity-check
4046
strategy:
@@ -57,37 +63,48 @@ jobs:
5763
jre: 17
5864
os: ubuntu-latest
5965
runs-on: ${{ matrix.os }}
66+
6067
steps:
61-
- name: Checkout
68+
- name: Checkout 📥
6269
uses: actions/checkout@v6
63-
- uses: actions/setup-java@v5
70+
71+
- name: Setup Java ☕
72+
uses: actions/setup-java@v5
6473
with:
6574
distribution: "temurin"
6675
java-version: ${{ matrix.jre }}
67-
- name: gradle caching
76+
77+
- name: gradle caching 💾
6878
uses: gradle/actions/setup-gradle@v5
69-
- name: build (maven-only)
79+
80+
- name: build (maven-only) 🏗️
7081
if: matrix.kind == 'maven'
7182
run: ./gradlew :plugin-maven:build -x spotlessCheck -x rewriteDryRun
72-
- name: build (everything-but-maven)
83+
84+
- name: build (everything-but-maven) 🏗️
7385
if: matrix.kind == 'gradle'
7486
run: ./gradlew build -x spotlessCheck -x rewriteDryRun -PSPOTLESS_EXCLUDE_MAVEN=true
75-
- name: test npm
87+
88+
- name: test npm 📦
7689
if: matrix.kind == 'npm'
7790
run: ./gradlew testNpm
78-
- name: Setup go
91+
92+
- name: Setup go 🦫
7993
if: matrix.kind == 'shfmt'
8094
uses: actions/setup-go@v6
8195
with:
8296
go-version: 'stable'
83-
- name: Install shfmt
97+
98+
- name: Install shfmt 🔧
8499
if: matrix.kind == 'shfmt'
85100
run: |
86101
go install mvdan.cc/sh/v3/cmd/shfmt@${{ matrix.shfmt-version }}
87-
- name: Test shfmt
102+
103+
- name: Test shfmt 🧪
88104
if: matrix.kind == 'shfmt'
89105
run: ./gradlew testShfmt
90-
- name: Test idea
106+
107+
- name: Test idea 💡
91108
if: matrix.kind == 'idea'
92109
run: |
93110
download_link=$(curl https://data.services.jetbrains.com/products/releases\?code\=IIC\&latest\=true\&type\=release | jq -r '.IIC[0].downloads.linux.link')
@@ -97,7 +114,8 @@ jobs:
97114
export PATH=${PATH}:$(pwd)/bin
98115
cd ..
99116
./gradlew testIdea
100-
- name: junit result
117+
118+
- name: junit result 📊
101119
uses: mikepenz/action-junit-report@v6
102120
if: always() # always run even if the previous step fails
103121
with:
@@ -107,17 +125,18 @@ jobs:
107125

108126
# Status check that is required in branch protection rules.
109127
final-status:
128+
name: Final Status 🎯
110129
needs:
111130
- sanity-check
112131
- build
113132
runs-on: ubuntu-latest
114133
if: always()
115134
steps:
116-
- name: Check
135+
- name: Check All Jobs ✅
117136
run: |
118137
results=$(tr -d '\n' <<< '${{ toJSON(needs.*.result) }}')
119138
if ! grep -q -v -E '(failure|cancelled)' <<< "$results"; then
120-
echo "One or more required jobs failed"
139+
echo "One or more required jobs failed"
121140
exit 1
122141
fi
123-
echo "All required jobs completed successfully."
142+
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)