forked from diffplug/spotless
-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (102 loc) · 3.11 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# BUILDCACHE_USER
# BUILDCACHE_PASS
# - rw access to buildcache.diffplug.com
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
sanityCheck:
name: spotlessCheck assemble testClasses
runs-on: ubuntu-latest
env:
buildcacheuser: ${{ secrets.BUILDCACHE_USER }}
buildcachepass: ${{ secrets.BUILDCACHE_PASS }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install JDK 11
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 11
- name: gradle caching
uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: true
- name: spotlessCheck
run: ./gradlew spotlessCheck
- name: assemble testClasses
run: ./gradlew assemble testClasses
build:
needs: sanityCheck
strategy:
fail-fast: false
matrix:
kind: [maven, gradle]
# Test on the latest Java version once Gradle & Maven support it.
jre: [11, 17, 21]
os: [ubuntu-latest]
include:
# test windows at the diagonals of the above matrix
- kind: maven
jre: 11
os: windows-latest
- kind: gradle
jre: 17
os: windows-latest
# npm on linux only (crazy slow on windows)
- kind: npm
jre: 11
os: ubuntu-latest
- kind: shfmt
jre: 11
os: ubuntu-latest
shfmt-version: v3.8.0
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install JDK ${{ matrix.distribution }} ${{ matrix.java_version }}
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ matrix.jre }}
- name: gradle caching
uses: gradle/actions/setup-gradle@v3
with:
gradle-home-cache-cleanup: true
- name: build (maven-only)
if: matrix.kind == 'maven'
run: ./gradlew :plugin-maven:build -x spotlessCheck
- name: build (everything-but-maven)
if: matrix.kind == 'gradle'
run: ./gradlew build -x spotlessCheck -PSPOTLESS_EXCLUDE_MAVEN=true
- name: test npm
if: matrix.kind == 'npm'
run: ./gradlew testNpm
- name: Setup go
if: matrix.kind == 'shfmt'
uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: Install shfmt
if: matrix.kind == 'shfmt'
run: |
go install mvdan.cc/sh/v3/cmd/shfmt@${{ matrix.shfmt-version }}
- name: Test shfmt
if: matrix.kind == 'shfmt'
run: ./gradlew testShfmt
- name: junit result
uses: mikepenz/action-junit-report@v4
if: always() # always run even if the previous step fails
with:
check_name: JUnit ${{ matrix.kind }} ${{ matrix.jre }} ${{ matrix.os }}
report_paths: '*/build/test-results/*/TEST-*.xml'
check_retries: true