Browse Source
👷 Create CircleCI config
👷 Create CircleCI config
pull/3/head
Anthony Quéré
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
90 additions and
0 deletions
-
.circleci/config.yml
|
|
@ -0,0 +1,90 @@ |
|
|
|
|
|
version: 2.1 |
|
|
|
|
|
# --- Constants --- # |
|
|
|
|
|
|
|
|
|
|
|
globals: |
|
|
|
|
|
images: |
|
|
|
|
|
node: &node cimg/node:lts |
|
|
|
|
|
postgres: &postgres circleci/postgres:9.6.5 |
|
|
|
|
|
caches: |
|
|
|
|
|
dependencies: &dependencies dependencies-{{ checksum "package.json" }} |
|
|
|
|
|
|
|
|
|
|
|
# --- Commands --- # |
|
|
|
|
|
|
|
|
|
|
|
commands: |
|
|
|
|
|
setup_dependencies: |
|
|
|
|
|
description: Setup the environment |
|
|
|
|
|
steps: |
|
|
|
|
|
- checkout |
|
|
|
|
|
- restore_cache: |
|
|
|
|
|
keys: |
|
|
|
|
|
- *dependencies |
|
|
|
|
|
|
|
|
|
|
|
# --- Jobs definitions --- # |
|
|
|
|
|
|
|
|
|
|
|
jobs: |
|
|
|
|
|
build: &shared-config |
|
|
|
|
|
docker: |
|
|
|
|
|
- image: *node |
|
|
|
|
|
working_directory: ~/app |
|
|
|
|
|
steps: |
|
|
|
|
|
- checkout |
|
|
|
|
|
- restore_cache: |
|
|
|
|
|
keys: |
|
|
|
|
|
- *dependencies |
|
|
|
|
|
# fallback to using the latest cache if no exact match is found |
|
|
|
|
|
- dependencies- |
|
|
|
|
|
- run: yarn install |
|
|
|
|
|
- save_cache: |
|
|
|
|
|
paths: |
|
|
|
|
|
- node_modules |
|
|
|
|
|
key: *dependencies |
|
|
|
|
|
test: |
|
|
|
|
|
<<: *shared-config |
|
|
|
|
|
steps: |
|
|
|
|
|
- setup_dependencies |
|
|
|
|
|
- run: yarn test |
|
|
|
|
|
|
|
|
|
|
|
test-e2e: |
|
|
|
|
|
<<: *shared-config |
|
|
|
|
|
docker: |
|
|
|
|
|
- image: *node |
|
|
|
|
|
- image: *postgres |
|
|
|
|
|
environment: |
|
|
|
|
|
POSTGRES_DB: postgres |
|
|
|
|
|
POSTGRES_USER: postgres |
|
|
|
|
|
POSTGRES_PASSWORD: postgres |
|
|
|
|
|
steps: |
|
|
|
|
|
- setup_dependencies |
|
|
|
|
|
- run: |
|
|
|
|
|
command: yarn test:e2e |
|
|
|
|
|
environment: |
|
|
|
|
|
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres |
|
|
|
|
|
|
|
|
|
|
|
lint: |
|
|
|
|
|
<<: *shared-config |
|
|
|
|
|
steps: |
|
|
|
|
|
- setup_dependencies |
|
|
|
|
|
- run: |
|
|
|
|
|
name: Check files format |
|
|
|
|
|
command: yarn format:check |
|
|
|
|
|
|
|
|
|
|
|
- run: |
|
|
|
|
|
name: Lint files |
|
|
|
|
|
command: yarn lint |
|
|
|
|
|
|
|
|
|
|
|
# --- Workflow definition --- # |
|
|
|
|
|
|
|
|
|
|
|
workflows: |
|
|
|
|
|
version: 2 |
|
|
|
|
|
build-test-and-lint: |
|
|
|
|
|
jobs: |
|
|
|
|
|
- build |
|
|
|
|
|
- test: |
|
|
|
|
|
requires: |
|
|
|
|
|
- build |
|
|
|
|
|
- test-e2e: |
|
|
|
|
|
requires: |
|
|
|
|
|
- build |
|
|
|
|
|
- lint: |
|
|
|
|
|
requires: |
|
|
|
|
|
- build |