-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
45 lines (36 loc) · 1.41 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
language: generic
services:
- docker
env:
global:
- DOCKER_COMPOSE_VERSION=1.24.1
- CC_TEST_REPORTER_ID=777498466b16e0a5aab6758838834f67774f3b3d3bbe7c04b09b3d663974caec
cache:
bundler: true
directories:
- $HOME/docker
before_install:
# install docker-compose
- sudo rm /usr/local/bin/docker-compose
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin
# code-climate
- 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
# docker cache
- if [[ -d $HOME/docker ]]; then ls $HOME/docker/*.tar.gz | xargs -I {file} sh -c "zcat {file} | docker load"; fi
install: skip
before_script:
- docker-compose build
script:
- docker-compose run app bundle exec rake spec
after_script:
# code-climate
- docker-compose run -e TRAVIS_BRANCH -e TRAVIS_COMMIT -e CC_TEST_REPORTER_ID app ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
before_cache:
# Save tagged docker images
- >
mkdir -p $HOME/docker && docker images -a --filter='dangling=false' --format '{{.Repository}}:{{.Tag}} {{.ID}}'
| xargs -n 2 -t sh -c 'test -e $HOME/docker/$1.tar.gz || docker save $0 | gzip -2 > $HOME/docker/$1.tar.gz'