-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
87 lines (68 loc) · 3.58 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
language: node_js
services: docker
node_js: 6.10
env:
global:
- AWS_ACCESS_KEY_ID=AKIAI6AOG5SJK5JVZHAA
- AWS_DEFAULT_REGION=ap-southeast-2
- LAMBDA_NAME=awsBillingAlerts
- LAMBDA_ALIAS=prod
- SNS_TOPIC=arn:aws:sns:ap-southeast-2:873114526714:admin-notifications
- BUCKET_NAME=aws-admin-timmalone
# AWS_SECRET_ACCESS_KEY
- secure: V2p3mGY5eUNEQPEkXhJ/94mLX0eZ0vh1IPCmoNjjVsYrl4uHLTGFUp4/+eq6vFTFDPYX+SCz0kyzvPjMOG3IB+BZrbIWBS4Lz9ryZPj0JEisulfwlE5BSjzTkch7kC5jt+Ii44k9liV2VellrUgd2/GtwjmFyOWUUrPwe4qeBSMAHFOS5g3lGweaQJFPXuM03YFg8DrpyY7qC+vH0X6COvXZdQvnTMzqFw8yWc6lD9Yi13yirutjp5MK03iqUSnvcqjb4/ziU2pj1nXhjRQRLwLcKgy/p4QnV/+BUm/kA/BR2BkkG892CXanNqbQjqGjdtXmVvmac6j1Es16PsDiOs7f9DM6hzDxDFHFd9F9jblvRQdnZSwWfxk6KhpMxcxV2+iwO0XpTRpIIDe/Z3pIgIBP9RrkoJXCSyc2J5Dq5prKNdmZWvp3Eeq5F21QXpKt1g90z8nK/fnOhve/TuoT4/wGoQunZg6lST5Kwx8gtP3og575Gcw/hUmm8fYvsMhF9w+d5S2zE897SgOiSHLKcoIsOgZtr8pz5IC9vooal/vu5y8r0QXiNZMHJVuQg1UhbKH2WBb5oCUoKg891FEk7RSudRxo8HFFLWoHHhmCDLvAJQm+TjfSJ9mA6lvPpjkdRlU9jd0YKEJl3cXx7JvZjrdcQpoYjvhs0UdkhpK+U94=
cache:
yarn: true
directories:
- node_modules
install: yarn
script:
- yarn lint
- yarn test
before_deploy: yarn remove aws-sdk && rm -rf coverage node_modules tests .*rcs.js && yarn --prod
deploy:
# Deploy to $LATEST on dev branch. (i.e. don't publish a new version).
- on:
branch: dev
publish: false
provider: lambda
function_name: $LAMBDA_NAME
region: $AWS_DEFAULT_REGION
role: arn:aws:iam::873114526714:role/genericLambdaRole
description: Sends SNS alerts when the current month's bill changes.
runtime: nodejs6.10
timeout: 30
handler_name: handler
access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY
skip_cleanup: true
# Deploy and publish a new version on master branch.
- on:
branch: master
publish: true
provider: lambda
function_name: $LAMBDA_NAME
region: $AWS_DEFAULT_REGION
role: arn:aws:iam::873114526714:role/genericLambdaRole
description: Sends SNS alerts when the current month's bill changes.
runtime: nodejs6.10
timeout: 30
handler_name: handler
access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY
skip_cleanup: true
after_deploy:
# Set a Lambda alias to the most recently deployed version.
- if [ "master" = "${TRAVIS_BRANCH}" ]; then
pip install awscli --upgrade --user;
export MOST_RECENT=$(aws lambda list-versions-by-function --function "${LAMBDA_NAME}" --max-items 10000 | node -e "let stdin=''; process.stdin.on('data',(chunk)=>{stdin+=chunk}).on('end',()=>{console.log(JSON.parse(stdin).Versions.pop().Version)})");
aws lambda update-alias --function-name "${LAMBDA_NAME}" --name "${LAMBDA_ALIAS}" --function-version "${MOST_RECENT}";
fi;
notifications:
email: false
webhooks:
urls: https://api.tm.id.au/v2/travis/jobStatus
slack:
on_start: always
rooms:
- secure: ynaWkeVqOPxokV7R3Hi4qhiyTVwUbvDaglXajL6iUzUFvjTuIxHSCMsvFbff9WdD2QxEUGFopvxaVd0faDali5UeACY+KOYh/atOw7AnxZKej2m00zBo54jwLrX88ObGT5TBk7Nzuls4cTprIFxq8AcudC2qUilDdOn9OfhPiLz8VUhPBYT2AMTs8ShP9XdOA1BOXmHWICWvrm0KMOYcyZ4dJ62XdToZLBhDuwRvU7/dcWDiyQdb23ax1Aq6aHhwzXPKK09Urb4N39aGEdVekQ7ubc5qAya7pEf7IMPZ+rjr+sC2M/kmAuu7DZxaUdyAuZj1teVB3Hwo4K7ajXPHlSuBVZZQMn14CMn07kF6/rgNhMcV8BL55LmpUggPwhG+C1xeHAIzr1BXDc6DNhWGH/6oPTOkjKe3XxMl2S2XM0o4dimZi7IEPjw4eVsZUbFSbxEsVYr0GhDE6GNFtUN4YqH+eSTPa5eeN5FAPE6Pa94RCrFaSJbz0F2CjCnPJLViMDFowTSDqdY9wufeTnVN5SbynWOFeY2Ku5h70R11UTEeCKwyZRojKujD87n99GnbsM7GjK8CH+vD95M2zSIKahJLX8fDUlKsbFDfXNrhvxDePaxzVKHl/cuJ+cd2O08SVkiDDQn4uATiZzG5iiMV87BdwVmxDiUrwGMVXl6wplg=