1
0
Fork 0
js-utils/.gitlab-ci.yml

133 lines
2.3 KiB
YAML
Executable File

stages:
- status-pre
- build
- image
- publish
- status-post
# template jobs
.branch-deploy: &branch-deploy
only:
- master
.build-curl: &build-curl
image: apextoaster/base:1.2
tags:
- platform:k8s
- runner:shared
.build-climate: &build-climate
image: apextoaster/code-climate:0.6
tags:
- platform:k8s
- runner:shared
allow_failure: false
variables:
CI_BRANCH: "${CI_COMMIT_REF_NAME}"
GIT_BRANCH: "${CI_COMMIT_REF_NAME}"
GIT_COMMIT_SHA: "${CI_COMMIT_SHA}"
.build-codecov: &build-codecov
image: apextoaster/codecov:3.1
tags:
- platform:k8s
- runner:shared
allow_failure: false
.build-node: &build-node
image: apextoaster/node:10.1
tags:
- platform:k8s
- runner:shared
allow_failure: false
before_script:
- echo "${NPM_SECRET}" | base64 -d > ${HOME}/.npmrc
# build jobs
build-node:
<<: [*build-node]
stage: build
variables:
GIT_SUBMODULE_STRATEGY: recursive
script:
- make build test
artifacts:
expire_in: 1 week
paths:
- out/coverage
- out/docs
- out/main.js
- out/noicejs.d.ts
- out/version.json
cache:
key: "${CI_COMMIT_REF_SLUG}"
policy: pull-push
paths:
- node_modules
# publish jobs
publish-npm:
<<: [*build-node]
stage: publish
only:
- tags
dependencies:
- build-node
script:
- npm publish
# commit status
climate-pending:
<<: [*build-climate]
stage: status-pre
script:
- cc-test-reporter before-build
climate-failure:
<<: [*build-climate]
stage: status-post
when: on_failure
script:
- cc-test-reporter after-build --debug --exit-code 1
climate-success:
<<: [*build-climate]
stage: status-post
dependencies:
- build-node
script:
- make upload-climate
codecov-success:
<<: [*build-codecov]
stage: status-post
when: on_success
dependencies:
- build-node
script:
- make upload-codecov
github-pending:
<<: [*build-curl]
stage: status-pre
script:
- ./scripts/github-status.sh pending
github-failure:
<<: [*build-curl]
stage: status-post
when: on_failure
script:
- ./scripts/github-status.sh failure
github-success:
<<: [*build-curl]
stage: status-post
when: on_success
script:
- ./scripts/github-status.sh success