Skip to content

Commit

Permalink
Fix CI config
Browse files Browse the repository at this point in the history
  • Loading branch information
dolezel committed Jun 22, 2018
1 parent c94ae46 commit ee5aafb
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,23 @@ version: 2
node-image: &node-image
image: circleci/node:6

set-npm-global: &set-npm-global
run:
name: set-npm-global
command: |
mkdir -p ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export NPM_CONFIG_PREFIX=~/.npm-global' >> $BASH_ENV
echo 'export PATH=~/.npm-global/bin:$PATH' >> $BASH_ENV
source $BASH_ENV
save: &save
save_cache:
key: code-{{ .Revision }}
paths:
- .
- ".git"
- "~/.npm-global"

restore: &restore
restore_cache:
Expand All @@ -20,15 +31,8 @@ jobs:
- <<: *node-image
steps:
- checkout
- run:
name: update-npm
command: |
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export NPM_CONFIG_PREFIX=~/.npm-global' >> $BASH_ENV
echo 'export PATH=~/.npm-global/bin:$PATH' >> $BASH_ENV
source $BASH_ENV
npm install -g [email protected]
- <<: *set-npm-global
- run: npm install -g [email protected]
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
Expand Down Expand Up @@ -57,6 +61,8 @@ jobs:
test-pg:
docker:
- <<: *node-image
environment:
- DATABASE_URL=postgres://ubuntu@localhost:5432/circle_test
- image: postgres:10.4-alpine
environment:
- POSTGRES_USER=ubuntu
Expand All @@ -65,30 +71,28 @@ jobs:
- <<: *restore
- run:
name: test
environment:
- DATABASE_URL=postgres://ubuntu@localhost:5432/circle_test
command: npm run migrate up -- -m test/migrations && npm run migrate down 0 -- -m test/migrations --timestamps
test-cocroach:
docker:
- <<: *node-image
environment:
- DATABASE_URL=postgresql://root@localhost:26257/circle_test
- image: cockroachdb/cockroach:v1.1.8
command: ['start', '--insecure', '--host=localhost']
steps:
- <<: *restore
- run:
name: create-cockroach-db
command: node -e '(new require("pg").Pool({connectionString:process.env.DATABASE_URL_COCKROACH})).query("CREATE DATABASE circle_test").then(function(){process.exit(0)})'
command: node -e '(new require("pg").Pool({connectionString:process.env.DATABASE_URL})).query("CREATE DATABASE circle_test").then(function(){process.exit(0)})'
- run:
name: test
environment:
- DATABASE_URL=postgresql://root@localhost:26257/circle_test
command: npm run migrate up -- -m test/cockroach -s '' --migrations-schema circle_test --no-lock && npm run migrate down 0 -- -m test/cockroach -s '' --migrations-schema circle_test --no-lock --timestamps
- run: greenkeeper-lockfile-upload
finish:
docker:
- <<: *node-image
steps:
- <<: *restore
- <<: *set-npm-global
- run: greenkeeper-lockfile-upload

workflows:
Expand Down

0 comments on commit ee5aafb

Please sign in to comment.