Skip to content
This repository has been archived by the owner on Sep 12, 2019. It is now read-only.

More Circle CI testing #518

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ae107f2
Add Circle CI config file.
tadhg-ohiggins Jul 27, 2017
3f76eb6
Test Circle CI config.
tadhg-ohiggins Jul 27, 2017
ce3b273
Test Circle CI config.
tadhg-ohiggins Jul 27, 2017
de7be82
Test Circle CI config.
tadhg-ohiggins Jul 27, 2017
4af906a
Test Circle CI config.
tadhg-ohiggins Jul 31, 2017
95a3e1b
Test Circle CI config.
tadhg-ohiggins Jul 31, 2017
6805e72
Test Circle CI config.
tadhg-ohiggins Jul 31, 2017
8d9cc61
Test Circle CI config.
tadhg-ohiggins Jul 31, 2017
0a188db
Test Circle CI config.
tadhg-ohiggins Jul 31, 2017
8e19ee5
Test Circle CI config.
tadhg-ohiggins Jul 31, 2017
250d4e4
Test Circle CI config.
tadhg-ohiggins Jul 31, 2017
dd83e26
Test Circle CI config.
tadhg-ohiggins Jul 31, 2017
38e3273
Test Circle CI config.
tadhg-ohiggins Jul 31, 2017
d99da7c
Test Circle CI config.
tadhg-ohiggins Jul 31, 2017
62c130c
Test Circle CI config.
tadhg-ohiggins Aug 3, 2017
3826b17
Test Circle CI config.
tadhg-ohiggins Aug 3, 2017
ef57502
Test Circle CI config.
tadhg-ohiggins Aug 3, 2017
0c7ae15
Test Circle CI config.
tadhg-ohiggins Aug 3, 2017
4cbabff
Test Circle CI config.
tadhg-ohiggins Aug 3, 2017
ef8ae7e
Test Circle CI config.
tadhg-ohiggins Aug 3, 2017
792480e
Test Circle CI config.
tadhg-ohiggins Aug 3, 2017
aeef173
Test Circle CI config.
tadhg-ohiggins Aug 3, 2017
da520c6
Test Circle CI config.
tadhg-ohiggins Aug 3, 2017
be07e53
Test Circle CI config.
tadhg-ohiggins Aug 3, 2017
142e616
Test Circle CI config.
tadhg-ohiggins Aug 3, 2017
ccd553d
Test Circle CI config.
tadhg-ohiggins Aug 3, 2017
ef200ae
Test Circle CI config.
tadhg-ohiggins Aug 3, 2017
4885944
Test Circle CI config.
tadhg-ohiggins Aug 3, 2017
16a3eb7
Test Circle CI config.
tadhg-ohiggins Aug 10, 2017
733ca11
Test Circle CI config.
tadhg-ohiggins Aug 10, 2017
e6c3f66
Test Circle CI config.
tadhg-ohiggins Aug 10, 2017
d9c0d7b
Test Circle CI config.
tadhg-ohiggins Aug 10, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
version: 2
jobs:
build:
docker:
- image: circleci/python:3.6.2

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4

working_directory: ~/repo

steps:
- checkout
- setup_remote_docker

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "requirements.txt" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- save_cache:
paths:
- ./venv
key: v1-dependencies-{{ checksum "requirements.txt" }}

# setup
- run:
name: circleci-setup
command: |
docker create -v /usr/src/app -v /usr/src/app/.venv --name holder python:3.6.2
docker cp . holder:/usr/src/app
docker start holder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very innovative solution, nice work!

# run tests!
- run:
name: run tests
command: |
ls eregs_libs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still needed?

docker-compose -f docker-compose-circle.yml run flake8 atf_eregs
docker-compose -f docker-compose-circle.yml run py.test atf_eregs/tests
environment:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed this time through, but we should figure out how to run the parser tests, too.

DEBUG: TRUE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? I think the docker-compose file is setting the DEBUG value in its containers.


- store_artifacts:
path: test-reports
destination: test-reports

5 changes: 2 additions & 3 deletions devops/activate_then
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ if [ -n "$DEBUG" ]; then

if git diff --exit-code eregs_libs/regulations-site > /dev/null
then
git submodule update eregs_libs/regulations-site
git submodule update --init eregs_libs/regulations-site
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --init was added in #494 -- does this need to be rebased, maybe?

else
echo "Warning: Modified version of regulations-site detected"
fi

if git diff --exit-code eregs_libs/regulations-core > /dev/null
then
git submodule update eregs_libs/regulations-core
git submodule update --init eregs_libs/regulations-core
else
echo "Warning: Modified version of regulations-core detected"
fi
Expand All @@ -33,5 +33,4 @@ else
pip-sync requirements.txt
fi


exec "$@"
90 changes: 90 additions & 0 deletions docker-compose-circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
version: '2'
services:
persistent_db:
image: postgres:9.4
volumes_from:
- container:holder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this round, but if the volumes are the only significant change, what do you think about replacing them in a sed command or similar? That way we wouldn't need to maintain two configurations.

prod: &PROD
image: python:3.6.2
command: ./devops/activate_then ./devops/run_webserver.sh
ports:
- 9000:9000
environment: &PROD_ENV
PORT: 9000
DJANGO_SETTINGS_MODULE: atf_eregs.settings.base
TMPDIR: /tmp
STATIC_ROOT: frontend_build
VCAP_APPLICATION: >
{"uris": ["localhost", "0.0.0.0", "127.0.0.1"]}
volumes_from:
- container:holder
working_dir: /usr/src/app
stdin_open: true
tty: true
dev: &DEV
<<: *PROD
ports:
- 8000:8000
environment: &DEV_ENV
<<: *PROD_ENV
DEBUG: "true"
PORT: 8000
dev-with-db:
<<: *DEV
ports:
- 8001:8001
command: ./devops/wait_for_db_then ./devops/activate_then ./devops/run_webserver.sh
environment:
<<: *DEV_ENV
DATABASE_URL: postgres://postgres@persistent_db/postgres
PORT: 8001
VCAP_APPLICATION: >
{"uris": ["localhost", "0.0.0.0", "127.0.0.1", "dev-with-db"]}
depends_on:
- persistent_db


#---- Commands ----
manage.py:
<<: *DEV
entrypoint: ./devops/activate_then ./manage.py
command: ''
ports: []

py.test:
<<: *DEV
entrypoint: ./devops/activate_then py.test
command: ''
ports: []

flake8:
<<: *DEV
entrypoint: ./devops/activate_then flake8
command: ''
ports: []

pip-compile:
<<: *DEV
entrypoint: ./devops/activate_then pip-compile
command: ''
ports: []

bandit:
<<: *DEV
entrypoint: ./devops/activate_then bandit
command: ''
ports: []

grunt:
image: node:6
volumes:
- $PWD:/usr/src/app
- npm_libs:/usr/src/app/frontend_build/node_modules/
working_dir: /usr/src/app/frontend_build/
entrypoint: ../devops/deps_ok_then ./node_modules/.bin/grunt

volumes:
database_data:
prod_libs:
dev_libs:
npm_libs:
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ services:
command: ''
ports: []

orient:
<<: *DEV
entrypoint: ls
command: ''
ports: []

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm betting this addition wasn't intended?

py.test:
<<: *DEV
entrypoint: ./devops/activate_then py.test
Expand Down