-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
95 lines (81 loc) · 3.26 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
language: node_js
node_js:
- "10"
rvm:
- 2.6.5
sudo: required
services:
- docker
- memcached
addons:
code_climate:
repo_token: $CODECLIMATE_REPO_TOKEN
chrome: stable
install:
- travis_retry bundle install
- curl -sL https://sentry.io/get-cli/ | bash
- sentry-cli --version
- yarn install --non-interactive
before_script:
- cp .env.travis .env
- mkdir -p tmp/pids
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
script:
- bundle exec rspec spec
after_script:
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
after_success:
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD";
- REPO=crosscite/doi-metadata-search;
- AUTO_DEPLOY=false;
- if [ "${TRAVIS_TAG?}" ]; then
docker build -f Dockerfile -t $REPO:$TRAVIS_TAG .;
docker push $REPO:$TRAVIS_TAG;
echo "Pushed to" $REPO:$TRAVIS_TAG;
AUTO_DEPLOY=true;
elif [ "$TRAVIS_BRANCH" == "master" ]; then
docker build -f Dockerfile -t $REPO .;
docker push $REPO;
echo "Pushed to" $REPO;
AUTO_DEPLOY=true;
else
docker build -f Dockerfile -t $REPO:$TRAVIS_BRANCH .;
docker push $REPO:$TRAVIS_BRANCH;
echo "Pushed to" $REPO:$TRAVIS_BRANCH;
AUTO_DEPLOY=true;
fi
- if [ "$AUTO_DEPLOY" == "true" ]; then
wget https://github.com/jwilder/dockerize/releases/download/v0.6.0/dockerize-linux-amd64-v0.6.0.tar.gz;
tar -xzvf dockerize-linux-amd64-v0.6.0.tar.gz;
rm dockerize-linux-amd64-v0.6.0.tar.gz;
export GIT_SHA=$(git rev-parse --short HEAD);
export GIT_TAG=$(git describe --tags $(git rev-list --tags --max-count=1));
git clone "https://${TRAVIS_SECURE_TOKEN}@github.com/datacite/mastino.git";
./dockerize -template vendor/docker/_doi-metadata-search.auto.tfvars.tmpl:mastino/stage/services/search/_doi-metadata-search.auto.tfvars;
sentry-cli releases new doi-metadata-search:${GIT_TAG} --finalize --project doi-metadata-search;
if [ "${TRAVIS_TAG?}" ]; then
./dockerize -template vendor/docker/_doi-metadata-search.auto.tfvars.tmpl:mastino/prod-eu-west/services/search/_doi-metadata-search.auto.tfvars;
sentry-cli releases deploys doi-metadata-search:${GIT_TAG} new -e production;
else
sentry-cli releases deploys doi-metadata-search:${GIT_TAG} new -e stage;
fi
sentry-cli releases set-commits --auto doi-metadata-search:${GIT_TAG};
cd mastino;
git remote;
git config user.email ${DOCKER_EMAIL};
git config user.name ${DOCKER_USERNAME};
if [ "${TRAVIS_TAG?}" ]; then
git add prod-eu-west/services/search/_doi-metadata-search.auto.tfvars;
git commit -m "Adding doi-metadata-search git variables for commit tagged ${TRAVIS_TAG?}";
git push "https://${TRAVIS_SECURE_TOKEN}@github.com/datacite/mastino.git" master;
else
git add stage/services/search/_doi-metadata-search.auto.tfvars;
git commit -m "Adding doi-metadata-search git variables for latest commit";
git push "https://${TRAVIS_SECURE_TOKEN}@github.com/datacite/mastino.git" master;
fi
fi
notifications:
slack: datacite:Wt8En0ALoTA6Kjc5EOKNDWxN
email: false