-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy path.travis.yml
52 lines (41 loc) · 1.23 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
sudo: false
language: ruby
services:
- docker
rvm:
- 2.7.2
cache: bundler
addons:
postgresql: "9.5"
env:
global:
- COMMIT=${TRAVIS_COMMIT::8}
- SANITIZED_BRANCH=$(echo $TRAVIS_BRANCH|sed 's|/|-|g')
- REPO=sheltertechsf/askdarcel-api
before_install:
- nvm install 12
- nvm use 12
# Update bundler because of breaking change
# https://bundler.io/blog/2019/01/04/an-update-on-the-bundler-2-release.html
- gem install bundler -v '2.2.15'
install:
# bundle install command copied from Travis's default install.bundler
- bundle install --jobs=3 --retry=3 --deployment --path=${BUNDLE_PATH:-vendor/bundle}
- npm install -g newman
before_script:
- bundle exec rake db:create db:schema:load
- bundle exec rails swagger
script:
- bundle exec rake rubocop spec
- ./travis/postman.sh
after_success:
- docker build -f Dockerfile -t localimage .
- |
echo Pushing Docker image to Docker Hub
set -eo pipefail
if [[ -n "$TRAVIS_TAG" || "$SANITIZED_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]]; then
DOCKER_IMAGE="$REPO:${TRAVIS_TAG:-latest}"
docker tag localimage "$DOCKER_IMAGE"
docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
docker push "$DOCKER_IMAGE"
fi