@@ -3,90 +3,89 @@ workflows:
33 version : 2
44 tests :
55 jobs : &workflow_jobs
6- - node6 :
7- filters :
8- tags :
9- only : /.*/
10- # - node8:
11- # filters:
12- # tags:
13- # only: /.*/
14- # - node10:
15- # filters:
16- # tags:
17- # only: /.*/
186 - lint :
19- requires :
20- - node6
21- # - node8
22- # - node10
23- filters :
7+ filters : &all_commits
248 tags :
259 only : /.*/
26- - system_tests :
10+ - node6 :
2711 requires :
2812 - lint
29- filters :
30- branches :
31- only : master
32- tags :
33- only : ' /^v[\d.]+$/'
34- - publish_npm :
13+ filters : *all_commits
14+ - node8 :
3515 requires :
36- - system_tests
16+ - lint
17+ filters : *all_commits
18+ nightly :
19+ triggers :
20+ - schedule :
21+ cron : 0 7 * * *
3722 filters :
3823 branches :
39- ignore : /.*/
40- tags :
41- only : ' /^v[\d.]+$/'
24+ only : master
25+ jobs : *workflow_jobs
4226jobs :
27+ lint :
28+ docker :
29+ - image : ' node:8'
30+ user : node
31+ steps :
32+ - checkout
33+ - run : &npm_install_and_link
34+ name : Install and link the module
35+ command : |-
36+ mkdir -p /home/node/.npm-global
37+ ./.circleci/npm-install-retry.js
38+ environment :
39+ NPM_CONFIG_PREFIX : /home/node/.npm-global
40+ - run :
41+ name : Run linting.
42+ command : npm run lint
43+ environment :
44+ NPM_CONFIG_PREFIX : /home/node/.npm-global
4345 node6 :
4446 docker :
4547 - image : ' node:6'
46- steps : &unit_tests_steps
48+ user : node
49+ steps : &tests_steps
4750 - checkout
51+ - run :
52+ name : Decrypt credentials.
53+ command : |
54+ if ! [[ -z "${SERVICE_ACCOUNT_ENCRYPTION_KEY}" ]]; then
55+ for encrypted_key in .circleci/*.json.enc; do
56+ openssl aes-256-cbc -d -in $encrypted_key \
57+ -out $(echo $encrypted_key | sed 's/\.enc//') \
58+ -k "${SERVICE_ACCOUNT_ENCRYPTION_KEY}"
59+ done
60+ fi
4861 - run :
4962 name : Install and configure Cloud SDK
5063 command : |
51- echo $KEYFILE > key.json
52- curl https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-209.0.0-linux-x86_64.tar.gz | tar xz
64+ curl https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-225.0.0-linux-x86_64.tar.gz | tar xz
5365 mv ./google-cloud-sdk /opt
5466 export PATH=$PATH:/opt/google-cloud-sdk/bin
5567 gcloud components install beta -q
5668 gcloud components update -q
5769 gcloud config set project cloud-functions-emulator
5870 gcloud config set compute/region us-central1
59- gcloud auth activate-service-account --key-file key.json
60- - run : yarn
61- - run : yarn test
71+ gcloud auth activate-service-account --key-file .circleci/key.json
72+ - run : *npm_install_and_link
73+ - run :
74+ name : Run tests.
75+ command : npm test
76+ environment :
77+ GCLOUD_PROJECT : cloud-functions-emulator
78+ GOOGLE_APPLICATION_CREDENTIALS : .circleci/key.json
6279 - run : node_modules/.bin/codecov
63- # node8:
64- # docker:
65- # - image: 'node:8'
66- # steps: *unit_tests_steps
67- # node10:
68- # docker:
69- # - image: 'node:10'
70- # steps: *unit_tests_steps
71- lint :
72- docker :
73- - image : ' node:6'
74- steps :
75- - checkout
76- - run : yarn install
77- - run : npm run lint
78- system_tests :
80+ - run :
81+ name : Remove unencrypted key.
82+ command : |
83+ if ! [[ -z "${SERVICE_ACCOUNT_ENCRYPTION_KEY}" ]]; then
84+ rm .circleci/*.json
85+ fi
86+ when : always
87+ node8 :
7988 docker :
80- - image : ' node:6 '
89+ - image : ' node:8 '
8190 user : node
82- steps :
83- - checkout
84- - run : yarn
85- - run : yarn run system-test
86- publish_npm :
87- docker :
88- - image : ' node:10'
89- steps :
90- - checkout
91- - run : echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
92- - run : npm publish
91+ steps : *tests_steps
0 commit comments