This repository has been archived by the owner on Dec 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
85 lines (79 loc) · 2.47 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
73
74
75
76
77
78
79
80
81
82
83
84
85
stages:
- test
- deploy
variables:
APPLICATION_NAME: astarte_appengine_api
mix:test-coverage:
stage: test
image: elixir:1.8.1
services:
- cassandra:3.11.5
- rabbitmq:3.7.21
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- deps
- _build
before_script:
- mix local.hex --force
- mix local.rebar
- mix deps.get
script:
- mix format --check-formatted
- mix coveralls
mix:test-dialyzer:
stage: test
image: elixir:1.8.1
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- deps
- _build
- dialyzer_cache
before_script:
- mix local.hex --force
- mix local.rebar
- export MIX_ENV=ci
- mix deps.get
script:
# TODO: we do this until we fix all dialyzer errors to force a CI success, so that plts get cached
- mix dialyzer || echo "Done"
docker:test-container:
stage: test
image: docker:latest
only:
- merge_requests
services:
- docker:stable-dind
before_script:
- docker info
script:
- docker build -t $CI_REGISTRY/astarte-ng/astarte_appengine_api:testing .
docker:snapshot-prod-container:
stage: deploy
image: docker:latest
only:
- branches@Astarte-NG/astarte_appengine_api
services:
- docker:stable-dind
before_script:
- docker info
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
script:
- export IMAGE_TAG=$([[ $CI_COMMIT_REF_NAME == "master" ]] && echo "snapshot" || echo $CI_COMMIT_REF_NAME | sed 's/release-\(.*\)/\1-snapshot/g')
- docker build -t $CI_REGISTRY/astarte-ng/astarte_appengine_api:$IMAGE_TAG .
- docker push $CI_REGISTRY/astarte-ng/astarte_appengine_api:$IMAGE_TAG
docker:snapshot-dev-container:
stage: deploy
image: docker:latest
only:
- branches@Astarte-NG/astarte_appengine_api
services:
- docker:stable-dind
before_script:
- docker info
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
script:
- export IMAGE_TAG=$([[ $CI_COMMIT_REF_NAME == "master" ]] && echo "snapshot" || echo $CI_COMMIT_REF_NAME | sed 's/release-\(.*\)/\1-snapshot/g')-dev
- docker build --build-arg BUILD_ENV=dev -t $CI_REGISTRY/astarte-ng/astarte_appengine_api:$IMAGE_TAG .
- docker push $CI_REGISTRY/astarte-ng/astarte_appengine_api:$IMAGE_TAG