Skip to content

Commit

Permalink
Merge pull request apache#26 from asifdxtreme/master
Browse files Browse the repository at this point in the history
Configuration for multiple jobs in travis CI
  • Loading branch information
TankTian authored Jul 12, 2017
2 parents 0d0287a + 969e338 commit c45035e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 10 deletions.
19 changes: 12 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,23 @@ before_install:
- go get github.com/onsi/gomega/gbytes
- go get github.com/FiloSottile/gvt

install: true

script:
before_script:
- mkdir -p $HOME/gopath/src/github.com/servicecomb/service-center
- rsync -az ${TRAVIS_BUILD_DIR}/ $HOME/gopath/src/github.com/servicecomb/service-center/
- export TRAVIS_BUILD_DIR=$HOME/gopath/src/github.com/servicecomb/service-center
- cd $HOME/gopath/src/github.com/servicecomb/service-center
- gvt restore
- CGO_ENABLED=0 GO_EXTLINK_ENABLED=0 go build --ldflags '-w -extldflags "-static"' -o servicecenter
- bash -x tests/scripts/ut_test_in_docker.sh
- $HOME/gopath/bin/goveralls -coverprofile=coverage.txt -service=travis-ci

install: true

jobs:
include:
- stage: Building Service Center
script: CGO_ENABLED=0 GO_EXTLINK_ENABLED=0 go build --ldflags '-w -extldflags "-static"' -o servicecenter
- stage: Unit Testing
script: bash -x tests/scripts/ut_test_in_docker.sh && $HOME/gopath/bin/goveralls -coverprofile=coverage.txt -service=travis-ci
- stage: Integration Testing
script: bash -x tests/scripts/integration_test.sh


after_success:
- bash <(curl -s https://codecov.io/bash)
26 changes: 23 additions & 3 deletions tests/scripts/integration_test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
echo "${green}Building Service-center${reset}"

go build -o service-center $GOPATH/src/github.com/servicecomb/service-center
go build -o service-center github.com/servicecomb/service-center
if [ $? == 0 ]; then
echo "${green}Service-center built successfully..${reset}"
else
Expand All @@ -10,6 +10,10 @@ else
fi

echo "${green}Starting etcd in docker${reset}"
set +e
docker rm -f etcd
kill -9 $(ps aux | grep 'service-center' | awk '{print $2}')
set -e
docker run -d -v /usr/share/ca-certificates/:/etc/ssl/certs -p 40010:40010 -p 23800:23800 -p 2379:2379 --name etcd quay.io/coreos/etcd etcd -name etcd0 -advertise-client-urls http://127.0.0.1:2379,http://127.0.0.1:40010 -listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:40010 -initial-advertise-peer-urls http://127.0.0.1:23800 -listen-peer-urls http://0.0.0.0:23800 -initial-cluster-token etcd-cluster-1 -initial-cluster etcd0=http://127.0.0.1:23800 -initial-cluster-state new
while ! nc -z 127.0.0.1 2379; do
echo "Waiting Etcd to launch on 2379..."
Expand All @@ -19,8 +23,9 @@ echo "${green}Etcd is running......${reset}"

echo "${green}Running the service-center for IT....${reset}"

cp -r /etc/conf conf
./service-center
cp -r etc/conf conf
./service-center > start-sc.log 2>&1 &

if [ $? == 0 ]; then
echo "${green}Service-center is running now..${reset}"
else
Expand All @@ -33,3 +38,18 @@ echo "${green}Starting the integration test now....${reset}"
cd tests/integrationtest
go test -v

if [ $? == 0 ]; then
echo "${green}All the integration test passed..${reset}"
else
echo "${red}Some or all the integration test failed..please check the logs for more details.${reset}"
set +e
docker rm -f etcd
kill -9 $(ps aux | grep 'service-center' | awk '{print $2}')
set -e
exit 1
fi
echo "Cleaning the env"
set +e
docker rm -f etcd
kill -9 $(ps aux | grep 'service-center' | awk '{print $2}')
set -e

0 comments on commit c45035e

Please sign in to comment.