.circleci/config.yml
defaults: &defaults
working_directory: /routemaster
docker:
- image: deliveroo/circleci:0.1.15
version: 2
jobs:
run_test_suite:
<<: *defaults
# we want to run tests multiple times to minimise the risk of flaky tests in
# this (critical) application
parallelism: 5
steps:
- setup_remote_docker:
reusable: true
- checkout
- run:
name: Ensure clean slate
command: ci down
- run:
name: Build composition
command: ci build
- run:
name: Wait for Redis to start
command: ci run --rm wait wfi redis:6379
- run:
name: Run tests and report
command: ci run --rm app bin/test_and_report
push_image: &push_image
<<: *defaults
steps:
- setup_remote_docker:
reusable: true
- checkout
- run:
name: Make sure we are on HEAD
command: ensure_head
- run:
name: Build image
command: docker build --tag routemaster:${CIRCLE_SHA1} .
- run:
name: Push image to ECR
command: |
`print_env ${TARGET}`
push_image_to_ecr \
--image-name routemaster \
--ecr-repo $AWS_ECR_REPO_URL \
--aws-region $AWS_REGION
push_image_staging:
<<: *push_image
environment:
- TARGET: staging
push_image_production:
<<: *push_image
environment:
- TARGET: production
workflows:
version: 2
test_and_build:
jobs:
- run_test_suite
- push_image_staging:
requires:
- run_test_suite
filters:
branches:
only:
- hopper-changes
- staging
- push_image_production:
requires:
- run_test_suite
filters:
branches:
only:
- master