-
Notifications
You must be signed in to change notification settings - Fork 12
/
.gitlab-ci.yml
203 lines (193 loc) · 6.26 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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
# run pipeline only on MRs and main branches
- if: $CI_COMMIT_REF_PROTECTED
default:
tags:
- glexecutor-docker
image: public.ecr.aws/docker/library/node:18
cache: # Cache modules in between jobs, update also the build-job job!
key: $CI_COMMIT_REF_SLUG
paths:
- .npm/
- node_modules/
policy: pull
retry:
max: 2
when:
- runner_system_failure
variables:
FF_NETWORK_PER_BUILD: "true"
CI_DEBUG_SERVICES: "true"
ORESTES_BRANCH: "master"
NODE_BRANCH: "master"
stages:
- build
- validate
- test
- release
build-job:
stage: build
cache: # Cache modules in between jobs, update als the default job!
key: $CI_COMMIT_REF_SLUG
paths:
- .npm/
- node_modules/
policy: pull-push
script:
- npm ci --cache .npm --prefer-offline
- npm run dist
artifacts:
paths:
- dist
- commonjs
expire_in: 30 mins
lint-job:
stage: validate
script:
# prepare linting for the cli
- npm link .
- npm run lint
allow_failure: true
commitlint:
image: public.ecr.aws/docker/library/node:18
cache: []
stage: validate
before_script:
- npm install -g @commitlint/{config-conventional,cli}
script:
- commitlint --from="$CI_MERGE_REQUEST_DIFF_BASE_SHA" --verbose
rules:
- if: $CI_MERGE_REQUEST_IID != null
node-test-job:
image: public.ecr.aws/docker/library/node:$NODE_VERSION
stage: test
dependencies:
- build-job
variables:
TEST_SERVER: "https://local.baqend.com:8443/v1"
parallel:
matrix:
- NODE_VERSION: [ 16, 18, 20 ]
services:
- name: public.ecr.aws/docker/library/mongo:4
alias: mongo
- public.ecr.aws/docker/library/redis:5.0
- name: public.ecr.aws/localstack/localstack:latest
alias: localstack
variables:
SERVICES: s3,sns
- name: public.ecr.aws/aws-cli/aws-cli:latest
entrypoint:
- '/bin/bash'
- '-c'
- |
curl --retry 5 --retry-max-time 120 http://localstack:4566; # wait for localstack to come up
aws --endpoint-url=http://localstack:4566 s3 mb s3://asset-files;
aws --endpoint-url=http://localstack:4566 s3api put-object --bucket=asset-files --key status;
command: ["--endpoint-url=http://localstack:4566", "s3api", "put-object", "s3://asset-files"]
alias: orestes-init
- name: "${CI_REGISTRY}/team-backend/orestes/orestes-node:${NODE_BRANCH}"
alias: node
command: [ "tcp://local.baqend.com:8081", "http://local.baqend.com:8080/v1", "debug" ]
pull_policy: [always, if-not-present]
- name: "${CI_REGISTRY}/team-backend/orestes/orestes-server:${ORESTES_BRANCH}"
alias: local.baqend.com
pull_policy: [always, if-not-present]
variables:
ORESTES_MONGO_ENABLED: "true"
ORESTES_MONGO_SERVERS: "tcp://mongo:27017"
AWS_ACCESS_KEY_ID: anykey
AWS_SECRET_ACCESS_KEY: anysecret
ORESTES_AWS_S3_ENABLED: "true"
ORESTES_AWS_S3_ENDPOINT: http://localstack:4566
ORESTES_AWS_S3_BUCKET: asset-files
ORESTES_STATE_LOCATION: memory:/
ORESTES_BLOOMFILTER_LOCATION: memory:/
ORESTES_AWS_SNS_ENABLED: "true"
ORESTES_AWS_SNS_ENDPOINT: "http://localstack:4566"
script:
- npm run test:node
artifacts:
when: always
reports:
junit:
- ./node-result.xml
web-test-job:
image: mcr.microsoft.com/playwright:v1.38.0-jammy
stage: test
dependencies:
- build-job
variables:
TEST_SERVER: "https://local.baqend.com:8443/v1"
# DEBUG: pw:api
parallel:
matrix:
- BROWSER: [ Chromium, Firefox, Webkit ]
services:
- name: public.ecr.aws/docker/library/mongo:4
alias: mongo
- public.ecr.aws/docker/library/redis:5.0
- name: public.ecr.aws/localstack/localstack:latest
alias: localstack
variables:
SERVICES: s3,sns
- name: public.ecr.aws/aws-cli/aws-cli:latest
entrypoint:
- '/bin/bash'
- '-c'
- |
curl --retry 5 --retry-max-time 120 http://localstack:4566; # wait for localstack to come up
aws --endpoint-url=http://localstack:4566 s3 mb s3://asset-files;
aws --endpoint-url=http://localstack:4566 s3api put-object --bucket=asset-files --key status;
command: ["--endpoint-url=http://localstack:4566", "s3api", "put-object", "s3://asset-files"]
alias: orestes-init
- name: "${CI_REGISTRY}/team-backend/orestes/orestes-node:${NODE_BRANCH}"
alias: node
command: [ "tcp://local.baqend.com:8081", "http://local.baqend.com:8080/v1", "debug" ]
pull_policy: [always, if-not-present]
- name: "${CI_REGISTRY}/team-backend/orestes/orestes-server:${ORESTES_BRANCH}"
alias: local.baqend.com
pull_policy: [always, if-not-present]
variables:
ORESTES_MONGO_ENABLED: "true"
ORESTES_MONGO_SERVERS: "tcp://mongo:27017"
AWS_ACCESS_KEY_ID: anykey
AWS_SECRET_ACCESS_KEY: anysecret
ORESTES_AWS_S3_ENABLED: "true"
ORESTES_AWS_S3_ENDPOINT: http://localstack:4566
ORESTES_AWS_S3_BUCKET: asset-files
ORESTES_STATE_LOCATION: memory:/
ORESTES_BLOOMFILTER_LOCATION: memory:/
ORESTES_AWS_SNS_ENABLED: "true"
ORESTES_AWS_SNS_ENDPOINT: "http://localstack:4566"
ORESTES_HTTP_HTTP2: "false" # we need to disabled http2, otherwise the query spec "should allow large query" and the code spec "should accept blob parameter" are failing in webkit
script:
- npm run test:playwright -- --debug
artifacts:
when: always
reports:
junit:
- ./playwright-result.xml
release:
image: public.ecr.aws/docker/library/node:lts
stage: release
cache: []
variables:
GIT_AUTHOR_NAME: [email protected]
GIT_AUTHOR_EMAIL: Baqend CI
GIT_COMMITTER_EMAIL: [email protected]
GIT_COMMITTER_NAME: Baqend CI
before_script:
- apt-get update
- apt-get install -y awscli
- npm install -g semantic-release @semantic-release/{gitlab,changelog,git,exec} conventional-changelog-conventionalcommits
- npm ci
script:
- semantic-release --repository-url "${CI_PROJECT_URL}.git"
rules:
- if: $CI_COMMIT_BRANCH == "main"
- if: $CI_COMMIT_BRANCH == "prerelease"