1
- aliases :
2
- # Caches
3
- - &restore-yarn-cache
4
- keys :
5
- - v1-yarn-{{ .Branch }}-{{ checksum "website/yarn.lock" }}
6
- # Fallback in case checksum fails
7
- - v1-yarn-{{ .Branch }}-
1
+ version : 2.1
8
2
9
- - &save-yarn-cache
10
- paths :
11
- - website/node_modules
12
- - ~/.cache/yarn
13
- key : v1-yarn-{{ .Branch }}-{{ checksum "website/yarn.lock" }}
3
+ # -------------------------
4
+ # EXECUTORS
5
+ # -------------------------
6
+ executors :
7
+ node8 :
8
+ docker :
9
+ - image : circleci/node:8
14
10
15
- # Filters
16
- - &filter-only-master
17
- branches :
18
- only :
19
- - master
20
-
21
- defaults : &defaults
22
- working_directory : ~/react-native-website
23
- docker :
24
- - image : circleci/node:8
25
-
26
- version : 2
27
- jobs :
28
- # Checkout and run yarn
29
- checkout_code :
30
- << : *defaults
11
+ # -------------------------
12
+ # COMMANDS
13
+ # -------------------------
14
+ commands :
15
+ restore_cache_checkout :
31
16
steps :
32
- - checkout
17
+ - restore_cache :
18
+ key : v1-repo-{{ .Environment.CIRCLE_SHA1 }}
33
19
34
- - restore-cache : *restore-yarn-cache
20
+ run_yarn :
21
+ steps :
22
+ - restore_cache :
23
+ keys :
24
+ - v1-yarn-{{ .Branch }}
35
25
- run :
36
26
name : Yarn Install
37
- command : |
38
- cd website
39
- yarn install --no-progress --non-interactive --cache-folder ~/.cache/yarn
40
- - save-cache : *save-yarn-cache
27
+ command : yarn install --no-progress --non-interactive --cache-folder ~/.cache/yarn
28
+ - save_cache :
29
+ paths :
30
+ - node_modules
31
+ - ~/.cache/yarn
32
+ key : v1-yarn-{{ .Branch }}
41
33
42
- - persist_to_workspace :
43
- root : .
44
- paths : .
34
+ # -------------------------
35
+ # JOBS
36
+ # -------------------------
37
+ jobs :
38
+ # --------------------------------------------------
39
+ # JOB: setup
40
+ # Checks out the repo, and persists to cache.
41
+ # --------------------------------------------------
42
+ setup :
43
+ executor : node8
44
+ working_directory : ~/react-native-website
45
+ steps :
46
+ - checkout
47
+ - save_cache :
48
+ key : v1-repo-{{ .Environment.CIRCLE_SHA1 }}
49
+ paths :
50
+ - ~/react-native-website
45
51
46
- # Tests website
52
+ # --------------------------------------------------
53
+ # JOB: test_website
54
+ # Test website can be built and has no lint issues.
55
+ # --------------------------------------------------
47
56
test_website :
48
- << : *defaults
57
+ executor : node8
49
58
working_directory : ~/react-native-website/website
50
59
steps :
51
- - attach_workspace :
52
- at : ~/react-native-website
60
+ - restore_cache_checkout
61
+ - run_yarn
53
62
- run : yarn ci-check
54
63
- run : yarn test
55
64
- run :
@@ -59,16 +68,17 @@ jobs:
59
68
exit 1;
60
69
fi
61
70
62
- # Deploys website
71
+ # --------------------------------------------------
72
+ # JOB: deploy_website
73
+ # Deploy website to GitHub Pages in core RN repo.
74
+ # --------------------------------------------------
63
75
deploy_website :
64
- << : *defaults
76
+ executor : node8
65
77
working_directory : ~/react-native-website/website
66
78
steps :
67
- - attach_workspace :
68
- at : ~/react-native-website
69
- - run :
70
- name : Install Dependencies
71
- command : sudo apt install rsync
79
+ - restore_cache_checkout
80
+ - run_yarn
81
+ - run : sudo apt install rsync
72
82
- run :
73
83
name : Build and Deploy Static Website
74
84
command : |
@@ -82,25 +92,29 @@ jobs:
82
92
echo "Skipping deploy."
83
93
fi
84
94
95
+ # -------------------------
96
+ # WORKFLOWS
97
+ # -------------------------
85
98
workflows :
86
- version : 2
87
-
88
99
# Tests run on master and on forks
89
100
tests :
90
101
jobs :
91
- - checkout_code
102
+ - setup
92
103
93
104
# Test website
94
105
- test_website :
95
106
requires :
96
- - checkout_code
107
+ - setup
97
108
98
109
# If we are on master, deploy docs
99
110
deploy :
100
111
jobs :
101
- - checkout_code :
102
- filters : *filter-only-master
112
+ - setup :
113
+ filters :
114
+ branches :
115
+ only :
116
+ - master
103
117
104
118
- deploy_website :
105
119
requires :
106
- - checkout_code
120
+ - setup
0 commit comments