forked from teracyhq-incubator/angular-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
43 lines (43 loc) · 1.66 KB
/
.travis.yml
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
services:
- docker
env:
global:
CI_BUILD_TIME: $(date -u +"%Y-%m-%dT%H:%M:%SZ")
CI_REGISTRY_IMAGE: $DOCKER_IMAGE
DOCKER_COMPOSE_VERSION: 1.11.2
before_install:
# install the latest docker and docker-compose versions
- sudo apt-get remove docker docker-engine
- sudo curl -sSL https://get.docker.com/ | sh
- sudo rm /usr/local/bin/docker-compose
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin
- docker --version
- docker-compose --version
before_script:
- cp .env.example .env
- export $(cat .env | grep -v ^# | xargs)
- export TAG=`if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH | sed -e 's/[\/]/-/g' | sed -e 's/[\#]//g'; fi`
- export DOCKER_IMAGE_DEV=$CI_REGISTRY_IMAGE:dev_$TAG
- export DOCKER_IMAGE_PROD=$CI_REGISTRY_IMAGE:$TAG
- export CI_BUILD_ID=$TRAVIS_BUILD_ID
- export CI_BUILD_REF=$TRAVIS_COMMIT
- export CI_BUILD_REF_NAME=$TRAVIS_BRANCH
- export CI_PROJECT_NAME=$TRAVIS_REPO_SLUG
- chmod +x setup.sh
- ./setup.sh
script:
- docker-compose build --pull
# run and check the dev container
- docker-compose run --rm dev npm run lint
- docker-compose run --rm dev ng test --browsers Chrome_no_sandbox -w false
- docker-compose run --rm dev npm run e2e
# build, run and check the prod image
- sudo rm -rf .com.google.Chrome*
- docker-compose run --rm dev ng build --prod
- docker-compose -f docker-compose.prod.yml build --pull
after_success:
- docker login -u=$DOCKER_USERNAME -p=$DOCKER_PASSWORD
- docker push $DOCKER_IMAGE_DEV
- docker push $DOCKER_IMAGE_PROD