2018-07-20 10:45:14 +00:00
|
|
|
#!/bin/bash
|
2018-10-09 02:25:28 +00:00
|
|
|
#
|
|
|
|
# A bash script to run CircleCI node/test in parallel
|
|
|
|
#
|
2018-07-20 10:45:14 +00:00
|
|
|
|
|
|
|
NODE_INDEX=${CIRCLE_NODE_INDEX:-0}
|
|
|
|
|
2019-02-24 03:19:09 +00:00
|
|
|
set -e
|
|
|
|
|
2020-03-26 08:47:51 +00:00
|
|
|
function cleanup {
|
|
|
|
# Show logs of 'petstore.swagger' container to troubleshoot Unit Test failures, if any.
|
|
|
|
docker logs petstore.swagger # container name specified in circle.yml
|
|
|
|
}
|
|
|
|
|
|
|
|
trap cleanup EXIT
|
|
|
|
|
2018-07-20 10:45:14 +00:00
|
|
|
if [ "$NODE_INDEX" = "1" ]; then
|
2018-10-09 02:25:28 +00:00
|
|
|
echo "Running node $NODE_INDEX to test 'samples.circleci' defined in pom.xml ..."
|
2018-07-20 10:45:14 +00:00
|
|
|
java -version
|
2020-03-14 23:34:58 +00:00
|
|
|
# Install golang version 1.14
|
|
|
|
go version
|
|
|
|
sudo mkdir /usr/local/go1.14
|
|
|
|
wget -c https://dl.google.com/go/go1.14.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local/go1.14
|
|
|
|
export PATH="/usr/local/go1.14/go/bin:$PATH"
|
|
|
|
go version
|
2020-03-06 16:20:44 +00:00
|
|
|
|
2020-01-29 08:28:42 +00:00
|
|
|
mvn --quiet verify -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
|
|
|
mvn --quiet javadoc:javadoc -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
2019-06-04 16:07:15 +00:00
|
|
|
|
2018-08-31 07:16:41 +00:00
|
|
|
elif [ "$NODE_INDEX" = "2" ]; then
|
2019-03-03 16:06:30 +00:00
|
|
|
# run ensure-up-to-date sample script on SNAPSHOT version only
|
|
|
|
project_version=`mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout`
|
|
|
|
if [[ $project_version == *"-SNAPSHOT" ]]; then
|
|
|
|
echo "Running node $NODE_INDEX to test ensure-up-to-date"
|
|
|
|
java -version
|
2019-05-06 14:19:59 +00:00
|
|
|
|
2019-10-10 10:20:46 +00:00
|
|
|
# install elm-format
|
|
|
|
npm install -g elm-format
|
|
|
|
|
2019-10-29 07:15:24 +00:00
|
|
|
# clear any changes to the samples
|
|
|
|
git checkout -- .
|
|
|
|
|
|
|
|
# look for outdated samples
|
2019-11-22 03:43:52 +00:00
|
|
|
./bin/utils/ensure-up-to-date
|
2019-03-03 16:06:30 +00:00
|
|
|
fi
|
2019-03-11 12:56:11 +00:00
|
|
|
#elif [ "$NODE_INDEX" = "3" ]; then
|
2019-02-24 03:19:09 +00:00
|
|
|
echo "Running node $NODE_INDEX to test haskell"
|
|
|
|
# install haskell
|
2019-03-11 12:56:11 +00:00
|
|
|
curl -sSL https://get.haskellstack.org/ | sh
|
2019-02-24 03:19:09 +00:00
|
|
|
stack upgrade
|
2019-03-11 12:56:11 +00:00
|
|
|
stack --version
|
|
|
|
# install r
|
|
|
|
sudo sh -c 'echo "deb http://cran.rstudio.com/bin/linux/ubuntu trusty/" >> /etc/apt/sources.list'
|
|
|
|
gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9
|
|
|
|
gpg -a --export E084DAB9 | sudo apt-key add -
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get -y install r-base
|
|
|
|
R --version
|
|
|
|
# install curl
|
|
|
|
sudo apt-get -y build-dep libcurl4-gnutls-dev
|
|
|
|
sudo apt-get -y install libcurl4-gnutls-dev
|
2020-03-06 16:20:44 +00:00
|
|
|
|
2019-03-11 12:56:11 +00:00
|
|
|
# run integration tests
|
2020-01-29 08:28:42 +00:00
|
|
|
mvn --quiet verify -Psamples.misc -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
2018-07-20 10:45:14 +00:00
|
|
|
else
|
2018-10-09 02:25:28 +00:00
|
|
|
echo "Running node $NODE_INDEX to test 'samples.circleci.jdk7' defined in pom.xml ..."
|
2018-07-20 10:45:14 +00:00
|
|
|
sudo update-java-alternatives -s java-1.7.0-openjdk-amd64
|
|
|
|
java -version
|
2020-03-06 16:20:44 +00:00
|
|
|
|
|
|
|
# install dart2
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install apt-transport-https
|
|
|
|
sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
|
|
|
|
sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install dart
|
|
|
|
export PATH="$PATH:/usr/lib/dart/bin"
|
|
|
|
|
2020-01-29 08:28:42 +00:00
|
|
|
mvn --quiet verify -Psamples.circleci.jdk7 -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
2018-07-20 10:45:14 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|