Skip to content

Commit f76f9c7

Browse files
hramoscpojer
authored andcommitted
[CI] Migrate to Circle CI 2.1 (facebook#975)
1 parent a4b32de commit f76f9c7

File tree

1 file changed

+69
-55
lines changed

1 file changed

+69
-55
lines changed

.circleci/config.yml

Lines changed: 69 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,64 @@
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
82

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
1410

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:
3116
steps:
32-
- checkout
17+
- restore_cache:
18+
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
3319

34-
- restore-cache: *restore-yarn-cache
20+
run_yarn:
21+
steps:
22+
- restore_cache:
23+
keys:
24+
- v1-yarn-{{ .Branch }}
3525
- run:
3626
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 }}
4133

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
4551

46-
# Tests website
52+
# --------------------------------------------------
53+
# JOB: test_website
54+
# Test website can be built and has no lint issues.
55+
# --------------------------------------------------
4756
test_website:
48-
<<: *defaults
57+
executor: node8
4958
working_directory: ~/react-native-website/website
5059
steps:
51-
- attach_workspace:
52-
at: ~/react-native-website
60+
- restore_cache_checkout
61+
- run_yarn
5362
- run: yarn ci-check
5463
- run: yarn test
5564
- run:
@@ -59,16 +68,17 @@ jobs:
5968
exit 1;
6069
fi
6170
62-
# Deploys website
71+
# --------------------------------------------------
72+
# JOB: deploy_website
73+
# Deploy website to GitHub Pages in core RN repo.
74+
# --------------------------------------------------
6375
deploy_website:
64-
<<: *defaults
76+
executor: node8
6577
working_directory: ~/react-native-website/website
6678
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
7282
- run:
7383
name: Build and Deploy Static Website
7484
command: |
@@ -82,25 +92,29 @@ jobs:
8292
echo "Skipping deploy."
8393
fi
8494
95+
# -------------------------
96+
# WORKFLOWS
97+
# -------------------------
8598
workflows:
86-
version: 2
87-
8899
# Tests run on master and on forks
89100
tests:
90101
jobs:
91-
- checkout_code
102+
- setup
92103

93104
# Test website
94105
- test_website:
95106
requires:
96-
- checkout_code
107+
- setup
97108

98109
# If we are on master, deploy docs
99110
deploy:
100111
jobs:
101-
- checkout_code:
102-
filters: *filter-only-master
112+
- setup:
113+
filters:
114+
branches:
115+
only:
116+
- master
103117

104118
- deploy_website:
105119
requires:
106-
- checkout_code
120+
- setup

0 commit comments

Comments
 (0)