Created
June 17, 2020 15:03
-
-
Save bryanhuntesl/57c385681f1959dab6dfb6109cfe3d98 to your computer and use it in GitHub Desktop.
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
version: 2 | |
jobs: | |
lint: | |
docker: | |
- image: circleci/elixir:1.10.3-node-browsers | |
steps: | |
- checkout | |
- restore_cache: | |
keys: | |
- v1-elixir-deps-cache-{{ .Branch }}-{{ checksum "mix.lock" }} | |
- v1-elixir-deps-cache-{{ .Branch }} | |
- v1-elixir-deps-cache | |
- restore_cache: | |
keys: | |
- v1-elixir-build-cache-{{ .Branch }} | |
- v1-elixir-build-cache | |
- run: | |
name: Setup Environment Variables | |
command: | | |
echo "export MIX_ENV=test" >> $BASH_ENV | |
echo "export POSTGRES_HOSTNAME=localhost" >> $BASH_ENV | |
echo "export POSTGRES_PASSWORD=mysql" >> $BASH_ENV | |
echo "export POSTGRES_POOL_SIZE=20" >> $BASH_ENV | |
echo "export POSTGRES_PORT=5432" >> $BASH_ENV | |
echo "export POSTGRES_USER=postgres" >> $BASH_ENV | |
- run: mix local.hex --force | |
- run: mix local.rebar --force | |
- run: mix deps.get | |
- run: mix format --check-formatted | |
- run: mix credo | |
test: | |
docker: | |
- image: circleci/elixir:1.10.3-node-browsers | |
- image: circleci/postgres:12.2 | |
environment: | |
POSTGRES_USERNAME: postgres | |
POSTGRES_PASSWORD: postgres | |
- image: zhanglianxin/turndown-service | |
ports: | |
- 9999:9999 | |
steps: | |
- checkout | |
- restore_cache: | |
keys: | |
- v1-elixir-deps-cache-{{ .Branch }}-{{ checksum "mix.lock" }} | |
- v1-elixir-deps-cache-{{ .Branch }} | |
- v1-elixir-deps-cache | |
- restore_cache: | |
keys: | |
- v1-elixir-build-cache-{{ .Branch }} | |
- v1-elixir-build-cache | |
- run: | |
name: Setup Environment Variables | |
command: | | |
echo "export MIX_ENV=test" >> $BASH_ENV | |
echo "export POSTGRES_HOSTNAME=localhost" >> $BASH_ENV | |
echo "export POSTGRES_PASSWORD=mysql" >> $BASH_ENV | |
echo "export POSTGRES_POOL_SIZE=20" >> $BASH_ENV | |
echo "export POSTGRES_PORT=5432" >> $BASH_ENV | |
echo "export POSTGRES_USER=postgres" >> $BASH_ENV | |
- run: mix local.hex --force | |
- run: mix local.rebar --force | |
- run: mix deps.get | |
- run: mix compile --warnings-as-errors | |
- run: | |
name: Wait for DB | |
command: dockerize -wait tcp://localhost:5432 -timeout 1m | |
- run: mix test --trace | |
- save_cache: | |
key: v1-elixir-deps-cache-{{ .Branch }}-{{ checksum "mix.lock" }} | |
paths: | |
- deps | |
- save_cache: | |
key: v1-elixir-deps-cache-{{ .Branch }} | |
paths: | |
- deps | |
- save_cache: | |
key: v1-elixir-deps-cache | |
paths: | |
- deps | |
- save_cache: | |
key: v1-elixir-build-cache-{{ .Branch }} | |
paths: | |
- _build | |
- save_cache: | |
key: v1-elixir-build-cache | |
paths: | |
- _build | |
push_docker_image: | |
docker: | |
- image: docker:19.03.4-git | |
steps: | |
- checkout | |
- setup_remote_docker: | |
version: 18.09.3 | |
docker_layer_caching: true | |
- run: | |
name: Set required env vars | |
command: | | |
echo 'export COMMIT_SHA1=$CIRCLE_SHA1' >> $BASH_ENV | |
- run: | |
name: Build and publish docker image to AWS ECR | |
command: DOCKER_BUILDKIT=1 docker build . -t esl/training_temp:${COMMIT_SHA1} | |
workflows: | |
version: 2 | |
flow: | |
jobs: | |
- lint | |
- test | |
- push_docker_image: | |
requires: | |
- lint | |
- test | |
filters: | |
branches: | |
only: | |
- master | |
- staging |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment