Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CircleCI Cconfig To Version 2 #298

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
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
73 changes: 73 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
version: 2
jobs:
build:
docker:
- image: circleci/python:3.7.5-node
environment:
DJANGO_SETTINGS_MODULE: {{ project_name }}.settings.dev
# CircleCI Postgres doesn't support SSL, so we need to disable it here
REQUIRE_SSL: "0"
- image: circleci/postgres:10.5
environment:
POSTGRES_USER: ubuntu
POSTGRES_DB: circle_test

steps:
- checkout

- run:
name: prepare requirements cache key
command: |
cd requirements
cat base.txt dev.txt > all.txt

- restore_cache:
name: restore pip cache
keys:
- v1-dependencies-{{ checksum "requirements/all.txt" }}
# If cache for exact version of `requirements/all.txt` is not present,
# then load any most recent one.
- v1-dependencies-

- run:
name: install requirements
command: |
python3.7 -m venv venv
. venv/bin/activate
pip install -r requirements/dev.txt

- save_cache:
name: save pip cache
paths:
- ./venv
key: v1-dependencies-{{ checksum "requirements/all.txt" }}

- restore_cache:
name: Restore npm cache
key: npm-v2-{{ checksum "package-lock.json" }}
- run:
name: install npm packages
command: |
npm install
- save_cache:
name: save npm cache
paths:
- ./node_modules
key: npm-v2-{{ checksum "package-lock.json" }}

- run:
# Do this so we can catch failures before we deploy. (This step
# is NOT actually needed for tests to be run.)
name: build the frontend bundle
command: |
npm run build

- run:
name: run tests
command: |
. venv/bin/activate
./run_tests.sh

- store_artifacts:
path: test-reports
destination: test-reports
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[run]
branch = true
omit = */tests/*, */migrations/*, */urls.py, */settings/*, */wsgi.py, manage.py, fabfile.py
omit = *venv/*, /tests/*, */migrations/*, */urls.py, */settings/*, */wsgi.py, manage.py, fabfile.py
source = .

[report]
17 changes: 0 additions & 17 deletions circle.yml

This file was deleted.

8 changes: 8 additions & 0 deletions project_name/settings/dev.py
Original file line number Diff line number Diff line change
@@ -34,3 +34,11 @@
)

LOGGING['root']['handlers'] = []

# CircleCI settings
if "CI" in os.environ:
# Use CircleCI's default database
DATABASES["default"]["NAME"] = "circle_test"
DATABASES["default"]["USER"] = "ubuntu"
DATABASES["default"]["HOST"] = "127.0.0.1"
DATABASES["default"]["PORT"] = "5432"
9 changes: 9 additions & 0 deletions run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
set -ex

flake8 .

coverage erase
python manage.py makemigrations --dry-run --check
coverage run manage.py test --keepdb --noinput "$@"
coverage report -m --skip-covered --fail-under 90