-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
82 lines (72 loc) · 1.66 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
image: node:latest
services:
- docker:dind
stages:
- build
- test
- package
stages:
- build
- test
- package
before_script:
- npm install --silent --progress=false
cache:
paths:
- node_modules/
variables:
CONTAINER_IMAGE: registry.gitlab.com/$CI_PROJECT_PATH
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
NODE_ENV: 'test'
lint:
stage: build
script:
npm run tslint
variables:
NODE_ENV: 'test'
DB_SERVER: 'mongo'
CONTAINER_IMAGE: registry.gitlab.com/$CI_PROJECT_PATH
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
integration_tests:
services:
- mongo:latest
stage: test
script:
- npm run test:integration
repository_unit_tests:
services:
- mongo:latest
stage: test
script:
- npm run test:repository
validator_unit_tests:
stage: test
script:
- npm run test:validation
review:
stage: build
image: docker:latest
cache: {}
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
script:
- docker pull $CONTAINER_IMAGE:latest || true
- docker build --cache-from $CONTAINER_IMAGE:latest --tag $CONTAINER_IMAGE:test .
- docker push $CONTAINER_IMAGE:test
only:
- template-mongodb
release:
stage: package
image: docker:latest
cache: {}
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
script:
- docker pull $CONTAINER_IMAGE:latest || true
- docker build --cache-from $CONTAINER_IMAGE:latest --tag $CONTAINER_IMAGE:$CI_COMMIT_TAG --tag $CONTAINER_IMAGE:latest .
- docker push $CONTAINER_IMAGE:$CI_COMMIT_TAG
- docker push $CONTAINER_IMAGE:latest
only:
- tags