-
Notifications
You must be signed in to change notification settings - Fork 21
/
.gitlab-ci.yml
71 lines (56 loc) · 1.65 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
stages:
- test
- release
test:
image: registry.gitlab.com/matthieusegret/yummy-phoenix-graphql/ci:1.2
stage: test
services:
- postgres:latest
cache:
untracked: true
key: ${CI_COMMIT_REF_SLUG}
paths:
- deps
- _build
- client/node_modules
variables:
POSTGRES_DB: yummy_graphql_test
POSTGRES_HOST: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: 'postgres'
MIX_ENV: 'test'
before_script:
- fakes3 -r .s3bucket -p 4567 > /dev/null 2>&1 &
- npm run build
- npm run test.server > /dev/null 2>&1 &
- mix deps.get --only test
- mix ecto.migrate
script:
- mix test
before_script:
- mkdir -p $HOME/.docker
- echo "$DOCKER_AUTH_CONFIG" >> "$HOME/.docker/config.json"
frontend:
image: docker:stable
stage: release
variables:
CONTAINER_IMAGE: gcr.io/yummy-phoenix-graphql/frontend
services:
- docker:dind
script:
- docker pull $CONTAINER_IMAGE:latest || true
- docker build --cache-from $CONTAINER_IMAGE:latest --tag $CONTAINER_IMAGE:$CI_BUILD_REF --tag $CONTAINER_IMAGE:latest -f dockerfiles/frontend.dockerfile .
- docker push $CONTAINER_IMAGE:$CI_BUILD_REF
- docker push $CONTAINER_IMAGE:latest
api:
image: docker:stable
stage: release
variables:
CONTAINER_IMAGE: gcr.io/yummy-phoenix-graphql/api
services:
- docker:dind
script:
- docker pull $CONTAINER_IMAGE:latest || true
- docker build --cache-from $CONTAINER_IMAGE:latest --tag $CONTAINER_IMAGE:$CI_BUILD_REF --tag $CONTAINER_IMAGE:latest -f dockerfiles/api.dockerfile .
- docker push $CONTAINER_IMAGE:$CI_BUILD_REF
- docker push $CONTAINER_IMAGE:latest