Created
April 28, 2019 16:50
-
-
Save alvincrespo/9492b9d53689fffac4f7b0923d994000 to your computer and use it in GitHub Desktop.
Reusing Configuration across Jobs in CircleCI 2.1
This file contains hidden or 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
version: 2.1 | |
executors: | |
my-executor: | |
docker: | |
- image: cypress/base:8 | |
environment: | |
TERM: xterm | |
working_directory: ~/app | |
jobs: | |
build: | |
executor: my-executor | |
steps: | |
- checkout | |
- restore_cache: | |
keys: | |
- v2-deps-{{ .Branch }}-{{ checksum "package-lock.json" }} | |
- v2-deps-{{ .Branch }}- | |
- v2-deps- | |
- run: | |
name: Install Dependencies | |
command: npm install | |
- save_cache: | |
key: v2-deps-{{ .Branch }}-{{ checksum "package-lock.json" }} | |
paths: | |
- ~/.npm | |
- ~/.cache | |
- run: | |
name: Linting Project | |
command: npm run lint | |
- run: | |
name: Installing Static Site Server | |
command: npm i -g serve | |
- run: | |
name: Building Application | |
command: npm run build | |
- run: | |
name: Running Create React App | |
command: npm run start | |
background: true | |
- run: | |
name: Running Cypress | |
command: npm run cypress | |
- store_artifacts: | |
path: cypress/videos | |
- store_artifacts: | |
path: cypress/screenshots | |
release: | |
executor: my-executor | |
steps: | |
- checkout | |
- restore_cache: | |
keys: | |
- v2-deps-{{ .Branch }}-{{ checksum "package-lock.json" }} | |
- v2-deps-{{ .Branch }}- | |
- v2-deps- | |
- run: | |
name: Semantic Release | |
command: npx semantic-release | |
workflows: | |
version: 2 | |
test_and_release: | |
jobs: | |
- build | |
- release: | |
requires: | |
- build |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment