-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
52 lines (43 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
52
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
# TODO Start: [Student] Complete test stage
.test:
image: node:18
stage: test
before_script:
- yarn config set registry http://registry.npm.taobao.org/
- yarn install
unit-test:
extends: .test
script:
- yarn test
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:
- yarn lint
# TODO End
deploy:
stage: deploy
script:
- deployer dyno replace $CI_PROJECT_NAME $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG gitlab-ci-token $REGISTRY_PWD
only:
- master