2022-11-17 06:50:16 -05:00
# 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.
2023-05-22 02:14:34 -04:00
name : "Static Checks CI"
2022-11-17 06:50:16 -05:00
on :
push :
branches :
- master
2023-04-11 23:43:40 -04:00
- '[0-9]+.[0-9]+.[0-9]+' # release branches
- '[0-9]+.[0-9]+.[0-9]+-[A-Za-z0-9]+' # release branches
2022-11-17 06:50:16 -05:00
pull_request :
branches :
- master
2023-04-11 23:43:40 -04:00
- '[0-9]+.[0-9]+.[0-9]+' # release branches
- '[0-9]+.[0-9]+.[0-9]+-[A-Za-z0-9]+' # release branches
2022-11-17 06:50:16 -05:00
concurrency :
2023-05-16 02:43:08 -04:00
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
2022-11-17 06:50:16 -05:00
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 : -Xmx3000m
jobs :
2022-12-02 04:36:31 -05:00
static-checks :
strategy :
2023-02-01 06:31:29 -05:00
fail-fast : false
2022-12-02 04:36:31 -05:00
matrix :
2023-10-06 15:45:07 -04:00
java : [ '8' , '11' , '17' , '21' ]
2022-11-17 06:50:16 -05:00
runs-on : ubuntu-latest
steps :
2022-12-02 04:36:31 -05:00
- name : checkout branch
uses : actions/checkout@v3
2023-09-20 17:11:39 -04:00
- uses : actions/setup-java@v3
with :
distribution : 'zulu'
java-version : ${{ matrix.java }}
cache : 'maven'
2022-12-02 04:36:31 -05:00
- name : packaging check
run : |
./.github/scripts/setup_generate_license.sh
2023-02-26 06:36:23 -05:00
${MVN} clean install -Prat --fail-at-end \
2023-01-13 04:16:58 -05:00
-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
2022-12-02 04:36:31 -05:00
- name : script checks
# who watches the watchers?
2023-09-20 17:11:39 -04:00
if : ${{ matrix.java == '8' }}
2022-12-02 04:36:31 -05:00
run : ./check_test_suite_test.py
2023-07-07 15:52:35 -04:00
- name : (openjdk17) strict compilation
2023-09-20 17:11:39 -04:00
if : ${{ matrix.java == '17' }}
2023-07-07 15:52:35 -04:00
# errorprone requires JDK 11+
2022-12-02 04:36:31 -05:00
# 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
2023-09-20 17:11:39 -04:00
if : ${{ matrix.java == '8' }}
2022-12-02 04:36:31 -05:00
run : |
2022-11-17 06:50:16 -05:00
echo 'Running Maven install...' &&
2024-01-24 04:47:33 -05:00
${MVN} clean install -q -ff -pl '!distribution' ${MAVEN_SKIP} ${MAVEN_SKIP_TESTS} -T1C &&
2022-11-17 06:50:16 -05:00
${MVN} install -q -ff -pl 'distribution' ${MAVEN_SKIP} ${MAVEN_SKIP_TESTS}
2023-05-03 08:57:39 -04:00
- name : checkstyle
2023-09-20 17:11:39 -04:00
if : ${{ matrix.java == '8' }}
2023-05-03 08:57:39 -04:00
run : ${MVN} checkstyle:checkstyle --fail-at-end
2022-12-06 01:38:03 -05:00
- name : license checks
2023-09-20 17:11:39 -04:00
if : ${{ matrix.java == '8' }}
2022-12-06 01:38:03 -05:00
run : ./.github/scripts/license_checks_script.sh
- name : analyze dependencies
2023-09-20 17:11:39 -04:00
if : ${{ matrix.java == '8' }}
2022-12-06 01:38:03 -05:00
run : |
./.github/scripts/analyze_dependencies_script.sh
2022-12-02 04:36:31 -05:00
- name : animal sniffer checks
2023-09-20 17:11:39 -04:00
if : ${{ matrix.java == '8' }}
2022-12-02 04:36:31 -05:00
run : ${MVN} animal-sniffer:check --fail-at-end
2022-11-17 06:50:16 -05:00
2022-12-02 04:36:31 -05:00
- name : enforcer checks
2023-09-20 17:11:39 -04:00
if : ${{ matrix.java == '8' }}
2022-12-02 04:36:31 -05:00
run : ${MVN} enforcer:enforce --fail-at-end
2022-11-17 06:50:16 -05:00
2022-12-02 04:36:31 -05:00
- name : forbidden api checks
2023-09-20 17:11:39 -04:00
if : ${{ matrix.java == '8' }}
2022-12-02 04:36:31 -05:00
run : ${MVN} forbiddenapis:check forbiddenapis:testCheck --fail-at-end
2022-11-17 06:50:16 -05:00
2022-12-02 04:36:31 -05:00
- name : pmd checks
2023-09-20 17:11:39 -04:00
if : ${{ matrix.java == '8' }}
2022-12-02 04:36:31 -05:00
run : ${MVN} pmd:check --fail-at-end # TODO: consider adding pmd:cpd-check
2022-11-17 06:50:16 -05:00
2022-12-02 04:36:31 -05:00
- name : spotbugs checks
2023-09-20 17:11:39 -04:00
if : ${{ matrix.java == '8' }}
2022-12-02 04:36:31 -05:00
run : ${MVN} spotbugs:check --fail-at-end -pl '!benchmarks'
2022-11-17 06:50:16 -05:00
2023-07-03 07:40:19 -04:00
intellij-inspections :
strategy :
fail-fast : false
runs-on : ubuntu-latest
steps :
- name : checkout branch
uses : actions/checkout@v3
2023-09-20 17:11:39 -04:00
- uses : actions/setup-java@v3
with :
distribution : 'zulu'
java-version : '8'
cache : 'maven'
2023-07-03 07:40:19 -04:00
- name : maven install
run : |
echo 'Running Maven install...' &&
2024-01-24 04:47:33 -05:00
${MVN} clean install -q -ff -pl '!distribution' ${MAVEN_SKIP} ${MAVEN_SKIP_TESTS} -T1C &&
2023-07-03 07:40:19 -04:00
${MVN} install -q -ff -pl 'distribution' ${MAVEN_SKIP} ${MAVEN_SKIP_TESTS}
2022-12-02 04:36:31 -05:00
- name : intellij inspections
run : |
docker run --rm \
-v $(pwd):/project \
-v ~/.m2:/home/inspect/.m2 \
2023-06-02 02:30:52 -04:00
-v $(pwd)/.idea/misc-for-inspection.xml:/project/.idea/misc.xml \
2022-12-02 04:36:31 -05:00
ccaominh/intellij-inspect:1.0.0 \
/project/pom.xml \
/project/.idea/inspectionProfiles/Druid.xml \
--levels ERROR \
--scope JavaInspectionsScope
2022-11-17 06:50:16 -05:00
2023-04-12 23:17:03 -04:00
web-checks :
strategy :
fail-fast : false
runs-on : ubuntu-latest
steps :
- name : checkout branch
uses : actions/checkout@v3
2023-09-20 17:11:39 -04:00
- uses : actions/setup-java@v3
with :
distribution : 'zulu'
java-version : '17'
cache : 'maven'
2023-04-12 23:17:03 -04:00
2022-12-02 04:36:31 -05:00
- name : setup node
uses : actions/setup-node@v3
2022-11-17 06:50:16 -05:00
with :
2022-12-02 04:36:31 -05:00
node-version : 16.17 .0
2022-11-17 06:50:16 -05:00
2022-12-02 04:36:31 -05:00
- name : docs
run : |
(cd website && npm install)
cd website
2023-08-16 22:01:21 -04:00
npm run build
2024-01-08 18:19:05 -05:00
npm run link-lint
2022-12-02 04:36:31 -05:00
npm run spellcheck
2022-11-17 06:50:16 -05:00
2022-12-02 04:36:31 -05:00
- 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
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
2023-12-07 05:04:23 -05:00
- name : Tar druid logs
if : ${{ failure() }}
run : tar cvzf ./druid-logs.tgz -C ./distribution/target/apache-druid-*-SNAPSHOT/ logs
- name : Upload druid logs to GitHub
if : ${{ failure() }}
uses : actions/upload-artifact@master
with :
name : Druid logs web-checks
path : druid-logs.tgz