-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
85 lines (76 loc) · 2 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
image: node:18.16-alpine
stages:
- build
- test
- release
before_script:
- echo "@cloud:registry=https://gitlab.unueng.com/api/v4/packages/npm/" > ~/.npmrc
- echo "@infrastructure:registry=https://gitlab.unueng.com/api/v4/packages/npm/" >> ~/.npmrc
- echo "@cas:registry=https://gitlab.unueng.com/api/v4/packages/npm/" >> ~/.npmrc
- echo "//${CI_SERVER_HOST}/api/v4/packages/npm/:_authToken=${CI_JOB_TOKEN}" >> ~/.npmrc
- echo "//${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=${CI_JOB_TOKEN}" >> ~/.npmrc
# Give access to write to the public NPM repo
- echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
variables:
# Configure the rabbitmq server
RABBITMQ_DEFAULT_USER: "guest"
RABBITMQ_DEFAULT_PASS: "guest"
ESLINT_CODE_QUALITY_REPORT: gl-codequality.json
setup:
stage: build
script:
- npm install
cache:
policy: pull-push
paths:
- node_modules/
# Overwrite the template test job, so we can wait for rabbitmq to be running
# Moving this to the tests did not work as expected and tests kept still failing
test:
stage: test
script:
# Wait for RabbitMQ to be running
- while ! nc -z localhost 15692 ; do sleep 1 ; done
- npm run test-graceful-shutdown
- npm run test
- npm run test-coverage
cache:
policy: pull
paths:
- node_modules/
services:
- name: r.unueng.com/cloud/rabbitmq-plugins:3.9-1
alias: rabbitmq
- name: mongo:6.0
alias: mongodb
coverage: '/Statements.*?(\d+(?:\.\d+)?)%/'
artifacts:
reports:
junit: results.xml
# override from template to add code climate
lint:
stage: test
script:
- npm run lint
cache:
policy: pull
paths:
- node_modules/
artifacts:
reports:
codequality: gl-codequality.json
audit:
stage: test
script:
- npm audit --registry https://registry.npmjs.org/ --production
cache:
policy: pull
paths:
- node_modules/
allow_failure: true
publish:
stage: release
script: npm publish --access public
only:
refs:
- tags