1
1
# Cache key for CircleCI. We want to invalidate the cache whenever the npm shrinkwrap
2
2
# changed.
3
- var_1 : &cache_key preboot-{{ checksum "npm-shrinkwrap.json " }}
3
+ var_1 : &cache_key preboot-v1- {{ checksum "yarn.lock " }}
4
4
# Use the CircleCI browsers image that comes with NodeJS installed
5
- var_2 : &default_docker_image circleci /node:10.12-browsers
5
+ var_2 : &docker_image cimg /node:10.20
6
6
7
- # Settings common to each job
8
- var_3 : &job_defaults
9
- working_directory : ~/ng
10
- docker :
11
- - image : *default_docker_image
7
+ # Executor Definitions
8
+ # https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-executors
9
+ executors :
10
+ action-executor :
11
+ docker :
12
+ - image : *docker_image
13
+ working_directory : ~/ng
14
+
15
+ # Workspace initially persisted by the `setup` job.
16
+ # https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
17
+ # https://circleci.com/blog/deep-diving-into-circleci-workspaces/
18
+ var_3 : &workspace_location .
12
19
13
20
# Job step for checking out the source code from GitHub. This also ensures that the source code
14
21
# is rebased on top of master.
@@ -30,7 +37,7 @@ var_6: &save_cache
30
37
save_cache :
31
38
key : *cache_key
32
39
paths :
33
- - " node_modules "
40
+ - ~/.cache/yarn
34
41
35
42
# Job step that ensures that the node module dependencies are installed and up-to-date. We use
36
43
# Yarn with the frozen lockfile option in order to make sure that lock file and package.json are
@@ -43,58 +50,54 @@ var_7: &yarn_install
43
50
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
44
51
var_8 : &attach_release_output
45
52
attach_workspace :
46
- at : dist/
53
+ at : *workspace_location
54
+
47
55
48
56
49
57
# -----------------------------
50
58
# Container version of CircleCI
51
59
# -----------------------------
52
- version : 2
60
+ version : 2.1
61
+
62
+ orbs :
63
+ browser-tools :
circleci/[email protected]
53
64
54
65
# -----------------------------------------------------------------------------------------
55
66
# Job definitions. Jobs which are defined just here, will not run automatically. Each job
56
67
# must be part of a workflow definition in order to run for PRs and push builds.
57
68
# -----------------------------------------------------------------------------------------
58
69
jobs :
59
70
60
- build :
61
- << : *job_defaults
71
+ build_and_test :
72
+ executor : action-executor
62
73
steps :
63
74
- *checkout_code
64
75
- *restore_cache
65
76
- *yarn_install
66
77
67
- - run : npm run build
78
+ - run : yarn build
79
+
80
+ - browser-tools/install-chrome
81
+ - run : yarn test:once
68
82
69
83
# Store the release output in the workspace storage. This means that other jobs
70
84
# in the same workflow can attach the release output to their job.
71
85
- persist_to_workspace :
72
- root : dist
86
+ root : *workspace_location
73
87
paths :
74
- - " *"
75
- - " **/*"
76
-
77
- - *save_cache
78
-
79
- test :
80
- << : *job_defaults
81
- steps :
82
- - *checkout_code
83
- - *restore_cache
84
- - *yarn_install
85
-
86
- - run : npm run test:once
88
+ - ./dist
87
89
88
90
- *save_cache
89
91
90
92
e2e :
91
- << : *job_defaults
93
+ executor : action-executor
92
94
steps :
95
+ - browser-tools/install-chrome
93
96
- *checkout_code
94
97
- *restore_cache
95
98
- *attach_release_output
96
99
97
- - run : npm run e2e
100
+ - run : yarn e2e
98
101
99
102
- *save_cache
100
103
@@ -107,8 +110,7 @@ workflows:
107
110
108
111
build_and_test :
109
112
jobs :
110
- - build
111
- - test
113
+ - build_and_test
112
114
- e2e :
113
115
requires :
114
- - build
116
+ - build_and_test
0 commit comments