-
Notifications
You must be signed in to change notification settings - Fork 3.7k
197 lines (167 loc) · 6.47 KB
/
static-checks.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
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
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: "Static Checks CI"
on:
push:
branches:
- master
- '[0-9]+.[0-9]+.[0-9]+' # release branches
- '[0-9]+.[0-9]+.[0-9]+-[A-Za-z0-9]+' # release branches
pull_request:
branches:
- master
- '[0-9]+.[0-9]+.[0-9]+' # release branches
- '[0-9]+.[0-9]+.[0-9]+-[A-Za-z0-9]+' # release branches
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.run_id }}' # group workflows only on pull_requests and not on branch commits
cancel-in-progress: true
env:
MVN: mvn -B
MAVEN_SKIP: -P skip-static-checks -Dweb.console.skip=true -Dmaven.javadoc.skip=true
MAVEN_SKIP_TESTS: -P skip-tests
MAVEN_OPTS: -Xmx8g
jobs:
static-checks:
strategy:
fail-fast: false
matrix:
# Use JDK 21.0.4 to work around https://github.com/apache/druid/issues/17429
java: [ '11', '17', '21.0.4' ]
runs-on: ubuntu-latest
steps:
- name: checkout branch
uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: packaging check
run: |
./.github/scripts/setup_generate_license.sh
${MVN} clean install -Prat --fail-at-end \
-pl '!benchmarks, !distribution' ${MAVEN_SKIP} ${MAVEN_SKIP_TESTS} -Dweb.console.skip=false -T1C
${MVN} install -Prat -Pdist -Pbundle-contrib-exts --fail-at-end \
-pl 'distribution' ${MAVEN_SKIP} ${MAVEN_SKIP_TESTS} -Dweb.console.skip=false -T1C
- name: script checks
# who watches the watchers?
if: ${{ matrix.java == '17' }}
run: ./check_test_suite_test.py
- name: (openjdk17) strict compilation
if: ${{ matrix.java == '17' }}
# errorprone requires JDK 11+
# Strict compilation requires more than 2 GB
run: ${MVN} clean -DstrictCompile compile test-compile --fail-at-end ${MAVEN_SKIP} ${MAVEN_SKIP_TESTS}
- name: maven install
if: ${{ matrix.java == '17' }}
run: |
echo 'Running Maven install...' &&
${MVN} clean install -q -ff -pl '!distribution' ${MAVEN_SKIP} ${MAVEN_SKIP_TESTS} -T1C &&
${MVN} install -q -ff -pl 'distribution' ${MAVEN_SKIP} ${MAVEN_SKIP_TESTS}
- name: checkstyle
if: ${{ matrix.java == '17' }}
run: ${MVN} checkstyle:checkstyle --fail-at-end
- name: license checks
if: ${{ matrix.java == '17' }}
run: ./.github/scripts/license_checks_script.sh
- name: analyze dependencies
if: ${{ matrix.java == '17' }}
run: |
./.github/scripts/analyze_dependencies_script.sh
- name: animal sniffer checks
if: ${{ matrix.java == '17' }}
run: ${MVN} animal-sniffer:check --fail-at-end
- name: enforcer checks
if: ${{ matrix.java == '17' }}
run: ${MVN} enforcer:enforce --fail-at-end
- name: forbidden api checks
if: ${{ matrix.java == '17' }}
run: ${MVN} forbiddenapis:check forbiddenapis:testCheck --fail-at-end
- name: pmd checks
if: ${{ matrix.java == '17' }}
run: ${MVN} pmd:check --fail-at-end # TODO: consider adding pmd:cpd-check
- name: spotbugs checks
if: ${{ matrix.java == '17' }}
run: ${MVN} spotbugs:check --fail-at-end -pl '!benchmarks'
openrewrite:
runs-on: ubuntu-latest
steps:
- name: checkout branch
uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
cache: 'maven'
- name: maven install
run: |
echo 'Running Maven install...' &&
${MVN} clean install -q -ff -pl '!distribution' ${MAVEN_SKIP} ${MAVEN_SKIP_TESTS} -T1C &&
${MVN} install -q -ff -pl 'distribution' ${MAVEN_SKIP} ${MAVEN_SKIP_TESTS}
- name: rewrite:dryRun
id: rewrite-dryRun
run: |
${MVN} rewrite:dryRun ${MAVEN_SKIP}
- name: Upload open rewrite patch
if: ${{ failure() && steps.rewrite-dryRun.conclusion == 'failure' }}
uses: actions/upload-artifact@master
with:
name: Rewrite patch
path: ./target/rewrite/rewrite.patch
web-checks:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- name: checkout branch
uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
cache: 'maven'
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 16.17.0
- name: docs
run: |
(cd website && npm install)
cd website
npm run build
npm run link-lint
npm run spellcheck
- name: web console
run: |
${MVN} test -pl 'web-console'
cd web-console
{ for i in 1 2 3; do npm run codecov && break || sleep 15; done }
- name: web console end-to-end test
id: web-console-test
run: |
./.github/scripts/setup_generate_license.sh
web-console/script/druid build
web-console/script/druid start
(cd web-console && npm run test-e2e)
web-console/script/druid stop
- name: Tar druid logs
if: ${{ failure() && steps.web-console-test.conclusion == 'failure' }}
run: tar cvzf ./druid-logs.tgz -C ./distribution/target/apache-druid-*-SNAPSHOT/ log
- name: Upload druid logs to GitHub
if: ${{ failure() && steps.web-console-test.conclusion == 'failure' }}
uses: actions/upload-artifact@master
with:
name: Druid logs web-checks
path: druid-logs.tgz