Created
May 25, 2020 14:14
-
-
Save alrayyes/e37a422bdd29ce877bc3c405de164c3c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stages: | |
- setup | |
- test | |
- compile | |
- build | |
services: | |
- docker:dind | |
setup:test: | |
image: node:latest | |
stage: setup | |
script: | |
- yarn install --cache-folder .yarn | |
cache: | |
key: "$CI_COMMIT_REF_SLUG-test" | |
paths: | |
- .yarn | |
- node_modules/ | |
except: | |
refs: | |
- schedules | |
only: | |
changes: | |
- yarn.lock | |
refs: | |
- develop | |
- master | |
setup:build: | |
image: node:latest | |
stage: setup | |
script: | |
- yarn install --cache-folder .yarn --prod | |
cache: | |
key: "$CI_COMMIT_REF_SLUG-compile" | |
paths: | |
- .yarn | |
- node_modules/ | |
except: | |
refs: | |
- schedules | |
only: | |
changes: | |
- yarn.lock | |
refs: | |
- master | |
test:lint: | |
image: node:latest | |
stage: test | |
script: | |
- yarn lint | |
only: | |
changes: | |
- src/**/* | |
- yarn.lock | |
refs: | |
- develop | |
- master | |
except: | |
refs: | |
- schedules | |
cache: | |
policy: pull | |
key: "$CI_COMMIT_REF_SLUG-test" | |
paths: | |
- node_modules/ | |
test:type-check: | |
image: node:latest | |
stage: test | |
script: | |
- yarn type-check | |
only: | |
changes: | |
- src/**/* | |
- yarn.lock | |
refs: | |
- develop | |
- master | |
except: | |
refs: | |
- schedules | |
cache: | |
policy: pull | |
key: "$CI_COMMIT_REF_SLUG-test" | |
paths: | |
- node_modules/ | |
test:jest: | |
image: node:latest | |
stage: test | |
script: | |
- yarn test:coverage | |
coverage: /All\sfiles.*?\s+(\d+.\d+)/ | |
only: | |
changes: | |
- yarn.lock | |
- src/**/* | |
refs: | |
- master | |
- develop | |
except: | |
refs: | |
- schedules | |
cache: | |
policy: pull | |
key: "$CI_COMMIT_REF_SLUG-test" | |
paths: | |
- node_modules/ | |
artifacts: | |
reports: | |
cobertura: coverage/cobertura-coverage.xml | |
build:page: | |
stage: compile | |
image: node:latest | |
script: | |
- ./node_modules/.bin/gatsby build --prefix-paths | |
artifacts: | |
paths: | |
- public | |
expire_in: 3 hrs | |
only: | |
- master | |
cache: | |
policy: pull | |
key: "$CI_COMMIT_REF_SLUG-compile" | |
paths: | |
- node_modules/ | |
build:docker: | |
image: docker:latest | |
stage: build | |
script: | |
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY | |
- docker build --pull -t "$CI_REGISTRY_IMAGE" . | |
- docker push "$CI_REGISTRY_IMAGE" | |
only: | |
- master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment