1
0
Fork 0
salty-dog/.gitlab-ci.yml

157 lines
2.7 KiB
YAML

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-docker: &build-docker
image: docker:18.09.9
services:
- docker:18.09.9-dind
tags:
- platform:k8s
- runner:shared
allow_failure: false
before_script:
# prep secrets
- mkdir ${HOME}/.docker
- echo "${DOCKER_SECRET}" | base64 -d > ${HOME}/.docker/config.json
- docker info
script:
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
after_script:
- rm -rfv ${HOME}/.docker
variables: &vars-docker
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://localhost:2375
.build-node: &build-node
image: apextoaster/node:11.15
tags:
- platform:k8s
- runner:shared
allow_failure: false
before_script:
- echo "${NPM_SECRET}" | base64 -d > ${HOME}/.npmrc
.build-sonar: &build-sonar
image: apextoaster/sonar-scanner:3.3
tags:
- platform:k8s
- runner:shared
allow_failure: false
# build jobs
build-node:
<<: [*build-node]
stage: build
variables:
GIT_SUBMODULE_STRATEGY: recursive
script:
- make clean-target build test
artifacts:
expire_in: 1 week
paths:
- out/*.js
- out/*.js.map
cache:
key: "${CI_COMMIT_REF_SLUG}"
policy: pull-push
paths:
- node_modules
- out/cache
build-image-branch:
<<: [*build-docker]
stage: image
except:
- tags
dependencies:
- build-node
variables:
<<: [*vars-docker]
IMAGE_TAG: "ssube/salty-dog:${CI_COMMIT_REF_SLUG}"
build-image-tag:
<<: [*build-docker]
stage: image
only:
- tags
dependencies:
- build-node
variables:
<<: [*vars-docker]
IMAGE_TAG: "ssube/salty-dog:${CI_COMMIT_TAG}"
# publish jobs
publish-npm:
<<: [*build-node]
stage: publish
only:
- tags
dependencies:
- build-node
script:
- npm publish
# commit status
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