Skip to content

Commit f296397

Browse files
committed
src/main/scripts: activate errexit, nounset and pipefail options.
Fix #351
1 parent 56e848f commit f296397

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
#!/bin/sh
22

3+
# Treat unset variables and parameters as an error when performing parameter expansion
4+
set -o nounset
5+
6+
# Exit immediately if command returns a non-zero status
7+
set -e errexit
8+
9+
# Return value of a pipeline is the value of the last command to exit with a non-zero status
10+
set -o pipefail
11+
12+
313
RUN_ONLY_INTEGRATION_TESTS=no
4-
if [ "$1" = '--only-integration-tests' ]; then
14+
if [ "${1:-}" = '--only-integration-tests' ]; then
515
RUN_ONLY_INTEGRATION_TESTS=yes
616
fi
717

@@ -64,7 +74,7 @@ fi
6474

6575
mvn --batch-mode verify -Denforcer.skip=true -DskipUnitTests=true >verify-raw.log 2>&1 || VERIFY_FAIL=yes
6676

67-
if [ "$SPRING_PROFILES_ACTIVE" = 'travis' -a "${TRAVIS_PULL_REQUEST:-}" != 'false' ]; then
77+
if [ "${SPRING_PROFILES_ACTIVE:-}" = 'travis' -a "${TRAVIS_PULL_REQUEST:-}" != 'false' ]; then
6878
danger >danger.log 2>&1 || DANGER_FAIL=yes
6979
fi
7080

@@ -92,7 +102,7 @@ fi
92102

93103
print_status "$VERIFY_FAIL" 'Run integration tests'
94104

95-
if [ "$SPRING_PROFILES_ACTIVE" = 'travis' -a "${TRAVIS_PULL_REQUEST:-}" != 'false' ]; then
105+
if [ "${SPRING_PROFILES_ACTIVE:-}" = 'travis' -a "${TRAVIS_PULL_REQUEST:-}" != 'false' ]; then
96106
print_status "$DANGER_FAIL" 'Run danger'
97107
fi
98108

@@ -115,7 +125,7 @@ fi
115125

116126
print_log verify.log 'Run integration tests'
117127

118-
if [ "$SPRING_PROFILES_ACTIVE" = 'travis' -a "${TRAVIS_PULL_REQUEST:-}" != 'false' ]; then
128+
if [ "${SPRING_PROFILES_ACTIVE:-}" = 'travis' -a "${TRAVIS_PULL_REQUEST:-}" != 'false' ]; then
119129
print_log danger.log 'Run danger'
120130
fi
121131

src/main/scripts/ci/publish-code-coverage.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
#!/bin/sh
22

3+
# Treat unset variables and parameters as an error when performing parameter expansion
4+
set -o nounset
5+
6+
# Exit immediately if command returns a non-zero status
7+
set -e errexit
8+
9+
# Return value of a pipeline is the value of the last command to exit with a non-zero status
10+
set -o pipefail
11+
12+
313
. "$(dirname "$0")/common.sh"
414

515
JACOCO_FAIL=

0 commit comments

Comments
 (0)