Skip to content

Commit 4392b67

Browse files
committed
ci: migrate checking of license headers from TravisCI to GitHub Actions
Part of #1154
1 parent 957f5b1 commit 4392b67

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

.github/workflows/quality-checks.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,21 @@ jobs:
4040
cache: 'maven' # https://github.com/actions/setup-java#caching-packages-dependencies
4141
- name: Run PMD
4242
run: ./src/main/scripts/execute-command.sh pmd
43+
check-license:
44+
name: Check license in file headers
45+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on
46+
runs-on: ubuntu-20.04
47+
steps:
48+
- name: Clone source code
49+
uses: actions/[email protected] # https://github.com/actions/checkout
50+
with:
51+
# Whether to configure the token or SSH key with the local git config. Default: true
52+
persist-credentials: false
53+
- name: Install JDK
54+
uses: actions/[email protected] # https://github.com/actions/setup-java
55+
with:
56+
distribution: 'adopt' # https://github.com/actions/setup-java#supported-distributions
57+
java-version: '8' # https://github.com/actions/setup-java#supported-version-syntax
58+
cache: 'maven' # https://github.com/actions/setup-java#caching-packages-dependencies
59+
- name: Check license header
60+
run: ./src/main/scripts/execute-command.sh check-license

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

Lines changed: 2 additions & 15 deletions
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-
LICENSE_STATUS=
6261
POM_STATUS=
6362
BOOTLINT_STATUS=
6463
RFLINT_STATUS=
@@ -77,7 +76,6 @@ if [ "${SPRING_PROFILES_ACTIVE:-}" = 'travis' ] && [ "${TRAVIS_PULL_REQUEST:-fal
7776
DANGER_STATUS=
7877
fi
7978

80-
LICENSE_TIME=0
8179
POM_TIME=0
8280
BOOTLINT_TIME=0
8381
RFLINT_TIME=0
@@ -119,7 +117,6 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
119117
AFFECTS_ROBOT_FILES="$(echo "$MODIFIED_FILES" | grep -q '\.robot$' || echo 'no')"
120118
AFFECTS_SHELL_FILES="$(echo "$MODIFIED_FILES" | grep -q '\.sh$' || echo 'no')"
121119
AFFECTS_GROOVY_FILES="$(echo "$MODIFIED_FILES" | grep -q '\.groovy$' || echo 'no')"
122-
AFFECTS_LICENSE_HEADER="$(echo "$MODIFIED_FILES" | grep -q 'license_header\.txt$' || echo 'no')"
123120
AFFECTS_PLAYBOOKS="$(echo "$MODIFIED_FILES" | grep -Eq '(vagrant|prod|deploy|bootstrap|/roles/.+)\.yml$' || echo 'no')"
124121

125122
if [ "$AFFECTS_POM_XML" = 'no' ]; then
@@ -131,8 +128,6 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
131128

132129
if [ "$AFFECTS_GROOVY_FILES" = 'no' ]; then
133130
TEST_STATUS=skip
134-
135-
[ "$AFFECTS_LICENSE_HEADER" != 'no' ] || LICENSE_STATUS=skip
136131
fi
137132
fi
138133

@@ -165,13 +160,6 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
165160

166161
echo
167162

168-
if [ "$LICENSE_STATUS" != 'skip' ]; then
169-
START_TIME=$SECONDS
170-
"$EXEC_CMD" check-license >license.log 2>&1 || LICENSE_STATUS=fail
171-
LICENSE_TIME=$((SECONDS - START_TIME))
172-
fi
173-
print_status "$LICENSE_STATUS" "$LICENSE_TIME" 'Check license headers'
174-
175163
if [ "$POM_STATUS" != 'skip' ]; then
176164
START_TIME=$SECONDS
177165
"$EXEC_CMD" check-pom >pom.log 2>&1 || POM_STATUS=fail
@@ -266,7 +254,6 @@ fi
266254
print_status "$DANGER_STATUS" "$DANGER_TIME" 'Run danger'
267255

268256
if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
269-
[ "$LICENSE_STATUS" = 'skip' ] || print_log license.log 'Check license headers'
270257
[ "$POM_STATUS" = 'skip' ] || print_log pom.log 'Check sorting of pom.xml'
271258
[ "$BOOTLINT_STATUS" = 'skip' ] || print_log bootlint.log 'Run bootlint'
272259
[ "$RFLINT_STATUS" = 'skip' ] || print_log rflint.log 'Run robot framework lint'
@@ -286,8 +273,8 @@ if [ "$DANGER_STATUS" != 'skip' ]; then
286273
print_log danger.log 'Run danger'
287274
fi
288275

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
276+
rm -f 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
290277

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
278+
if echo "$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
292279
exit 1
293280
fi

0 commit comments

Comments
 (0)