-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
89 lines (78 loc) · 1.52 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
include:
- template: Security/Dependency-Scanning.gitlab-ci.yml
- template: Security/License-Scanning.gitlab-ci.yml
- template: Security/SAST.gitlab-ci.yml
- template: Security/Secret-Detection.gitlab-ci.yml
image: node:16
stages:
- setup
- test
- test-report
- build
- publish
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
workflow:
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_BRANCH == "master"
.node-cache:
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- node_modules/
setup-js:
stage: setup
extends: .node-cache
script:
- npm install
test-js:
stage: test
extends: .node-cache
script:
- npm run test
artifacts:
paths:
- coverage
- test-report.xml
- junit.xml
expire_in: 1 days
reports:
cobertura: coverage/cobertura-coverage.xml
lint-js:
stage: test
extends: .node-cache
script:
- npm run lint
sonarcloud-check:
stage: test-report
image:
name: sonarsource/sonar-scanner-cli:latest
entrypoint: [""]
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script:
- sonar-scanner
build-js:
stage: build
extends: .node-cache
script:
- npm run build
artifacts:
paths:
- www
expire_in: 1 days
pages:
stage: publish
script:
- mv www public
dependencies:
- build-js
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == "master"