blob: 3dff26bd06d632a9fb340b9051e5901a7cdda505 [file] [log] [blame]
Thomas Psota55bbf4c2019-12-03 16:01:55 +01001#!/bin/bash
Thomas Psota0bc7d0d2019-11-15 11:53:26 +01002
Thomas Psota55bbf4c2019-12-03 16:01:55 +01003# Immediately exit script on errors
4set -e
5
Thomas Psota14ca62a2020-02-17 14:00:29 +01006CWD=$(pwd)
7echo "Working directory: $CWD"
8echo "Home: $HOME"
9
Thomas Psota0bc7d0d2019-11-15 11:53:26 +010010MVN="mvn -ntp -Duser.home=/home/jenkins/agent"
11
Thomas Psota5a6ddaa2020-02-12 13:59:18 +010012GIT_DIFF=$(/usr/bin/git diff-tree --no-commit-id --name-only -r HEAD)
Thomas Psota184e7822019-12-04 14:19:48 +010013
Thomas Psota14ca62a2020-02-17 14:00:29 +010014JAVA_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 Psota0bc7d0d2019-11-15 11:53:26 +010015
Thomas Psota55bbf4c2019-12-03 16:01:55 +010016if ((JAVA_SDK_CHANGED > 0));
Thomas Psota0bc7d0d2019-11-15 11:53:26 +010017then
Thomas Psota14ca62a2020-02-17 14:00:29 +010018 cd "$CWD/sdks/java/basys.sdk"
Thomas Psota0bc7d0d2019-11-15 11:53:26 +010019 $MVN clean install
Thomas Psota14ca62a2020-02-17 14:00:29 +010020 cd "$CWD"
Thomas Psota0bc7d0d2019-11-15 11:53:26 +010021
Thomas Psota14ca62a2020-02-17 14:00:29 +010022 cd "$CWD/components/basys.components"
Thomas Psota0bc7d0d2019-11-15 11:53:26 +010023 $MVN clean install
Thomas Psota14ca62a2020-02-17 14:00:29 +010024 cd "$CWD"
Thomas Psota0bc7d0d2019-11-15 11:53:26 +010025
Thomas Psota14ca62a2020-02-17 14:00:29 +010026 cd "$CWD/examples/basys.examples"
Thomas Psota0bc7d0d2019-11-15 11:53:26 +010027 $MVN verify
Thomas Psota14ca62a2020-02-17 14:00:29 +010028 cd "$CWD"
Thomas Psota5a6ddaa2020-02-12 13:59:18 +010029else
30 echo "No files changed in Java SDK."
31 echo "Skipping continous integration tests for Java."
Thomas Psota0bc7d0d2019-11-15 11:53:26 +010032fi