Skip to content

Commit bf03e2d

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

File tree

3 files changed

+61
-39
lines changed

3 files changed

+61
-39
lines changed

.github/workflows/ci.yml

Lines changed: 49 additions & 26 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,32 +9,41 @@ 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: Sanity Check 🕊️✅
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: Spotless Check ✨
3336
run: ./gradlew spotlessCheck
34-
- name: rewriteDryRun
37+
38+
- name: Rewrite Dry Run ♻️
3539
run: ./gradlew rewriteDryRun
36-
- name: assemble testClasses
40+
41+
- name: Build Prep ⚙️
3742
run: ./gradlew assemble testClasses
43+
3844
build:
3945
needs: sanity-check
46+
name: Build & Test 🧪 (${{ matrix.kind }} - Java ${{ matrix.jre }} - ${{ matrix.os }})
4047
strategy:
4148
fail-fast: false
4249
matrix:
@@ -57,37 +64,48 @@ jobs:
5764
jre: 17
5865
os: ubuntu-latest
5966
runs-on: ${{ matrix.os }}
67+
6068
steps:
61-
- name: Checkout
69+
- name: Checkout 📥
6270
uses: actions/checkout@v6
63-
- uses: actions/setup-java@v5
71+
72+
- name: Setup Java ☕
73+
uses: actions/setup-java@v5
6474
with:
6575
distribution: "temurin"
6676
java-version: ${{ matrix.jre }}
67-
- name: gradle caching
77+
78+
- name: Gradle Caching 💾
6879
uses: gradle/actions/setup-gradle@v5
69-
- name: build (maven-only)
80+
81+
- name: Maven Build 🏗️
7082
if: matrix.kind == 'maven'
7183
run: ./gradlew :plugin-maven:build -x spotlessCheck -x rewriteDryRun
72-
- name: build (everything-but-maven)
84+
85+
- name: Gradle Build 🏗️
7386
if: matrix.kind == 'gradle'
7487
run: ./gradlew build -x spotlessCheck -x rewriteDryRun -PSPOTLESS_EXCLUDE_MAVEN=true
75-
- name: test npm
88+
89+
- name: NPM Tests 📦
7690
if: matrix.kind == 'npm'
7791
run: ./gradlew testNpm
78-
- name: Setup go
92+
93+
- name: Setup Go 🦫
7994
if: matrix.kind == 'shfmt'
8095
uses: actions/setup-go@v6
8196
with:
8297
go-version: 'stable'
83-
- name: Install shfmt
98+
99+
- name: Install shfmt 🔧
84100
if: matrix.kind == 'shfmt'
85101
run: |
86102
go install mvdan.cc/sh/v3/cmd/shfmt@${{ matrix.shfmt-version }}
87-
- name: Test shfmt
103+
104+
- name: Test shfmt 🧪
88105
if: matrix.kind == 'shfmt'
89106
run: ./gradlew testShfmt
90-
- name: Test idea
107+
108+
- name: Setup IntelliJ IDEA 💡
91109
if: matrix.kind == 'idea'
92110
run: |
93111
download_link=$(curl https://data.services.jetbrains.com/products/releases\?code\=IIC\&latest\=true\&type\=release | jq -r '.IIC[0].downloads.linux.link')
@@ -96,28 +114,33 @@ jobs:
96114
cd idea-IC*
97115
export PATH=${PATH}:$(pwd)/bin
98116
cd ..
99-
./gradlew testIdea
100-
- name: junit result
117+
118+
- name: Test IntelliJ IDEA 🧪
119+
if: matrix.kind == 'idea'
120+
run: ./gradlew testIdea
121+
122+
- name: Test Results 📊
101123
uses: mikepenz/action-junit-report@v6
102124
if: always() # always run even if the previous step fails
103125
with:
104126
check_name: JUnit ${{ matrix.kind }} ${{ matrix.jre }} ${{ matrix.os }}
105127
report_paths: '*/build/test-results/*/TEST-*.xml'
106128
check_retries: true
107129

108-
# Status check that is required in branch protection rules.
109130
final-status:
110131
needs:
111132
- sanity-check
112133
- build
134+
name: Final Status 🎯
113135
runs-on: ubuntu-latest
114136
if: always()
137+
115138
steps:
116-
- name: Check
139+
- name: Check All Jobs ✅
117140
run: |
118141
results=$(tr -d '\n' <<< '${{ toJSON(needs.*.result) }}')
119142
if ! grep -q -v -E '(failure|cancelled)' <<< "$results"; then
120-
echo "One or more required jobs failed"
143+
echo "🚨 jobs failing. 🚨"
121144
exit 1
122145
fi
123-
echo "All required jobs completed successfully."
146+
echo "🎉 jobs successful completed. ✅"

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)