-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircle.yml
76 lines (76 loc) · 2.06 KB
/
circle.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
version: 2
jobs:
build_and_test:
working_directory: ~/repo
docker: # requires
- image: circleci/node:7.10
steps:
- checkout
- restore_cache:
name: Restoring Cache node_modules
keys:
- node-{{ checksum "package.json" }}
- node-
- run:
name: Setup npm
command: |
npm install
sudo npm install -g gulp
npm rebuild node-sass --force # workaround -> https://qiita.com/0084ken/items/3015fefdf10f79e3770d
- run:
name: Setup env file
command: |
echo "GOOGLE_MAP_API_KEY=$GOOGLE_MAP_API_KEY\n" \
"GOOGLE_ANALYTICS_ID=$GOOGLE_ANALYTICS_ID" > .env
- run:
name: Build project
command: |
gulp
- run:
name: Unit test
command: |
npm run test
- save_cache:
name: Saving Cache node_modules
key: node-{{ checksum "package.json" }}
paths:
- "./node_modules"
- save_cache:
name: Saving Cache Docs
key: docs_cache
paths:
- "./docs"
deploy:
working_directory: ~/repo
docker: # requires
- image: circleci/node:7.10
steps:
- restore_cache:
name: Restoring Cache Docs
keys:
- docs_cache
- run:
name: Install aws-cli
working_directory: ./
command: |
sudo apt-get -y -qq update
sudo apt-get -y -qq install python3.4-dev
sudo curl -O https://bootstrap.pypa.io/get-pip.py
sudo python3.4 get-pip.py
sudo pip install awscli --upgrade
- run:
name: Deployment
command: |
aws s3 rm s3://$BUCKET_NAME/* --recursive
aws s3 cp docs/ s3://$BUCKET_NAME/ --recursive
workflows:
version: 2
build_and_deploy:
jobs:
- build_and_test:
filters:
branches:
only: master
- deploy:
requires:
- build_and_test