Skip to content

Commit 0da9fba

Browse files
committed
Run integration tests as another script execution to avoid exceeding the output buffer.
Addressed to #631
1 parent c4802c3 commit 0da9fba

File tree

2 files changed

+38
-28
lines changed

2 files changed

+38
-28
lines changed

.travis.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,15 @@ before_script:
2727
fi
2828

2929
script:
30-
- set -o errexit # exit immediately when commands return a non-zero status
30+
# run all check analysis and unit tests only on travis profile
3131
- if [ "$SPRING_PROFILES_ACTIVE" = 'travis' ]; then
32-
./src/main/scripts/ci/check-build-and-verify.sh;
33-
else
34-
./src/main/scripts/ci/check-build-and-verify.sh --only-integration-tests;
32+
./src/main/scripts/ci/check-build-and-verify.sh || FAIL_BUILD=yes;
33+
fi
34+
# run integration tests and danger on all profiles
35+
- ./src/main/scripts/ci/check-build-and-verify.sh --only-integration-tests || FAIL_BUILD=yes;
36+
# fail a build when one of the scripts have failed
37+
- if [ -n "${FAIL_BUILD}" ]; then
38+
exit 1;
3539
fi
3640

3741
after_success:

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

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -188,18 +188,20 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
188188
print_status "$FINDBUGS_STATUS" 'Run FindBugs'
189189
fi
190190

191-
mvn --batch-mode verify -Denforcer.skip=true -DskipUnitTests=true \
192-
>verify-raw.log 2>&1 || VERIFY_STATUS=fail
193-
# Workaround for #538
194-
"$(dirname "$0")/filter-out-htmlunit-messages.pl" <verify-raw.log >verify.log
195-
196-
print_status "$VERIFY_STATUS" 'Run integration tests'
197-
198-
199-
if [ "$DANGER_STATUS" != 'skip' ]; then
200-
danger >danger.log 2>&1 || DANGER_STATUS=fail
191+
if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'yes' ]; then
192+
mvn --batch-mode verify -Denforcer.skip=true -DskipUnitTests=true \
193+
>verify-raw.log 2>&1 || VERIFY_STATUS=fail
194+
# Workaround for #538
195+
"$(dirname "$0")/filter-out-htmlunit-messages.pl" <verify-raw.log >verify.log
196+
197+
print_status "$VERIFY_STATUS" 'Run integration tests'
198+
199+
# run danger after integration tests when the results of all checks and tests are available
200+
if [ "$DANGER_STATUS" != 'skip' ]; then
201+
danger >danger.log 2>&1 || DANGER_STATUS=fail
202+
fi
203+
print_status "$DANGER_STATUS" 'Run danger'
201204
fi
202-
print_status "$DANGER_STATUS" 'Run danger'
203205

204206
if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
205207
[ "$CS_STATUS" = 'skip' ] || print_log cs.log 'Run CheckStyle'
@@ -216,21 +218,25 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
216218
[ "$FINDBUGS_STATUS" = 'skip' ] || print_log findbugs.log 'Run FindBugs'
217219
fi
218220

219-
print_log verify.log 'Run integration tests'
220-
221-
if [ "$DANGER_STATUS" != 'skip' ]; then
222-
print_log danger.log 'Run danger'
223-
fi
224-
225-
# In order to be able debug robot framework test flakes we need to have a report.
226-
# Just encode it to a gzipped binary form and dump to console.
227-
if fgrep -qs 'status="FAIL"' target/robotframework-reports/output.xml; then
228-
echo "===== REPORT START ====="
229-
cat target/robotframework-reports/output.xml | gzip -c | base64
230-
echo "===== REPORT END ====="
221+
if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'yes' ]; then
222+
print_log verify.log 'Run integration tests'
223+
224+
if [ "$DANGER_STATUS" != 'skip' ]; then
225+
print_log danger.log 'Run danger'
226+
fi
227+
228+
# In order to be able debug robot framework test flakes we need to have a report.
229+
# Just encode it to a gzipped binary form and dump to console.
230+
if fgrep -qs 'status="FAIL"' target/robotframework-reports/output.xml; then
231+
echo "===== REPORT START ====="
232+
cat target/robotframework-reports/output.xml | gzip -c | base64
233+
echo "===== REPORT END ====="
234+
fi
231235
fi
232236

233-
rm -f cs.log pmd.log codenarc.log license.log pom.log bootlint.log rflint.log jasmine.log validator.log enforcer.log test.log findbugs.log verify-raw.log verify.log danger.log
237+
# We don't remove the logs to make them available to danger that may be executed later as a separate
238+
# script invocation
239+
#rm -f cs.log pmd.log codenarc.log license.log pom.log bootlint.log rflint.log jasmine.log validator.log enforcer.log test.log findbugs.log verify-raw.log verify.log danger.log
234240

235241
if echo "$CS_STATUS$PMD_STATUS$CODENARC_STATUS$LICENSE_STATUS$POM_STATUS$BOOTLINT_STATUS$RFLINT_STATUS$JASMINE_STATUS$HTML_STATUS$ENFORCER_STATUS$TEST_STATUS$FINDBUGS_STATUS$VERIFY_STATUS$DANGER_STATUS" | fgrep -qs 'fail'; then
236242
exit 1

0 commit comments

Comments
 (0)