Repository navigation
206 lines (197 loc) · 6.22 KB
/
Copy pathci.yml
File metadata and controls
206 lines (197 loc) · 6.22 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# 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
# least privilege by default; jobs opt in to more below
permissions:
contents: read
jobs:
sanity-check:
name: Sanity Check
runs-on: ubuntu-latest
env:
# Only push to the remote build cache on push events to prevent cache pollution and poisoning from PRs.
buildcacheuser: ${{ github.event_name == 'push' && secrets.BUILDCACHE_USER || '' }}
buildcachepass: ${{ github.event_name == 'push' && secrets.BUILDCACHE_PASS || '' }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/setup-java@v6
with:
distribution: "temurin"
java-version: 21
- uses: gradle/actions/setup-gradle@v6
- name: Check release publication ordering
run: python3 .github/scripts/test_publish_release.py
- run: ./gradlew spotlessCheck
- run: ./gradlew assemble testClasses publishToMavenLocal
build-gradle:
name: Gradle (Java ${{ matrix.jre }}, ${{ matrix.os }})
needs: sanity-check
permissions:
contents: read
checks: write # mikepenz/action-junit-report posts check runs
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
jre: [ 17, 21, 25, 26 ] # Test on all supported LTS and latest JDK.
include:
- os: windows-latest
jre: 26 # Test on the latest JDK for speeds.
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
distribution: "temurin"
java-version: ${{ matrix.jre }}
- uses: gradle/actions/setup-gradle@v6
- run: ./gradlew build -x spotlessCheck -PSPOTLESS_EXCLUDE_MAVEN=true
- name: junit result
uses: mikepenz/action-junit-report@v6
if: always()
with:
check_name: JUnit Gradle ${{ matrix.jre }} ${{ matrix.os }}
report_paths: '*/build/test-results/*/TEST-*.xml'
check_retries: true
build-maven:
name: Maven (Java ${{ matrix.jre }}, ${{ matrix.os }})
needs: sanity-check
permissions:
contents: read
checks: write # mikepenz/action-junit-report posts check runs
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
jre: [ 17, 21, 25, 26 ] # Test on all supported LTS and latest JDK.
include:
- os: windows-latest
jre: 26 # Test on the latest JDK for speeds.
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
distribution: "temurin"
java-version: ${{ matrix.jre }}
- uses: gradle/actions/setup-gradle@v6
- run: ./gradlew :plugin-maven:build -x spotlessCheck
- name: junit result
uses: mikepenz/action-junit-report@v6
if: always()
with:
check_name: JUnit Maven ${{ matrix.jre }} ${{ matrix.os }}
report_paths: '*/build/test-results/*/TEST-*.xml'
check_retries: true
test-npm:
name: NPM
needs: sanity-check
permissions:
contents: read
checks: write # mikepenz/action-junit-report posts check runs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
distribution: "temurin"
java-version: 17
- uses: gradle/actions/setup-gradle@v6
- run: ./gradlew testNpm
- name: junit result
uses: mikepenz/action-junit-report@v6
if: always()
with:
check_name: JUnit NPM
report_paths: '*/build/test-results/*/TEST-*.xml'
check_retries: true
test-shfmt:
name: Shfmt
needs: sanity-check
permissions:
contents: read
checks: write # mikepenz/action-junit-report posts check runs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
distribution: "temurin"
java-version: 17
- uses: gradle/actions/setup-gradle@v6
- uses: actions/setup-go@v7
with:
go-version: 'stable'
- name: Install shfmt
run: |
go install mvdan.cc/sh/v3/cmd/shfmt@v3.8.0
- name: Test shfmt
run: ./gradlew testShfmt
- name: junit result
uses: mikepenz/action-junit-report@v6
if: always()
with:
check_name: JUnit shfmt
report_paths: '*/build/test-results/*/TEST-*.xml'
check_retries: true
test-idea:
name: IntelliJ IDEA
needs: sanity-check
permissions:
contents: read
checks: write # mikepenz/action-junit-report posts check runs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
distribution: "temurin"
java-version: 17
- uses: gradle/actions/setup-gradle@v6
- name: Test 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')
curl --location "$download_link" -o idea.tar.gz
tar -xf idea.tar.gz
cd idea-IU*
export PATH=${PATH}:$(pwd)/bin
cd ..
./gradlew testIdea
- name: junit result
uses: mikepenz/action-junit-report@v6
if: always()
with:
check_name: JUnit IDEA
report_paths: '*/build/test-results/*/TEST-*.xml'
check_retries: true
# Status check that is required in branch protection rules.
final-status:
needs:
- sanity-check
- build-gradle
- build-maven
- test-npm
- test-shfmt
- test-idea
runs-on: ubuntu-slim
if: always()
steps:
- name: Check
run: |
results=$(tr -d '\n' <<< '${{ toJSON(needs.*.result) }}')
if ! grep -q -v -E '(failure|cancelled)' <<< "$results"; then
echo "One or more required jobs failed"
exit 1
fi
echo "All required jobs completed successfully."