-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.travis.yml
58 lines (56 loc) · 2.13 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
language: php
jobs:
include:
- stage: test
php: 7.2
before_script:
- echo "extension = mongodb.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- composer install --prefer-dist --no-interaction
script:
- composer phpstan
- stage: build
services:
- docker
script:
- docker build . --tag thecodingmachine/packanalyst:latest
- |
if [[ "$TRAVIS_PULL_REQUEST" = false && "$TRAVIS_BRANCH" = "master" ]] ; then
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker push thecodingmachine/packanalyst:latest
fi
- stage: deploy
services:
- docker
branches:
only:
- master
cache:
directories:
# We cache the SDK so we don't have to download it again on subsequent builds.
- $HOME/google-cloud-sdk
env:
- CLOUDSDK_CORE_DISABLE_PROMPTS=1
script:
- |
if [[ "$TRAVIS_PULL_REQUEST" = false ]] ; then
if [ ! -d $HOME/google-cloud-sdk/bin ]; then
# The install script errors if this directory already exists,
# but Travis already creates it when we mark it as cached.
rm -rf $HOME/google-cloud-sdk;
# The install script is overly verbose, which sometimes causes
# problems on Travis, so ignore stdout.
curl https://sdk.cloud.google.com | bash > /dev/null;
fi
source $HOME/google-cloud-sdk/path.bash.inc
gcloud components update kubectl
gcloud version
echo "$GCLOUD_SERVICE_KEY" > key.json
gcloud auth activate-service-account --key-file key.json
gcloud config set project $GCLOUD_PROJECT
gcloud container clusters get-credentials $GKE_CLUSTER --zone $ZONE --project $GCLOUD_PROJECT
kubectl create namespace packanalyst || true
kubectl -n packanalyst delete deployment --all
kubectl -n packanalyst delete secret tcmregistry || true
cd kubernetes
kubectl -n packanalyst apply -f .
fi