2018-07-10 13:01:02 +03:00
|
|
|
# anchor refs to be used elsewhere
|
|
|
|
refs:
|
|
|
|
wait_for_postgres: &wait_for_postgres
|
|
|
|
run:
|
|
|
|
name: waiting for postgres to be ready
|
|
|
|
command: |
|
|
|
|
for i in `seq 1 60`;
|
|
|
|
do
|
|
|
|
nc -z localhost 5432 && echo Success && exit 0
|
|
|
|
echo -n .
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
echo Failed waiting for Postgres && exit 1
|
|
|
|
filter_only_vtags: &filter_only_vtags
|
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
only: /^v.*/
|
|
|
|
filter_only_release_branches: &filter_only_release_branches
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: /^release-v.*/
|
|
|
|
filter_only_dev_branches: &filter_only_dev_branches
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: /^dev.*/
|
2018-07-10 14:52:13 +03:00
|
|
|
filter_only_dev_release_branches: &filter_only_dev_release_branches
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only: /^(dev|release).*/
|
2018-07-10 13:01:02 +03:00
|
|
|
filter_ignore_branches: &filter_ignore_branches
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore: /.*/
|
|
|
|
filter_ignore_release_branches: &filter_ignore_release_branches
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
ignore: /^release-v.*/
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-06-29 16:09:21 +03:00
|
|
|
version: 2
|
|
|
|
jobs:
|
2018-07-10 13:01:02 +03:00
|
|
|
# test build the server binary
|
|
|
|
test_and_build_server:
|
2018-06-29 16:09:21 +03:00
|
|
|
docker:
|
2018-07-10 13:01:02 +03:00
|
|
|
- image: hasura/graphql-engine-server-builder:v0.2
|
|
|
|
- image: circleci/postgres:10-alpine
|
|
|
|
environment:
|
|
|
|
POSTGRES_USER: gql_test
|
|
|
|
POSTGRES_DB: gql_test
|
2018-07-03 20:10:13 +03:00
|
|
|
working_directory: ~/graphql-engine
|
2018-06-29 16:09:21 +03:00
|
|
|
steps:
|
2018-07-10 13:01:02 +03:00
|
|
|
- checkout
|
|
|
|
- setup_remote_docker:
|
|
|
|
version: 17.09.0-ce
|
|
|
|
docker_layer_caching: true
|
|
|
|
- restore_cache:
|
|
|
|
keys:
|
|
|
|
- server-app-cache-{{ .Branch }}-{{ .Revision }}
|
|
|
|
- server-deps-cache-v1
|
|
|
|
- *wait_for_postgres
|
|
|
|
- run:
|
|
|
|
name: test and build server binary
|
|
|
|
working_directory: ./server
|
|
|
|
command: |
|
|
|
|
# TODO: make test
|
|
|
|
make ci-binary
|
|
|
|
make ci-image
|
|
|
|
make ci-save-image
|
|
|
|
- save_cache:
|
|
|
|
key: server-app-cache-{{ .Branch }}-{{ .Revision }}
|
|
|
|
paths:
|
|
|
|
- server/.stack-work
|
|
|
|
- save_cache:
|
|
|
|
key: server-deps-cache-v1
|
|
|
|
paths:
|
|
|
|
- ~/.stack
|
|
|
|
- store_artifacts:
|
|
|
|
path: /build/_server_output
|
|
|
|
destination: server
|
|
|
|
- persist_to_workspace:
|
|
|
|
root: /build
|
|
|
|
paths:
|
|
|
|
- _server_output # binary is called graphql-engine
|
|
|
|
|
|
|
|
# test and build cli
|
|
|
|
test_and_build_cli:
|
2018-06-29 16:09:21 +03:00
|
|
|
docker:
|
2018-07-10 13:01:02 +03:00
|
|
|
- image: hasura/graphql-engine-cli-builder:v0.2
|
|
|
|
- image: circleci/postgres:10-alpine
|
|
|
|
environment:
|
|
|
|
POSTGRES_USER: gql_test
|
|
|
|
POSTGRES_DB: gql_test
|
2018-06-29 16:09:21 +03:00
|
|
|
working_directory: /go/src/github.com/hasura/graphql-engine
|
|
|
|
steps:
|
|
|
|
- checkout
|
2018-07-10 13:01:02 +03:00
|
|
|
- attach_workspace:
|
|
|
|
at: /build
|
2018-06-29 16:09:21 +03:00
|
|
|
- restore_cache:
|
|
|
|
keys:
|
|
|
|
- cli-vendor-{{ checksum "cli/Gopkg.toml" }}-{{ checksum "cli/Gopkg.lock" }}
|
|
|
|
- run:
|
2018-07-03 20:10:13 +03:00
|
|
|
name: get cli dependencies
|
2018-07-10 13:01:02 +03:00
|
|
|
working_directory: cli
|
2018-06-29 16:09:21 +03:00
|
|
|
command: make deps
|
|
|
|
- save_cache:
|
|
|
|
key: cli-vendor-{{ checksum "cli/Gopkg.toml" }}-{{ checksum "cli/Gopkg.lock" }}
|
|
|
|
paths:
|
|
|
|
- cli/vendor
|
2018-07-10 13:01:02 +03:00
|
|
|
- *wait_for_postgres
|
|
|
|
- run:
|
|
|
|
name: test cli
|
|
|
|
command: .circleci/test-cli.sh
|
2018-06-29 16:09:21 +03:00
|
|
|
- run:
|
|
|
|
name: build cli
|
2018-07-10 13:01:02 +03:00
|
|
|
working_directory: cli
|
2018-06-29 16:09:21 +03:00
|
|
|
command: |
|
|
|
|
make build
|
|
|
|
make compress
|
2018-07-10 13:01:02 +03:00
|
|
|
make ci-copy-binary
|
2018-06-29 16:09:21 +03:00
|
|
|
- store_artifacts:
|
2018-07-10 13:01:02 +03:00
|
|
|
path: /build/_cli_output
|
2018-07-03 20:10:13 +03:00
|
|
|
destination: cli
|
|
|
|
- persist_to_workspace:
|
2018-07-10 13:01:02 +03:00
|
|
|
root: /build
|
2018-07-03 20:10:13 +03:00
|
|
|
paths:
|
2018-07-10 13:01:02 +03:00
|
|
|
- _cli_output
|
|
|
|
|
|
|
|
# test and build console
|
|
|
|
test_and_build_console:
|
|
|
|
docker:
|
|
|
|
- image: hasura/graphql-engine-console-builder:v0.2
|
|
|
|
- image: circleci/postgres:10-alpine
|
|
|
|
environment:
|
|
|
|
POSTGRES_USER: gql_test
|
|
|
|
POSTGRES_DB: gql_test
|
|
|
|
working_directory: ~/graphql-engine
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- attach_workspace:
|
|
|
|
at: /build
|
|
|
|
- restore_cache:
|
|
|
|
key:
|
|
|
|
console-npm-cache-{{ checksum "console/package.json" }}-{{ checksum "console/package-lock.json" }}
|
|
|
|
- run:
|
|
|
|
name: install dependencies
|
|
|
|
working_directory: console
|
|
|
|
command: make ci-deps
|
|
|
|
- save_cache:
|
|
|
|
key:
|
|
|
|
console-npm-cache-{{ checksum "console/package.json" }}-{{ checksum "console/package-lock.json" }}
|
|
|
|
paths:
|
|
|
|
- console/node_modules
|
|
|
|
- ~/.npm
|
|
|
|
- ~/.cache
|
|
|
|
- *wait_for_postgres
|
|
|
|
# ignore console test for now
|
|
|
|
# - run:
|
|
|
|
# name: test console
|
|
|
|
# command: .circleci/test-console.sh
|
|
|
|
- run:
|
|
|
|
name: build console
|
|
|
|
working_directory: console
|
|
|
|
command: |
|
|
|
|
make build
|
|
|
|
make ci-copy-assets
|
|
|
|
- store_artifacts:
|
|
|
|
path: /build/_console_output
|
|
|
|
destination: console
|
|
|
|
- persist_to_workspace:
|
|
|
|
root: /build
|
|
|
|
paths:
|
|
|
|
- _console_output
|
|
|
|
|
|
|
|
deploy:
|
|
|
|
docker:
|
|
|
|
- image: hasura/graphql-engine-deployer:v0.2
|
|
|
|
working_directory: ~/graphql-engine
|
|
|
|
steps:
|
|
|
|
- setup_remote_docker:
|
|
|
|
version: 17.09.0-ce
|
|
|
|
docker_layer_caching: true
|
|
|
|
- checkout
|
|
|
|
- attach_workspace:
|
|
|
|
at: /build
|
|
|
|
- run:
|
|
|
|
name: deploy
|
|
|
|
command: .circleci/deploy.sh
|
|
|
|
|
2018-06-29 16:09:21 +03:00
|
|
|
workflows:
|
|
|
|
version: 2
|
2018-07-10 13:01:02 +03:00
|
|
|
build_and_test:
|
2018-06-29 16:09:21 +03:00
|
|
|
jobs:
|
2018-07-10 13:01:02 +03:00
|
|
|
- test_and_build_server: *filter_only_vtags
|
|
|
|
- test_and_build_cli:
|
|
|
|
<<: *filter_only_vtags
|
|
|
|
requires:
|
|
|
|
- test_and_build_server
|
|
|
|
- test_and_build_console:
|
|
|
|
<<: *filter_only_vtags
|
|
|
|
requires:
|
|
|
|
- test_and_build_server
|
|
|
|
- test_and_build_cli
|
|
|
|
- deploy:
|
|
|
|
<<: *filter_only_vtags
|
2018-07-10 14:52:13 +03:00
|
|
|
<<: *filter_only_dev_release_branches
|
2018-07-10 13:01:02 +03:00
|
|
|
requires:
|
|
|
|
- test_and_build_console
|