forked from Qinyu-Xu/YouChat-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
51 lines (44 loc) · 1.07 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
image: registry.secoder.net/tool/deployer
stages:
- build
- test
- deploy
build:
stage: build
script:
- export BUILD_IMAGE_NAME=$CI_REGISTRY_IMAGE
- export BUILD_IMAGE_TAG=$CI_COMMIT_REF_SLUG
- export BUILD_IMAGE_USERNAME=$CI_REGISTRY_USER
- export BUILD_IMAGE_PASSWORD=$CI_REGISTRY_PASSWORD
- deployer build
only:
- master
- dev
.test:
stage: test
image: node:18
before_script:
- yarn config set registry https://registry.npmmirror.com
- yarn install
unit-test:
extends: .test
script:
- yarn test
- yarn lint
after_script:
- SUFFIX=$RANDOM
- curl "http://api.secoder.net/static/sonar-scanner.tar.gz" -s -o "/tmp/sonar-$SUFFIX.tar.gz"
- tar -xf "/tmp/sonar-$SUFFIX.tar.gz" -C /opt
- /opt/sonar-scanner/bin/sonar-scanner
style-test:
extends: .test
allow_failure: true
script:
- node_modules/eslint/bin/eslint.js
deploy:
stage: deploy
script:
- deployer dyno replace $CI_PROJECT_NAME $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG $REGISTRY_USER $REGISTRY_PWD
only:
- master
- dev