-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
96 lines (81 loc) · 2.86 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
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
sudo: required
language: java
addons:
hosts:
- db
env:
global:
- CLOUDSDK_CORE_DISABLE_PROMPTS=1
jdk:
- openjdk11
services:
- docker
install:
- mvn clean install -DskipTests=true -D"maven.javadoc.skip=true" -B -V
jobs:
include:
- stage: Units
install: skip
script:
- mvn test -Dtest="com.napier.group20.places.*Test"
- mvn test -Dtest="com.napier.group20.utils.*ReportTest"
- stage: Integration
script:
- sudo docker build -t db src/main/resources
- sudo docker run --rm -d -p 3306:3306 db
- mvn test -Dtest="com.napier.group20.utils.AppTest"
- stage: GitHub Release
install: skip
script: mvn package -DskipTests=true -D"maven.javadoc.skip=true"
before_deploy:
- git config --local user.name "glugg23"
- git config --local user.email "m.leonhardt424@gmail.com"
- export TRAVIS_TAG=${TRAVIS_TAG:-$(date +'%Y-%m-%d')-$(git log --format=%h -1)}
- git tag $TRAVIS_TAG
deploy:
provider: releases
api_key: $GITHUB_OAUTH_TOKEN
file: $TRAVIS_BUILD_DIR/target/SET08103-G20.jar
skip_cleanup: true
- stage: Google Cloud Deploy
install: skip
jdk: oraclejdk11
before_script:
- if [ ! -d ${HOME}/google-cloud-sdk ]; then curl https://sdk.cloud.google.com | bash
> /dev/null; fi
- source $HOME/google-cloud-sdk/path.bash.inc
- gcloud components install kubectl
- gcloud version
- gcloud auth activate-service-account --key-file client-secret.json
script:
- gcloud config set project set08103-g20-2
- gcloud config set compute/zone europe-west2-b
- export PROJECT_ID="$(gcloud config get-value project -q)"
- gcloud auth configure-docker
- docker build -t gcr.io/${PROJECT_ID}/db src/main/resources
- docker push gcr.io/${PROJECT_ID}/db
- gcloud container clusters create world-cluster --num-nodes=1
- kubectl run world --image=gcr.io/${PROJECT_ID}/db --port 3306
- kubectl expose deployment world --port=3306 --target-port=3306 --type=LoadBalancer
before_script:
- sudo service mysql stop
- sudo service postgresql stop
after_success:
- bash <(curl -s https://codecov.io/bash)
- wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh
- chmod +x send.sh
- ./send.sh success $WEBHOOK_URL
after_failure:
- wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh
- chmod +x send.sh
- ./send.sh failure $WEBHOOK_URL
stages:
- Units
- Integration
- name: GitHub Release
if: branch = master
- name: Google Cloud Deploy
if: branch = master
before_install:
- openssl aes-256-cbc -K $encrypted_9725d73fb555_key -iv $encrypted_9725d73fb555_iv
-in client-secret.json.enc -out client-secret.json -d