UNPKG

2.18 kBYAMLView Raw
1version: 2
2jobs:
3 build:
4 docker:
5 - image: circleci/node:6
6
7
8 working_directory: ~/kes
9 steps:
10 - checkout
11
12 # restore cache
13 - restore_cache:
14 keys:
15 - deploy-{{ .Branch }}-{{ checksum "package.json" }}
16
17 - run:
18 name: Install
19 command: npm install
20
21 - run:
22 name: Lint
23 command: |
24 ./node_modules/.bin/eslint src --ext .js
25 ./node_modules/.bin/eslint bin --ext .js
26
27 # save cahce
28 - save_cache:
29 key: deploy-{{ .Branch }}-{{ checksum "package.json" }}
30 paths:
31 - ~/kes/node_modules
32
33 - run:
34 name: Test Examples
35 command: |
36 mkdir ~/example1
37 cp -r examples/lambdas ~/example1/.kes
38 cd ~/example1/
39 ~/kes/bin/cli.js cf compile
40 ~/kes/bin/cli.js cf validate
41
42 cd ~/kes
43 ./bin/cli.js cf compile --kes-folder examples/full
44 ./bin/cli.js cf validate --kes-folder examples/full
45 ./bin/cli.js cf validate --kes-folder examples/nested
46
47 npm run test
48
49 - run:
50 name: Integration Tests
51 command: npm run integration-test
52
53 - add_ssh_keys:
54 fingerprints:
55 - "8f:58:d1:7d:1f:b0:ed:cc:fd:c9:46:cb:ee:6b:40:86"
56 - run:
57 name: docs
58 command: |
59 if [ "${CIRCLE_BRANCH}" == "master" ]; then
60 cd ~/kes
61 npm run html-docs
62 cd _docs
63 git init
64 git config user.name "Devseed-CI"
65 git config user.email "dev@developmentseed.org"
66 git add .
67 git commit -m "CI deploy [skip ci]"
68 git remote add origin git@github.com:developmentseed/kes.git
69 git push origin master:gh-pages --force
70 fi
71
72 - run:
73 name: Deploy
74 command: |
75 if [ "${CIRCLE_BRANCH}" == "master" ]; then
76 cd ~/kes
77 echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
78 npm publish || echo 'npm publishing failed'
79 fi
80
81
82
\No newline at end of file