Add config (CircleCI Orb recipes) for building Docker images and pushing the results to both AWS and Azure Docker registries.
106 lines
2.7 KiB
YAML
106 lines
2.7 KiB
YAML
version: 2.1
|
|
|
|
orbs:
|
|
aws-ecr: circleci/aws-ecr@4.0.1
|
|
azure-acr: circleci/azure-acr@0.1.1
|
|
|
|
defaults:
|
|
appEnvironment: &appEnvironment
|
|
KEEP_EXISTING_VENV: true
|
|
PGHOST: localhost
|
|
PGUSER: root
|
|
PGDATABASE: circle_test
|
|
REDIS_URI: redis://localhost:6379
|
|
PIP_VERSION: 18.*
|
|
CRL_STORAGE_PROVIDER: CLOUDFILES
|
|
|
|
jobs:
|
|
app_setup:
|
|
docker:
|
|
- image: circleci/python:3.7.3-stretch-node
|
|
environment: *appEnvironment
|
|
- image: circleci/postgres:9.6.5-alpine-ram
|
|
- image: circleci/redis:4-alpine3.8
|
|
steps:
|
|
- checkout
|
|
- run: sudo apt-get update
|
|
- run: sudo apt-get install postgresql-client-9.6
|
|
- attach_workspace:
|
|
at: .
|
|
- run: ./script/setup
|
|
- save_cache:
|
|
name: "Save Cache: Pipenv Refrences"
|
|
paths:
|
|
- ~/.local/share
|
|
key: pipenv-v1-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
|
|
- save_cache:
|
|
name: "Save Cache: Python Venv"
|
|
paths:
|
|
- ./.venv
|
|
key: venv-v1-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
|
|
- save_cache:
|
|
name: "Save Cache: Yarn"
|
|
paths:
|
|
- ~/.cache/yarn
|
|
key: yarn-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
|
|
- save_cache:
|
|
name: "Save Cache: Node Modules"
|
|
paths:
|
|
- ./node_modules
|
|
key: node-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
|
|
- run:
|
|
name: "Update CRLs"
|
|
command: ./script/sync-crls
|
|
- run:
|
|
name: "Generate build info"
|
|
command: ./script/generate_build_info.sh
|
|
- persist_to_workspace:
|
|
root: .
|
|
paths:
|
|
- .
|
|
|
|
test:
|
|
docker:
|
|
- image: circleci/python:3.7.3-stretch-node
|
|
environment: *appEnvironment
|
|
- image: circleci/postgres:9.6.5-alpine-ram
|
|
- image: circleci/redis:4-alpine3.8
|
|
steps:
|
|
- attach_workspace:
|
|
at: .
|
|
- run: sudo apt-get update
|
|
- run: sudo apt-get install postgresql-client-9.6
|
|
- run:
|
|
name: "Run Tests"
|
|
command: ./script/cibuild
|
|
|
|
|
|
workflows:
|
|
version: 2
|
|
run-tests:
|
|
jobs:
|
|
- app_setup
|
|
- test:
|
|
requires:
|
|
- app_setup
|
|
- aws-ecr/build_and_push_image:
|
|
repo: atat
|
|
tag: "${CIRCLE_SHA1}"
|
|
requires:
|
|
- test
|
|
filters:
|
|
branches:
|
|
only:
|
|
- master
|
|
- azure-acr/build_and_push_image:
|
|
login-server-name: "${AZURE_SERVER_NAME}"
|
|
registry-name: pwatat
|
|
repo: atat
|
|
tag: "${CIRCLE_SHA1}"
|
|
requires:
|
|
- test
|
|
filters:
|
|
branches:
|
|
only:
|
|
- master
|