Skip to content

Instantly share code, notes, and snippets.

@hok
Created March 7, 2019 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hok/e114b883888df6a78545a4c55ad60a41 to your computer and use it in GitHub Desktop.
Save hok/e114b883888df6a78545a4c55ad60a41 to your computer and use it in GitHub Desktop.
CircleCI 2 config (.circleci/config.yml)
version: 2
jobs:
build:
parallelism: 1
docker:
- image: circleci/elixir:1.8.1-node-browsers
environment:
MIX_ENV: test
POSTGRES_USER: postgres
POSTGRES_DB: app_test
POSTGRES_PASSWORD:
- image: circleci/postgres:10-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_DB: app_test
POSTGRES_PASSWORD:
working_directory: ~/app
steps:
- checkout
- run: mix local.hex --force
- run: mix local.rebar --force
- restore_cache:
keys:
- v1-mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
- v1-mix-cache-{{ .Branch }}
- v1-mix-cache
- restore_cache:
keys:
- v1-build-cache-{{ .Branch }}
- v1-build-cache
- run: mix do deps.get, compile
- save_cache:
key: v1-mix-cache-{{ .Branch }}-{{ checksum "mix.lock" }}
paths: "deps"
- save_cache:
key: v1-mix-cache-{{ .Branch }}
paths: "deps"
- save_cache:
key: v1-mix-cache
paths: "deps"
- save_cache:
key: v1-build-cache-{{ .Branch }}
paths: "_build"
- save_cache:
key: v1-build-cache
paths: "_build"
- restore_cache:
keys:
- v1-yarn-cache-{{ .Branch }}-{{ checksum "apps/web/assets/yarn.lock" }}
- v1-yarn-cache-{{ .Branch }}
- v1-yarn-cache
- run:
name: Install node dependencies
working_directory: apps/web/assets
command: yarn install
- save_cache:
key: v1-yarn-cache-{{ .Branch }}-{{ checksum "apps/web/assets/yarn.lock" }}
paths: apps/web/assets/node_modules
- save_cache:
key: v1-yarn-cache-{{ .Branch }}
paths: apps/web/assets/node_modules
- save_cache:
key: v1-yarn-cache
paths: apps/web/assets/node_modules
- run:
name: Wait for DB
command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run: mix test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment