This repository has been archived by the owner on Sep 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path.travis.yml
60 lines (60 loc) · 4.19 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
sudo: required
services:
- docker
cache:
directories:
- "$HOME/google-cloud-sdk/"
env:
global:
- IMAGE=leaguesandbox/contributor-role-bot
- DOCKER_USERNAME=leaguesandbox
- secure: oVs6ftexLyxLOYo93CucTxhVYwNOWrmDf4WEo6EEYOZ0ONUy5i7ox/yaYD3Gvkhn74vgid3I0UtvDCoKpxu3jrw8o5M+JQFLrvpd2pppH8u+OMLywY7rhCiRZt5C7eHFwPJ1gWxXJlB/y4figHfE/6Mr7mUOvqdkY8I58Tue0n9qr3uxQuYvLlZanh6LyL0AVXqxTmM122MDBnhQjTqIF9/pZxmR5g3mdiAwWbX2Int2kMkrl3mnN88IZvkTeMQkWySuCs2gsDkMbsMzFHYV7QldjLndmLermgWa7xeuWuSzqcx3YyuNJ5+IZHhCI7MzwI2ShhAKsvQ56Z2NtS/HV2GVxMZw869WVNacDzbEwjNb3sXajFdWHQGknWMrUewnRehybZNFpTlHOiXSzqemm+lxb1FZrsNG8pA2aAqmTWkSBQyL43fa5HJJfRPYzgenf00Azt7dMmsOwn+FRYBTQe1jSJQNAQcsqbWt82PBYEbb3IJQW2MHePnUEnq1HCZ8BfgUhl6cssoge8DWi+oRol+D0zEbDdDXpMQJvtu6/vR0teorUYCyD7ny2auErg0+ejzCxTV+b5WO+dRxX8EBbB0D3Cft32mASmCjaEcvSyLrzY7TSBCjw2N0XRbyFW0jBMiQjMOAIVyo02Eoo6G7kP0zLS7fGoUvvhbW1SaCjrk=
- secure: pnPy+SAk0Jk3/eM0v+JkcOzLK6wvz56DMRCr34pwuSa4AU64JKqLCdNejBMM0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8dtZ1xDPGi2+wWj4ZoGBOG9OJTWtUi11XgeKpowaUzeEZdbS2vAKZW5W8hozA0gsicW4TO5qLHfjSQJ0/R+mCSl99jbRVp2Mr4610TUnTrcCCChCoPoWHHCknqevlGpynbK+NXh/7VZP+e3t3UAFoxJ25eZ+85lde+uCHGXWl1AzD6OpbOJsTZRLsJk9/od0ixJXB1xgO9MQag6PRtO95o+H8PuHOyzg8jlfNA=
jobs:
include:
- stage: test
script:
- docker build --tag $IMAGE:commit-$TRAVIS_COMMIT .
- >
docker run
-e CI=true
-e TRAVIS=true
-e CODECOV_TOKEN=$CODECOV_TOKEN
-e TRAVIS_BRANCH=$TRAVIS_BRANCH
-e TRAVIS_JOB_NUMBER=$TRAVIS_JOB_NUMBER
-e TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST
-e TRAVIS_JOB_ID=$TRAVIS_JOB_ID
-e TRAVIS_TAG=$TRAVIS_TAG
-e TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG
-e TRAVIS_COMMIT=$TRAVIS_COMMIT
--entrypoint "/bin/sh"
$IMAGE:commit-$TRAVIS_COMMIT
-c "pip install -r requirements-dev.txt && pytest --cov && pip install codecov && codecov"
- stage: build
script:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD;
- docker build --tag $IMAGE:commit-$TRAVIS_COMMIT .
- docker push $IMAGE:commit-$TRAVIS_COMMIT
- stage: deploy
script:
- if [ ! -d "$HOME/google-cloud-sdk/bin" ]; then rm -rf $HOME/google-cloud-sdk; export CLOUDSDK_CORE_DISABLE_PROMPTS=1; curl https://sdk.cloud.google.com | bash; fi
- source $HOME/google-cloud-sdk/path.bash.inc
- gcloud components install kubectl
- cd kubernetes
- openssl aes-256-cbc -k "$SERVICE_ACCOUNT_PASSWORD" -in service-account.json.enc -out service-account.json -d
- gcloud auth activate-service-account contributor-role-bot-deploy@league-sandbox.iam.gserviceaccount.com --key-file=service-account.json --project=league-sandbox
- gcloud config set core/project league-sandbox
- gcloud config set compute/zone europe-north1-a
- gcloud container clusters get-credentials bots
- envsubst '${TRAVIS_COMMIT}' < deployment.yaml.template > deployment.yaml
- kubectl apply -f deployment.yaml
- "curl -H 'Content-Type: application/json' -X POST -d '{\"content\": \"Contributor bot updated, commit hash '$TRAVIS_COMMIT'\"}' $DEPLOY_NOTIFY_WEBHOOK"
stages:
- test
- name: build
if: branch = master AND type = push
- name: deploy
if: branch = master AND type = push
notifications:
email: false