-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.travis.yml
67 lines (57 loc) · 1.93 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
language: node_js
notifications:
email: false
node_js:
- "12.18.2"
services:
- mongodb
before_install:
- if [ "$TRAVIS_BRANCH" == "master" ]; then
openssl aes-256-cbc -K $encrypted_6c0fe41f00fc_key -iv $encrypted_6c0fe41f00fc_iv
-in .travis/deploy_key.enc -out .travis/deploy_key -d;
fi
before_script:
- sleep 10
- mongo calendz --eval 'db.createUser({user:"username",pwd:"password",roles:["readWrite"]});'
install: npm install
jobs:
include:
- stage: Tests
if: |
branch = develop AND \
tag IS blank AND \
commit_message !~ /(no-deploy|wip)/
script:
- npm run lint
- npm run test:mock
- npm run test:coverage
- npm run test:coveralls
after_success:
- wget https://raw.githubusercontent.com/calendz/travis-discord-webhook/master/send.sh
- chmod +x send.sh
- ./send.sh success $DISCORD_WEBHOOK_URL
after_failure:
- wget https://raw.githubusercontent.com/calendz/travis-discord-webhook/master/send.sh
- chmod +x send.sh
- ./send.sh failure $DISCORD_WEBHOOK_URL
# Build and push both versionned and current versions
- stage: Build Docker image
if: branch = master
script:
- "PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]')"
- echo "==== Building calendz/api:$PACKAGE_VERSION ===="
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker build -t calendz/api .
- docker images
- docker tag calendz/api calendz/api:current
- docker tag calendz/api calendz/api:${PACKAGE_VERSION}
- docker push calendz/api:current
- docker push calendz/api:${PACKAGE_VERSION}
# Deploy latest API version
- stage: Deploy
if: branch = master
script:
- sh .travis/deploy.sh
cache:
directories:
- node_modules