forked from OpenAPITools/openapi-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcircle_parallel.sh
More file actions
executable file
·70 lines (53 loc) · 1.79 KB
/
circle_parallel.sh
File metadata and controls
executable file
·70 lines (53 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
#
# A bash script to run CircleCI node/test in parallel
#
NODE_INDEX=${CIRCLE_NODE_INDEX:-0}
set -e
# Retry a command up to $1 times, with exponential backoff starting at $2 seconds.
retry() {
local attempts=$1; shift
local delay=$1; shift
local count=0
until "$@"; do
count=$((count + 1))
if [ "$count" -ge "$attempts" ]; then
echo "Command failed after $attempts attempts: $*" >&2
return 1
fi
echo "Attempt $count failed. Retrying in ${delay}s..." >&2
sleep "$delay"
delay=$((delay * 2))
done
}
# Wrapper for apt-get install with automatic retry on transient network errors.
apt_install() {
retry 3 30 sudo apt-get -y install --fix-missing "$@"
}
export NODE_ENV=test
if [ "$NODE_INDEX" = "1" ]; then
echo "Running node $NODE_INDEX ..."
apt_install cpanminus
echo "Testing perl"
(cd samples/client/petstore/perl && /bin/bash ./test.bash)
elif [ "$NODE_INDEX" = "2" ]; then
echo "Running node $NODE_INDEX to test cpp-restsdk"
# install cpprestsdk
apt_install libcpprest-dev
wget "https://github.com/aminya/setup-cpp/releases/download/v0.37.0/setup-cpp-x64-linux"
chmod +x ./setup-cpp-x64-linux
sudo ./setup-cpp-x64-linux --compiler llvm --cmake true --ninja true
source ~/.cpprc # activate cpp environment variables
(cd samples/client/petstore/cpp-restsdk/client && mvn integration-test)
elif [ "$NODE_INDEX" = "3" ]; then
echo "Running node $NODE_INDEX ... "
echo "Testing ruby"
(cd samples/client/petstore/ruby && mvn integration-test)
(cd samples/client/petstore/ruby-faraday && mvn integration-test)
(cd samples/client/petstore/ruby-httpx && mvn integration-test)
(cd samples/client/petstore/ruby-autoload && mvn integration-test)
else
echo "Running node $NODE_INDEX ..."
java -version
./mvnw clean install
fi