diff --git a/.circleci/config.yml b/.circleci/config.yml index e6050ed3..fbe792cb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -19,18 +19,11 @@ defaults: REGISTRY_LOCATION: registry.atat.codes:443 jobs: - build: + app_setup: docker: - - image: registry.atat.codes:443/atat-app-builder:circleci - auth: - username: $REGISTRY_USERNAME - password: $REGISTRY_PASSWORD - environment: - KEEP_EXISTING_VENV: true - PGHOST: localhost - PGUSER: root - PGDATABASE: circle_test - REDIS_URI: redis://localhost:6379 + - image: *sourceImage + auth: *sourceAuth + environment: *appEnvironment - image: circleci/postgres:9.6.5-alpine-ram - image: circleci/redis:4-alpine3.8 steps: @@ -39,6 +32,8 @@ jobs: name: "Clone Submodules" command: | git submodule update --init --recursive + - attach_workspace: + at: . - restore_cache: name: "Load Cache: Pipenv References" keys: @@ -57,6 +52,10 @@ jobs: - yarn-v1-{{ .Branch }}-{{ checksum "yarn.lock" }} - yarn-v1-{{ .Branch }}- - yarn-v1- + - restore_cache: + name: "Load Cache: Node Modules" + keys: + - node-v1-{{ .Branch }}-{{ checksum "yarn.lock" }} - run: ./script/setup - save_cache: name: "Save Cache: Pipenv Refrences" @@ -73,12 +72,48 @@ jobs: paths: - ~/.cache/yarn key: yarn-v1-{{ .Branch }}-{{ checksum "yarn.lock" }} - - restore_cache: - keys: - - disa-crls - - run: ./script/sync-crls - 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: - ./crl - key: disa-crls - - run: ./script/cibuild + key: disa-crls-v1-{{ .Branch }}-{{ epoch}} + - 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 diff --git a/script/cibuild b/script/cibuild index 1493008c..39afa18d 100755 --- a/script/cibuild +++ b/script/cibuild @@ -13,6 +13,9 @@ PYTHON_FILES="./app.py ./atst/** ./config" # Enable Python testing RUN_PYTHON_TESTS="true" +# Reset the DB, since the one script/setup created might not be persisted +RESET_DB="true" + # Check python formatting source ./script/format check