-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
executable file
·99 lines (92 loc) · 1.85 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
image: node:8.16.2-buster-slim
stages:
- Prepare-prod
- Prepare-dev
- Test
- Build
- Container
prep-prod:npm-install:
stage: Prepare-prod
only:
- tags
- merge_requests
script:
- npm ci --only=production
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
artifacts:
name: "$CI_JOB_STAGE-$CI_COMMIT_REF_NAME"
expire_in: 2h
paths:
- node_modules/
prep-dev:npm-install-dev:
stage: Prepare-dev
dependencies:
- prep-prod:npm-install
only:
- tags
- merge_requests
script:
- npm ci
cache:
key: ${CI_COMMIT_REF_SLUG}_devnpm
paths:
- node_modules/
artifacts:
name: "$CI_JOB_STAGE-$CI_COMMIT_REF_NAME"
expire_in: 2h
paths:
- node_modules/
linting:html-report:
stage: Test
dependencies:
- prep-dev:npm-install-dev
only:
- tags
- merge_requests
script:
- npm run lint -- --format html --output-file ./eslint-report.html
artifacts:
name: "$CI_JOB_STAGE-$CI_COMMIT_REF_NAME"
expire_in: 31d
when: always
paths:
- eslint-report.html
linting:audit:
stage: Test
dependencies:
- prep-dev:npm-install-dev
only:
- tags
- merge_requests
script:
- npm audit || true
build:project:
stage: Build
only:
- tags
script:
- npm run build
dependencies:
- prep-dev:npm-install-dev
artifacts:
name: "$CI_JOB_STAGE-$CI_COMMIT_REF_NAME"
expire_in: 2h
paths:
- build/
build:container:
stage: Container
image: docker:18.09.8-dind
services:
- docker:18.09.8-dind
only:
- tags
dependencies:
- prep-prod:npm-install
- build:project
script:
- docker build -f Dockerfile -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME} .
- docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY
- docker push ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}