Convert to using workslow with separate jobs

- Split build into app_setup and test jobs
- Add workflow sequence info
- Add DB reset to cibuild since it uses a fresh DB in a new build stage
This commit is contained in:
Devon Mackay 2018-09-07 14:51:50 -04:00 committed by Patrick Smith
parent 26a83df444
commit d77383ad9a
2 changed files with 55 additions and 17 deletions

View File

@ -19,18 +19,11 @@ defaults:
REGISTRY_LOCATION: registry.atat.codes:443 REGISTRY_LOCATION: registry.atat.codes:443
jobs: jobs:
build: app_setup:
docker: docker:
- image: registry.atat.codes:443/atat-app-builder:circleci - image: *sourceImage
auth: auth: *sourceAuth
username: $REGISTRY_USERNAME environment: *appEnvironment
password: $REGISTRY_PASSWORD
environment:
KEEP_EXISTING_VENV: true
PGHOST: localhost
PGUSER: root
PGDATABASE: circle_test
REDIS_URI: redis://localhost:6379
- image: circleci/postgres:9.6.5-alpine-ram - image: circleci/postgres:9.6.5-alpine-ram
- image: circleci/redis:4-alpine3.8 - image: circleci/redis:4-alpine3.8
steps: steps:
@ -39,6 +32,8 @@ jobs:
name: "Clone Submodules" name: "Clone Submodules"
command: | command: |
git submodule update --init --recursive git submodule update --init --recursive
- attach_workspace:
at: .
- restore_cache: - restore_cache:
name: "Load Cache: Pipenv References" name: "Load Cache: Pipenv References"
keys: keys:
@ -57,6 +52,10 @@ jobs:
- yarn-v1-{{ .Branch }}-{{ checksum "yarn.lock" }} - yarn-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
- yarn-v1-{{ .Branch }}- - yarn-v1-{{ .Branch }}-
- yarn-v1- - yarn-v1-
- restore_cache:
name: "Load Cache: Node Modules"
keys:
- node-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
- run: ./script/setup - run: ./script/setup
- save_cache: - save_cache:
name: "Save Cache: Pipenv Refrences" name: "Save Cache: Pipenv Refrences"
@ -73,12 +72,48 @@ jobs:
paths: paths:
- ~/.cache/yarn - ~/.cache/yarn
key: yarn-v1-{{ .Branch }}-{{ checksum "yarn.lock" }} key: yarn-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
- restore_cache:
keys:
- disa-crls
- run: ./script/sync-crls
- save_cache: - save_cache:
name: "Save Cache: Node Modules"
paths:
- ./node_modules
key: node-v1-{{ .Branch }}-{{ checksum "yarn.lock" }}
- restore_cache:
name: "Load Cache: CRLs"
keys:
- disa-crls-v1
- disa-crls
- run:
name: "Update CRLs"
command: ./script/sync-crls
- save_cache:
name: "Save Cache: CRLs"
paths: paths:
- ./crl - ./crl
key: disa-crls key: disa-crls-v1-{{ .Branch }}-{{ epoch}}
- run: ./script/cibuild - persist_to_workspace:
root: .
paths:
- .
test:
docker:
- image: *sourceImage
auth: *sourceAuth
environment: *appEnvironment
- image: circleci/postgres:9.6.5-alpine-ram
- image: circleci/redis:4-alpine3.8
steps:
- attach_workspace:
at: .
- run:
name: "Run Tests"
command: ./script/cibuild
workflows:
version: 2
run-tests:
jobs:
- app_setup
- test:
requires:
- app_setup

View File

@ -13,6 +13,9 @@ PYTHON_FILES="./app.py ./atst/** ./config"
# Enable Python testing # Enable Python testing
RUN_PYTHON_TESTS="true" RUN_PYTHON_TESTS="true"
# Reset the DB, since the one script/setup created might not be persisted
RESET_DB="true"
# Check python formatting # Check python formatting
source ./script/format check source ./script/format check