-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
72 lines (68 loc) · 1.76 KB
/
.gitlab-ci.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
cache:
paths:
- node_modules/
stages:
- test
- build
- deploy
test:
retry:
max: 2
image: node:8.17.0-stretch
stage: test
services:
- postgres:10
- redis:5
variables:
POSTGRES_DB: dispute_tools_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: letmein
DB_HOST: postgres
DB_USER: postgres
DB_PASSWORD: letmein
REDIS_HOST: redis
REDIS_PORT: 6379
before_script:
- cp config/config.sample.js config/config.js
- cp config/knexfile.sample.js knexfile.js
- wget --no-check-certificate --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
- sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
- apt-get update
- apt-get install -y pdftk fontconfig ghostscript postgresql-client-10
- yarn install
- yarn build
script:
- yarn test
- yarn report
build:
retry:
max: 1
image: docker:stable
services:
- docker:dind
stage: build
script:
- docker build -t debtcollective/dispute-tools:${CI_COMMIT_SHORT_SHA} .
- mkdir -p image
- docker save debtcollective/dispute-tools:${CI_COMMIT_SHORT_SHA} > image/dispute-tools.tar
artifacts:
paths:
- image
deploy:
retry:
max: 1
image: docker:stable
services:
- docker:dind
stage: deploy
services:
- docker:dind
before_script:
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
- docker load -i image/dispute-tools.tar
script:
- docker tag debtcollective/dispute-tools:${CI_COMMIT_SHORT_SHA} debtcollective/dispute-tools:latest
- docker push debtcollective/dispute-tools:${CI_COMMIT_SHORT_SHA}
- docker push debtcollective/dispute-tools:latest
only:
- master