Skip to content

Commit 8bef0a8

Browse files
committed
ci: migrate running of jest tests from TravisCI to GitHub Actions
Part of #1154
1 parent 382b0cf commit 8bef0a8

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

.github/workflows/unit-tests.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Unit Tests
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
run-jest:
8+
name: Unit Tests (Java Script)
9+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- name: Clone source code
13+
uses: actions/[email protected] # https://github.com/actions/checkout
14+
with:
15+
# Whether to configure the token or SSH key with the local git config. Default: true
16+
persist-credentials: false
17+
- name: Install JDK
18+
uses: actions/[email protected] # https://github.com/actions/setup-java
19+
with:
20+
distribution: 'adopt' # https://github.com/actions/setup-java#supported-distributions
21+
java-version: '8' # https://github.com/actions/setup-java#supported-version-syntax
22+
cache: 'maven' # https://github.com/actions/setup-java#caching-packages-dependencies
23+
- name: Run Jest
24+
run: ./src/main/scripts/execute-command.sh jest

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-
JEST_STATUS=
6261
HTML_STATUS=
6362
ENFORCER_STATUS=
6463
TEST_STATUS=
@@ -72,7 +71,6 @@ if [ "${SPRING_PROFILES_ACTIVE:-}" = 'travis' ] && [ "${TRAVIS_PULL_REQUEST:-fal
7271
DANGER_STATUS=
7372
fi
7473

75-
JEST_TIME=0
7674
HTML_TIME=0
7775
ENFORCER_TIME=0
7876
TEST_TIME=0
@@ -103,7 +101,6 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
103101
AFFECTS_POM_XML="$(echo "$MODIFIED_FILES" | grep -Fxq 'pom.xml' || echo 'no')"
104102
AFFECTS_TRAVIS_CFG="$(echo "$MODIFIED_FILES" | grep -Fxq '.travis.yml' || echo 'no')"
105103
AFFECTS_SPOTBUGS_CFG="$(echo "$MODIFIED_FILES" | grep -q 'spotbugs-filter\.xml$' || echo 'no')"
106-
AFFECTS_JS_FILES="$(echo "$MODIFIED_FILES" | grep -q '\.js$' || echo 'no')"
107104
AFFECTS_HTML_FILES="$(echo "$MODIFIED_FILES" | grep -q '\.html$' || echo 'no')"
108105
AFFECTS_JAVA_FILES="$(echo "$MODIFIED_FILES" | grep -q '\.java$' || echo 'no')"
109106
AFFECTS_GROOVY_FILES="$(echo "$MODIFIED_FILES" | grep -q '\.groovy$' || echo 'no')"
@@ -121,7 +118,6 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
121118
fi
122119

123120
[ "$AFFECTS_GROOVY_FILES" != 'no' ] || CODENARC_STATUS=skip
124-
[ "$AFFECTS_JS_FILES" != 'no' ] || JEST_STATUS=skip
125121
fi
126122

127123
if [ "$AFFECTS_TRAVIS_CFG" = 'no' ]; then
@@ -145,13 +141,6 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
145141

146142
echo
147143

148-
if [ "$JEST_STATUS" != 'skip' ]; then
149-
START_TIME=$SECONDS
150-
"$EXEC_CMD" jest >jest.log 2>&1 || JEST_STATUS=fail
151-
JEST_TIME=$((SECONDS - START_TIME))
152-
fi
153-
print_status "$JEST_STATUS" "$JEST_TIME" 'Run JavaScript unit tests'
154-
155144
if [ "$HTML_STATUS" != 'skip' ]; then
156145
"$EXEC_CMD" html5validator >validator.log 2>&1 || HTML_STATUS=fail
157146
HTML_TIME=$((SECONDS - START_TIME))
@@ -211,7 +200,6 @@ fi
211200
print_status "$DANGER_STATUS" "$DANGER_TIME" 'Run danger'
212201

213202
if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
214-
[ "$JEST_STATUS" = 'skip' ] || print_log jest.log 'Run JavaScript unit tests'
215203
[ "$HTML_STATUS" = 'skip' ] || print_log validator.log 'Run html5validator'
216204
[ "$ENFORCER_STATUS" = 'skip' ] || print_log enforcer.log 'Run maven-enforcer-plugin'
217205
[ "$TEST_STATUS" = 'skip' ] || print_log test.log 'Run unit tests'
@@ -226,8 +214,8 @@ if [ "$DANGER_STATUS" != 'skip' ]; then
226214
print_log danger.log 'Run danger'
227215
fi
228216

229-
rm -f jest.log validator.log enforcer.log test.log codenarc.log spotbugs.log verify.log danger.log ansible_lint.log
217+
rm -f validator.log enforcer.log test.log codenarc.log spotbugs.log verify.log danger.log ansible_lint.log
230218

231-
if echo "$JEST_STATUS$HTML_STATUS$ENFORCER_STATUS$TEST_STATUS$CODENARC_STATUS$SPOTBUGS_STATUS$VERIFY_STATUS$DANGER_STATUS$ANSIBLE_LINT_STATUS" | grep -Fqs 'fail'; then
219+
if echo "$HTML_STATUS$ENFORCER_STATUS$TEST_STATUS$CODENARC_STATUS$SPOTBUGS_STATUS$VERIFY_STATUS$DANGER_STATUS$ANSIBLE_LINT_STATUS" | grep -Fqs 'fail'; then
232220
exit 1
233221
fi

0 commit comments

Comments
 (0)