Thomas Psota | 55bbf4c | 2019-12-03 16:01:55 +0100 | [diff] [blame] | 1 | #!/bin/bash |
Thomas Psota | 0bc7d0d | 2019-11-15 11:53:26 +0100 | [diff] [blame] | 2 | |
Thomas Psota | 55bbf4c | 2019-12-03 16:01:55 +0100 | [diff] [blame] | 3 | # Immediately exit script on errors |
4 | set -e | ||||
5 | |||||
Thomas Psota | 14ca62a | 2020-02-17 14:00:29 +0100 | [diff] [blame] | 6 | CWD=$(pwd) |
7 | echo "Working directory: $CWD" | ||||
8 | echo "Home: $HOME" | ||||
9 | |||||
Thomas Psota | 0bc7d0d | 2019-11-15 11:53:26 +0100 | [diff] [blame] | 10 | MVN="mvn -ntp -Duser.home=/home/jenkins/agent" |
11 | |||||
Thomas Psota | 5a6ddaa | 2020-02-12 13:59:18 +0100 | [diff] [blame] | 12 | GIT_DIFF=$(/usr/bin/git diff-tree --no-commit-id --name-only -r HEAD) |
Thomas Psota | 184e782 | 2019-12-04 14:19:48 +0100 | [diff] [blame] | 13 | |
Thomas Psota | 14ca62a | 2020-02-17 14:00:29 +0100 | [diff] [blame] | 14 | JAVA_SDK_CHANGED=$(echo $GIT_DIFF | grep -i -e "ci/build_java.sh" -e "sdks/java/basys.sdk/" -e "components/basys.components/" -e "examples/basys.examples/" | wc -l) |
Thomas Psota | 0bc7d0d | 2019-11-15 11:53:26 +0100 | [diff] [blame] | 15 | |
Thomas Psota | 55bbf4c | 2019-12-03 16:01:55 +0100 | [diff] [blame] | 16 | if ((JAVA_SDK_CHANGED > 0)); |
Thomas Psota | 0bc7d0d | 2019-11-15 11:53:26 +0100 | [diff] [blame] | 17 | then |
Thomas Psota | 14ca62a | 2020-02-17 14:00:29 +0100 | [diff] [blame] | 18 | cd "$CWD/sdks/java/basys.sdk" |
Thomas Psota | 0bc7d0d | 2019-11-15 11:53:26 +0100 | [diff] [blame] | 19 | $MVN clean install |
Thomas Psota | 14ca62a | 2020-02-17 14:00:29 +0100 | [diff] [blame] | 20 | cd "$CWD" |
Thomas Psota | 0bc7d0d | 2019-11-15 11:53:26 +0100 | [diff] [blame] | 21 | |
Thomas Psota | 14ca62a | 2020-02-17 14:00:29 +0100 | [diff] [blame] | 22 | cd "$CWD/components/basys.components" |
Thomas Psota | 0bc7d0d | 2019-11-15 11:53:26 +0100 | [diff] [blame] | 23 | $MVN clean install |
Thomas Psota | 14ca62a | 2020-02-17 14:00:29 +0100 | [diff] [blame] | 24 | cd "$CWD" |
Thomas Psota | 0bc7d0d | 2019-11-15 11:53:26 +0100 | [diff] [blame] | 25 | |
Thomas Psota | 14ca62a | 2020-02-17 14:00:29 +0100 | [diff] [blame] | 26 | cd "$CWD/examples/basys.examples" |
Thomas Psota | 0bc7d0d | 2019-11-15 11:53:26 +0100 | [diff] [blame] | 27 | $MVN verify |
Thomas Psota | 14ca62a | 2020-02-17 14:00:29 +0100 | [diff] [blame] | 28 | cd "$CWD" |
Thomas Psota | 5a6ddaa | 2020-02-12 13:59:18 +0100 | [diff] [blame] | 29 | else |
30 | echo "No files changed in Java SDK." | ||||
31 | echo "Skipping continous integration tests for Java." | ||||
Thomas Psota | 0bc7d0d | 2019-11-15 11:53:26 +0100 | [diff] [blame] | 32 | fi |