mirror of
https://gitlab.com/timvisee/send.git
synced 2024-11-10 05:02:45 +01:00
72 lines
2.0 KiB
YAML
72 lines
2.0 KiB
YAML
image: "node:12-slim"
|
|
|
|
stages:
|
|
- test
|
|
- artifact
|
|
- release
|
|
|
|
before_script:
|
|
# Install dependencies
|
|
- apt-get update
|
|
- apt-get install -y git python3 build-essential libxtst6
|
|
|
|
# Prepare Chrome for puppeteer
|
|
- apt-get install -y wget gnupg
|
|
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
|
|
- sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
|
|
- apt-get update
|
|
- apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 --no-install-recommends
|
|
|
|
test:
|
|
stage: test
|
|
script:
|
|
- npm ci
|
|
- npm run lint
|
|
- npm test
|
|
|
|
# Release Docker image artifact for easy testing
|
|
artifact-docker:
|
|
stage: artifact
|
|
image: docker:latest
|
|
services:
|
|
- docker:dind
|
|
only:
|
|
- master
|
|
before_script: []
|
|
script:
|
|
- export IMG_NAME=registry.gitlab.com/timvisee/send:master-$CI_COMMIT_SHA
|
|
|
|
# Login in to registry
|
|
- 'docker login registry.gitlab.com -u $DOCKER_USER -p $DOCKER_PASS'
|
|
|
|
# Build and push image, report image name
|
|
- docker build -t $IMG_NAME .
|
|
- docker push $IMG_NAME
|
|
- 'echo Docker image artifact published, available as:'
|
|
- 'echo " docker pull $IMG_NAME"'
|
|
|
|
# Release public Docker image
|
|
release-docker:
|
|
stage: release
|
|
image: docker:latest
|
|
services:
|
|
- docker:dind
|
|
only:
|
|
- /^v(\d+\.)*\d+$/
|
|
before_script: []
|
|
script:
|
|
- export IMG_NAME=registry.gitlab.com/timvisee/send:$CI_COMMIT_REF_NAME
|
|
- export IMG_NAME_LATEST=registry.gitlab.com/timvisee/send:latest
|
|
|
|
# Login in to registry
|
|
- 'docker login registry.gitlab.com -u $DOCKER_USER -p $DOCKER_PASS'
|
|
|
|
# Build and push image, report image name
|
|
- docker build -t $IMG_NAME .
|
|
- docker tag $IMG_NAME $IMG_NAME_LATEST
|
|
- docker push $IMG_NAME
|
|
- docker push $IMG_NAME_LATEST
|
|
- 'echo Docker image artifact published, available as:'
|
|
- 'echo " docker pull $IMG_NAME_LATEST"'
|
|
- 'echo " docker pull $IMG_NAME"'
|