-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
188 lines (150 loc) · 4.99 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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
image: node:latest
stages:
- fetch
- build
- test
- deploy
default:
before_script:
- . /root/.profile
- npm config set @candlelib:registry https://$GITLAB_HOST:9443/api/v4/projects/3/packages/npm/
- npm config set -- //$GITLAB_HOST:9443/api/v4/projects/3/packages/npm/:_authToken ${NPM_DEPLOY_TOKEN}
- export NODE_EXTRA_CA_CERTS=${GITLAB_PUBLIC_CRT}
- npm install -g yarn
# cache:
# paths:
# - node_modules/
# - packages/core/hc_ts_common/build/
# - packages/core/hc_asytrip/build/
# - packages/core/hc_bytecode/build/
# - packages/core/hc_grammar/build/
# - packages/core/hc_root/build/
# - packages/core/hc_tools/build/
# - packages/rt_typescript/build/
# - packages/**/publish.bounty
# - packages/**/package.json
fetch_dependencies:
stage: fetch
script:
- npm install --no-audit
rules:
- if: $CI_COMMIT_REF_NAME != "gitlab-ci"
when: never
- when: always
artifacts:
expire_in: 15 min
paths:
- node_modules/
# BUILD ----------------------------------------------------------------------
build_typescript_packages:
stage: build
rules:
- if: $CI_COMMIT_REF_NAME != "gitlab-ci"
when: never
- when: always
script:
- npm install typescript
- npx tsc -p ./packages/core/hc_ts_common/tsconfig.json || true
- npx tsc -p ./packages/core/hc_asytrip/tsconfig.json || true
- npx tsc -p ./packages/core/hc_bytecode/tsconfig.json || true
- npx tsc -p ./packages/core/hc_grammar/tsconfig.json || true
- npx tsc -p ./packages/core/hc_root/tsconfig.json || true
- npx tsc -p ./packages/core/hc_tools/tsconfig.json || true
- npx tsc -p ./packages/rt_typescript/tsconfig.json || true
artifacts:
expire_in: 2 hours
paths:
- packages/core/hc_ts_common/build/
- packages/core/hc_asytrip/build/
- packages/core/hc_bytecode/build/
- packages/core/hc_grammar/build/
- packages/core/hc_root/build/
- packages/core/hc_tools/build/
- packages/rt_typescript/build/
dependencies:
- fetch_dependencies
# TEST & VERSION -----------------------------------------------------------
version_ts_modules:
stage: test
variables:
GIT_STRATEGY: clone
rules:
- if: $CI_COMMIT_REF_NAME != "gitlab-ci"
when: never
- when: always
before_script:
- TOKENED_REPO=http://git:$GITLAB_ACCESS_TOKEN@$GITLAB_HOST:$GITLAB_HTTP_PORT/$GITLAB_REPO_PATH
- git remote add gitlab $TOKENED_REPO || git remote set-url gitlab $TOKENED_REPO
- git config --global user.email "hydrocarbon-authors@null.io"
- git config --global user.name "Gitlab Runner"
- git fetch --all
- npm config set registry http://$NPM_REGISTRY
script:
- npm run version_ts_packages
after_script:
- git checkout $STAGED_VERSION_BRANCH
- git branch -u gitlab/$STAGED_VERSION_BRANCH
- git push
artifacts:
paths:
- "./*.bounty"
- packages/**/*.bounty
- packages/**/*.temp.json
dependencies:
- fetch_dependencies
- build_typescript_packages
# DEPLOY ------------------------------------------------------------------
publish_ts_packages:
stage: deploy
before_script:
- echo '//${NPM_REGISTRY}/:_authToken=${NPM_TOKEN}'> ~/.npmrc
rules:
- if: $CI_COMMIT_REF_NAME != "gitlab-ci"
when: never
- when: always
script:
- npm config set registry http://$NPM_REGISTRY
- ./root.publish.bounty
dependencies:
- version_ts_modules
- fetch_dependencies
- build_typescript_packages
deploy_to_gitlab_branch:
stage: deploy
rules:
- if: $CI_COMMIT_REF_NAME != "gitlab-ci"
when: never
- when: always
variables:
GIT_STRATEGY: clone
before_script:
- TOKENED_REPO=http://git:$GITLAB_ACCESS_TOKEN@$GITLAB_HOST:$GITLAB_HTTP_PORT/$GITLAB_REPO_PATH
- git remote add gitlab $TOKENED_REPO || git remote set-url gitlab $TOKENED_REPO
- git config --global user.email "hydrocarbon-authors@null.io"
- git config --global user.name "Gitlab Runner"
- git fetch --all
- git checkout --track gitlab/$STAGED_VERSION_BRANCH
script:
- ./root.commit.bounty
- git push -f gitlab HEAD:$STAGED_VERSION_BRANCH
dependencies:
- version_ts_modules
- fetch_dependencies
- build_typescript_packages
publish_ts_packages_npm:
stage: deploy
rules:
- if: $CI_COMMIT_REF_NAME == "release"
when: always
- when: never
before_script:
- echo '//${PUBLIC_NPM_REGISTRY}/:_authToken=${PUBLIC_NPM_TOKEN}'> ~/.npmrc
script:
- npm publish --access public ./packages/core/hc_ts_common/ || true
- npm publish --access public ./packages/core/hc_asytrip/ || true
- npm publish --access public ./packages/core/hc_bytecode/ || true
- npm publish --access public ./packages/core/hc_grammar/ || true
- npm publish --access public ./packages/core/hc_root/ || true
- npm publish --access public ./packages/core/hc_tools/ || true
- npm publish --access public ./packages/rt_typescript/ || true
# reference https://docs.gitlab.com/ee/ci/yaml/