-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
19 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
|
@@ -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: | ||
|
@@ -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 | ||
|
@@ -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: | ||
|