2019-04-10 18:17:24 +02:00
|
|
|
version: 2
|
2019-04-11 15:48:36 +02:00
|
|
|
|
2019-04-10 18:17:24 +02:00
|
|
|
jobs:
|
2019-04-11 15:48:36 +02:00
|
|
|
server:
|
2019-04-10 18:17:24 +02:00
|
|
|
docker:
|
|
|
|
- image: circleci/golang:1.12
|
2019-04-12 09:04:31 +02:00
|
|
|
environment:
|
|
|
|
- POSTGRES_CONNECTION_STRING=postgres://circle:test@localhost:5432/circle_test?sslmode=disable
|
|
|
|
- image: circleci/postgres:11.2-alpine
|
|
|
|
environment:
|
|
|
|
- POSTGRES_USER=circle
|
|
|
|
- POSTGRES_PASSWORD=test
|
2019-04-11 15:48:36 +02:00
|
|
|
working_directory: ~/offen/server
|
2019-04-10 18:17:24 +02:00
|
|
|
steps:
|
2019-04-11 15:48:36 +02:00
|
|
|
- checkout:
|
|
|
|
path: ~/offen
|
2019-04-10 18:17:24 +02:00
|
|
|
- restore_cache:
|
2019-04-11 20:19:57 +02:00
|
|
|
key: offen-server-{{ checksum "go.mod" }}
|
2019-04-10 18:17:24 +02:00
|
|
|
- run:
|
|
|
|
name: Download modules
|
|
|
|
command: go mod download
|
|
|
|
- save_cache:
|
|
|
|
paths:
|
|
|
|
- /go/pkg/mod
|
2019-04-11 20:19:57 +02:00
|
|
|
key: offen-server-{{ checksum "go.mod" }}
|
2019-04-20 01:37:26 +02:00
|
|
|
- run:
|
|
|
|
name: Waiting for Postgres to be ready
|
|
|
|
command: |
|
|
|
|
for i in `seq 1 10`;
|
|
|
|
do
|
|
|
|
nc -z localhost 5432 && echo Success && exit 0
|
|
|
|
echo -n .
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
echo Failed waiting for Postgres && exit 1
|
2019-04-10 18:17:24 +02:00
|
|
|
- run:
|
|
|
|
name: Run tests
|
2019-04-20 01:37:26 +02:00
|
|
|
command: make test-ci
|
2019-04-11 15:48:36 +02:00
|
|
|
|
2019-04-20 04:50:49 +02:00
|
|
|
vault:
|
|
|
|
docker:
|
|
|
|
- image: circleci/node:10
|
|
|
|
working_directory: ~/offen/vault
|
|
|
|
steps:
|
|
|
|
- checkout:
|
|
|
|
path: ~/offen
|
|
|
|
- restore_cache:
|
|
|
|
key: offen-vault-{{ checksum "package.json" }}
|
|
|
|
- run:
|
|
|
|
name: Install dependencies
|
|
|
|
command: npm install
|
|
|
|
- save_cache:
|
|
|
|
paths:
|
|
|
|
- ~/offen/vault/node_modules
|
|
|
|
key: offen-vault-{{ checksum "package.json" }}
|
|
|
|
- run:
|
|
|
|
name: Run tests
|
|
|
|
command: npm test
|
|
|
|
|
2019-04-11 15:48:36 +02:00
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
build_and_test:
|
|
|
|
jobs:
|
|
|
|
- server
|
2019-04-20 04:50:49 +02:00
|
|
|
- vault
|