forked from saheienko/capacity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtravis_build.sh
executable file
·65 lines (62 loc) · 1.5 KB
/
travis_build.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
#!/bin/bash
export TAG=${TRAVIS_BRANCH:-unstable}
# checks for success of the previous task
check_status () {
if [ $? -eq 0 ]; then
echo "Success"
else
echo "Something failed"
exit 1
fi
}
### Main
echo "Tag Name: ${TAG}"
# If a tag is pushed, tests are run, the docker container is built and pushed to
# dockerhub, and then a release is pushed to the releases page.
if [[ "$TRAVIS_TAG" =~ ^v[0-9]. ]]; then
echo "release"
# run tests
./run_tests.sh
check_status
# Build Docker container
./docker_build.sh
check_status
# Push to Dockerhub
./docker_push.sh
check_status
# Push to releases page
./push_release.sh
check_status
# on an unstable branch, tests are run and the docker container is built and pushed.
elif [[ "$TRAVIS_BRANCH" == *release-* ]]; then
echo "unstable branch"
export TAG="${TAG}-unstable"
echo "Tag Name: ${TAG}"
# run tests
./run_tests.sh
check_status
# Build docker container
./docker_build.sh
check_status
# Push to Dockerhub
./docker_push.sh
check_status
# if a push to master happens, tests are only run
elif [[ "$TRAVIS_BRANCH" == "master" ]]; then
echo "master branch - test will only be run"
echo "Tag Name: ${TAG}"
# run tests
./run_tests.sh
check_status
else
# any other branch is considered a testing branch and will only run tests and build the container.
echo "testing branch - run tests and docker build"
export TAG="${TAG}-testing"
echo "Tag Name: ${TAG}"
# run tests
./run_tests.sh
check_status
# Build docker container
./docker_build.sh
check_status
fi