Skip to content

Commit 957f5b1

Browse files
committed
ci: migrate checking by PMD from TravisCI to GitHub Actions
Part of #1154
1 parent b559fac commit 957f5b1

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

.github/workflows/quality-checks.yml

+18
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,21 @@ jobs:
2222
cache: 'maven' # https://github.com/actions/setup-java#caching-packages-dependencies
2323
- name: Run CheckStyle
2424
run: ./src/main/scripts/execute-command.sh checkstyle
25+
run-pmd:
26+
name: Run PMD
27+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on
28+
runs-on: ubuntu-20.04
29+
steps:
30+
- name: Clone source code
31+
uses: actions/[email protected] # https://github.com/actions/checkout
32+
with:
33+
# Whether to configure the token or SSH key with the local git config. Default: true
34+
persist-credentials: false
35+
- name: Install JDK
36+
uses: actions/[email protected] # https://github.com/actions/setup-java
37+
with:
38+
distribution: 'adopt' # https://github.com/actions/setup-java#supported-distributions
39+
java-version: '8' # https://github.com/actions/setup-java#supported-version-syntax
40+
cache: 'maven' # https://github.com/actions/setup-java#caching-packages-dependencies
41+
- name: Run PMD
42+
run: ./src/main/scripts/execute-command.sh pmd

src/main/scripts/ci/check-build-and-verify.sh

+2-14
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ if [ "${1:-}" = '--only-integration-tests' ]; then
5858
RUN_ONLY_INTEGRATION_TESTS=yes
5959
fi
6060

61-
PMD_STATUS=
6261
LICENSE_STATUS=
6362
POM_STATUS=
6463
BOOTLINT_STATUS=
@@ -78,7 +77,6 @@ if [ "${SPRING_PROFILES_ACTIVE:-}" = 'travis' ] && [ "${TRAVIS_PULL_REQUEST:-fal
7877
DANGER_STATUS=
7978
fi
8079

81-
PMD_TIME=0
8280
LICENSE_TIME=0
8381
POM_TIME=0
8482
BOOTLINT_TIME=0
@@ -115,7 +113,6 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
115113
AFFECTS_POM_XML="$(echo "$MODIFIED_FILES" | grep -Fxq 'pom.xml' || echo 'no')"
116114
AFFECTS_TRAVIS_CFG="$(echo "$MODIFIED_FILES" | grep -Fxq '.travis.yml' || echo 'no')"
117115
AFFECTS_SPOTBUGS_CFG="$(echo "$MODIFIED_FILES" | grep -q 'spotbugs-filter\.xml$' || echo 'no')"
118-
AFFECTS_PMD_XML="$(echo "$MODIFIED_FILES" | grep -q 'pmd\.xml$' || echo 'no')"
119116
AFFECTS_JS_FILES="$(echo "$MODIFIED_FILES" | grep -q '\.js$' || echo 'no')"
120117
AFFECTS_HTML_FILES="$(echo "$MODIFIED_FILES" | grep -q '\.html$' || echo 'no')"
121118
AFFECTS_JAVA_FILES="$(echo "$MODIFIED_FILES" | grep -q '\.java$' || echo 'no')"
@@ -131,7 +128,6 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
131128

132129
if [ "$AFFECTS_JAVA_FILES" = 'no' ]; then
133130
[ "$AFFECTS_SPOTBUGS_CFG" != 'no' ] || SPOTBUGS_STATUS=skip
134-
[ "$AFFECTS_PMD_XML" != 'no' ] || PMD_STATUS=skip
135131

136132
if [ "$AFFECTS_GROOVY_FILES" = 'no' ]; then
137133
TEST_STATUS=skip
@@ -169,13 +165,6 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
169165

170166
echo
171167

172-
if [ "$PMD_STATUS" != 'skip' ]; then
173-
START_TIME=$SECONDS
174-
"$EXEC_CMD" pmd >pmd.log 2>&1 || PMD_STATUS=fail
175-
PMD_TIME=$((SECONDS - START_TIME))
176-
fi
177-
print_status "$PMD_STATUS" "$PMD_TIME" 'Run PMD'
178-
179168
if [ "$LICENSE_STATUS" != 'skip' ]; then
180169
START_TIME=$SECONDS
181170
"$EXEC_CMD" check-license >license.log 2>&1 || LICENSE_STATUS=fail
@@ -277,7 +266,6 @@ fi
277266
print_status "$DANGER_STATUS" "$DANGER_TIME" 'Run danger'
278267

279268
if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
280-
[ "$PMD_STATUS" = 'skip' ] || print_log pmd.log 'Run PMD'
281269
[ "$LICENSE_STATUS" = 'skip' ] || print_log license.log 'Check license headers'
282270
[ "$POM_STATUS" = 'skip' ] || print_log pom.log 'Check sorting of pom.xml'
283271
[ "$BOOTLINT_STATUS" = 'skip' ] || print_log bootlint.log 'Run bootlint'
@@ -298,8 +286,8 @@ if [ "$DANGER_STATUS" != 'skip' ]; then
298286
print_log danger.log 'Run danger'
299287
fi
300288

301-
rm -f pmd.log license.log pom.log bootlint.log rflint.log shellcheck.log jest.log validator.log enforcer.log test.log codenarc.log spotbugs.log verify.log danger.log ansible_lint.log
289+
rm -f license.log pom.log bootlint.log rflint.log shellcheck.log jest.log validator.log enforcer.log test.log codenarc.log spotbugs.log verify.log danger.log ansible_lint.log
302290

303-
if echo "$PMD_STATUS$LICENSE_STATUS$POM_STATUS$BOOTLINT_STATUS$RFLINT_STATUS$SHELLCHECK_STATUS$JEST_STATUS$HTML_STATUS$ENFORCER_STATUS$TEST_STATUS$CODENARC_STATUS$SPOTBUGS_STATUS$VERIFY_STATUS$DANGER_STATUS$ANSIBLE_LINT_STATUS" | grep -Fqs 'fail'; then
291+
if echo "$LICENSE_STATUS$POM_STATUS$BOOTLINT_STATUS$RFLINT_STATUS$SHELLCHECK_STATUS$JEST_STATUS$HTML_STATUS$ENFORCER_STATUS$TEST_STATUS$CODENARC_STATUS$SPOTBUGS_STATUS$VERIFY_STATUS$DANGER_STATUS$ANSIBLE_LINT_STATUS" | grep -Fqs 'fail'; then
304292
exit 1
305293
fi

0 commit comments

Comments
 (0)