-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
168 lines (155 loc) · 3.9 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
## https://docs.gitlab.com/ce/ci/yaml/README.html
## https://docs.gitlab.com/ee/ci/variables/README.html
include:
- template: Security/SAST.gitlab-ci.yml
###### GENERAL ################################################################
image: node:18
###### VARIABLES ##############################################################
variables:
SAST_EXCLUDED_PATHS: tests, node_modules, coverage, dist
###### TEMPLATES ##############################################################
.general: &general
tags:
- gitlab-org
variables:
GIT_STRATEGY: fetch
.no-tags: &no-tags
rules:
- if: $CI_COMMIT_TAG
when: never
- when: always
###### STAGES #################################################################
stages:
- install
- test
- compile
- post compile
- publish
###### JOBS ###################################################################
dependencies:
<<: *general
<<: *no-tags
stage: install
artifacts:
when: always
paths:
- node_modules
script:
- yarn install
lint:
<<: *general
<<: *no-tags
stage: test
needs:
- job: dependencies
artifacts: true
script:
- yarn lint
verify:
<<: *general
<<: *no-tags
stage: test
needs:
- job: dependencies
artifacts: true
script:
- yarn verify
unit:
<<: *general
<<: *no-tags
stage: test
# coverage: '/All files[^|]*\|[^|]*\s+([\d\.]+).*\|*\s+([\d\.]+).*\|*\s+([\d\.]+).*\|*\s+([\d\.]+).*/'
coverage: '/All files[^|]*\|[^|]*\s+[\d\.]+.*\|*\s+([\d\.]+).*\|*\s+[\d\.]+.*\|*\s+[\d\.]+.*/'
needs:
- job: dependencies
artifacts: true
artifacts:
when: always
paths:
- junit.xml
- coverage
reports:
junit: junit.xml
expire_in: 1 month
script:
- yarn test:unit --ci --colors --coverage --coverageReporters=html text --reporters=default jest-junit
ts to js:
<<: *general
<<: *no-tags
stage: compile
needs:
- job: dependencies
artifacts: true
artifacts:
paths:
- dist
expire_in: 1 month
script:
- yarn compile:ci
integration test:
<<: *general
<<: *no-tags
stage: post compile
# coverage: '/All files[^|]*\|[^|]*\s+([\d\.]+).*\|*\s+([\d\.]+).*\|*\s+([\d\.]+).*\|*\s+([\d\.]+).*/'
coverage: '/All files[^|]*\|[^|]*\s+[\d\.]+.*\|*\s+([\d\.]+).*\|*\s+[\d\.]+.*\|*\s+[\d\.]+.*/'
needs:
- job: dependencies
artifacts: true
- job: ts to js
artifacts: true
script:
- yarn test:integration --ci --colors --coverage --coverageReporters=html text --reporters=default jest-junit
new release:
<<: *general
stage: publish
allow_failure: true
rules:
- if: $CI_COMMIT_TAG
when: never
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: on_success
image:
name: registry.gitlab.com/go-semantic-release/semantic-release:latest
entrypoint: [""]
needs:
- job: lint
artifacts: false
- job: unit
artifacts: false
- job: verify
artifacts: false
- job: ts to js
artifacts: false
- job: integration test
artifacts: false
artifacts:
paths:
- .version
expire_in: 1 month
when: on_success
script:
- semantic-release --provider gitlab --version-file
# - semantic-release --provider gitlab --version-file --allow-initial-development-versions # Once stable, remove this and uncomment previous line
npm package:
<<: *general
stage: publish
rules:
- if: $CI_COMMIT_TAG
when: never
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: on_success
- exists:
- .version
when: always
- when: never
needs:
- job: new release
artifacts: true
- job: ts to js
artifacts: true
before_script:
- test -f .version || exit 0 # If no `.version` file found, just exit
script:
- echo "${npmrc}" > ~/.npmrc
- echo "Publish version $(cat .version)"
- yarn publish --new-version $(cat .version) --no-git-tag-version --non-interactive