forked from smarthomeNG/smarthome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.sh
112 lines (85 loc) · 3.06 KB
/
.travis.sh
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#######################################################################
# Travis-CI script
#
# This script will checkout all required reqository to run the
# suite.
#
# The following configuration settings are available:
# * Environment settings:
# - REPOSITORY_ORIGIN: defines the current repos origin (e.g.
# "smarthome" or "plugins")
# * Script settings:
# - REPOSITORIES: List of repositories to checkout from smarthomeNG
# organization (e.g. "https://github.com/smarthomeNG/<repo-name>")
# - LINKS: Contains a list of links to create before running the
# suite (e.g. "<target-repo>/<target-dir>/<source-repo>")
# * Script variables:
# - REPOSITORY: The name of the current repository
# - REPOSITORY_ORIGIN: The origin repository from environment setting
# - REPOSITORY_BRANCH: The branch to use for checkouts
echo -e "travis_fold:start:Environment\nEnvironment dump"
set
export
echo "travis_fold:end:Environment"
#######################################################################
# Declare some common variables
REPOSITORIES="smarthome plugins"
LINKS="smarthome/plugins/plugins"
# Get the current repository which is processed
REPOSITORY="$(basename $TRAVIS_REPO_SLUG)"
REPO_OWNER="$(dirname $TRAVIS_REPO_SLUG)"
REPOSITORY_ORIGIN="$REPOSITORY_ORIGIN"
# Find out on which branch to work
#if [ "$TRAVIS_BRANCH" = "master" ] ; then
# REPOSITORY_BRANCH="master"
#else
# REPOSITORY_BRANCH="develop"
#fi
REPOSITORY_BRANCH=$TRAVIS_BRANCH
echo -e "Current branch for $REPOSITORY is $REPOSITORY_BRANCH"
#######################################################################
# 1. Checkout all repositories
echo -e "travis_fold:start:Checkout\nChecking out additional repositories with $REPOSITORY_BRANCH branch"
# Change to root directory since script is started in checkout
cd $TRAVIS_BUILD_DIR/..
# Check out other repositories with develop version
for REPO in $REPOSITORIES ; do
if [ "$REPO" != "$REPOSITORY_ORIGIN" ] ; then
echo "Checking out $REPO ..."
git clone https://github.com/$REPO_OWNER/$REPO.git $REPO
cd $REPO
git checkout $REPOSITORY_BRANCH
cd ..
fi
done
echo "travis_fold:end:Checkout"
#######################################################################
# 2. Create symlinks in repositories
echo -e "travis_fold:start:Links\nCreating symlinks"
# Create symlinks in core repository
for LINK in $LINKS ; do
TARGET=$(dirname "$LINK")
TARGET_REPO=$(dirname "$TARGET")
TARGET_DIR=$(basename "$TARGET")
SOURCE_REPO=$(basename "$LINK")
echo "Create link from $SOURCE_REPO to $TARGET_REPO/$TARGET_DIR ..."
cd $TARGET_REPO
rm -rf $TARGET_DIR
ln -s ../$SOURCE_REPO $TARGET_DIR
cd ..
done
echo "travis_fold:end:Links"
#######################################################################
# 3. Run
echo -e "travis_fold:start:Suite\nRunning suite"
cd smarthome
tox || exit 1
cd ..
echo "travis_fold:end:Suite"
#######################################################################
# 4. Docs
#echo -e "travis_fold:start:Docs\nBuilding documentation"
#cd smarthome/doc
#yes | bash build_doc.sh
#cd ../..
#echo "travis_fold:end:Docs"