Skip to content

Commit bf19107

Browse files
committed
Rewrite the config to DRY and add test jobs
1 parent ed82c87 commit bf19107

1 file changed

Lines changed: 59 additions & 12 deletions

File tree

.circleci/config.yml

Lines changed: 59 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,71 @@
11
version: 2.1
2-
jobs:
3-
build:
4-
docker:
5-
- image: circleci/node:14.15
2+
commands:
3+
restore_deps:
64
steps:
7-
- checkout
85
- restore_cache:
96
keys:
10-
- v1-dependencies-{{ .Branch }}-{{ checksum "yarn.lock"}}
11-
- v1-dependencies-{{ .Branch }}
12-
- v1-dependencies-
13-
- run: yarn install --frozen-lockfile
7+
- v1-deps-{{ .Branch }}-{{ checksum "yarn.lock"}}
8+
- v1-deps-{{ .Branch }}
9+
- v1-deps-
10+
save_deps:
11+
steps:
1412
- save_cache:
15-
key: v1-dependencies-{{ .Branch }}-{{ checksum "yarn.lock"}}
13+
key: v1-deps-{{ .Branch }}-{{ checksum "yarn.lock"}}
1614
paths:
17-
- ~/.cache/yarn
15+
# ~/.cache contains yarn and Cypress
16+
- ~/.cache
17+
- node_modules
18+
19+
executors:
20+
default:
21+
docker:
22+
- image: circleci/node:14.15
23+
cypress:
24+
docker:
25+
# 14.15 was not registered
26+
# https://hub.docker.com/r/cypress/base/tags
27+
- image: cypress/base:14.15.0
28+
environment:
29+
CYPRESS_CACHE_FOLDER: << parameters.dir >>.cache/Cypress
30+
# Enable output color
31+
TERM: xterm
32+
parameters:
33+
dir:
34+
type: string
35+
default: /home/circleci/
36+
working_directory: << parameters.dir >>project
37+
38+
jobs:
39+
build-lint:
40+
executor: default
41+
steps:
42+
- checkout
43+
- restore_deps
44+
- run: |
45+
yarn install --frozen-lockfile
46+
- save_deps
1847
- run: yarn lint
48+
test-unit:
49+
executor: default
50+
steps:
51+
- checkout
52+
- restore_deps
53+
- run: yarn test:unit
54+
test-e2e:
55+
executor: cypress
56+
steps:
57+
- checkout
58+
- restore_deps
59+
- run: yarn test:e2e --headless
1960

2061
workflows:
2162
version: 2
2263
build-deploy:
2364
jobs:
24-
- build
65+
- build-lint
66+
- test-unit:
67+
requires:
68+
- build-lint
69+
- test-e2e:
70+
requires:
71+
- build-lint

0 commit comments

Comments
 (0)