-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.circleci.yml
68 lines (68 loc) · 2.57 KB
/
.circleci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
version: 2.1
workflows:
version: 2
test:
jobs:
- test-python
jobs:
test-python:
docker:
- image: kogancom/circleci-py36-node
- image: circleci/redis
- image: elasticsearch
name: elasticsearch
- image: rabbitmq
- image: circleci/postgres
environment:
POSTGRES_USER: postgres
resource_class: medium+
parallelism: 4
steps:
- checkout
- restore_cache:
keys:
- pip-36-cache-{{ checksum "requirements/production.txt" }}-{{ checksum "requirements/develop.txt"}}
- run:
name: Install System Packages
command: |
sudo apt update
sudo apt install -y libyajl2 postgresql-client libpq-dev
- run:
name: Install Python Packages
command: pip install --user --no-warn-script-location -r requirements/develop.txt
- save_cache:
key: pip-36-cache-{{ checksum "requirements/production.txt" }}-{{ checksum "requirements/develop.txt"}}
paths:
- /home/circleci/.cache/pip
- run:
name: Prepare Postgres
command: |
psql -h localhost -p 5432 -U postgres -d template1 -c "create extension citext"
psql -h localhost -p 5432 -U postgres -d template1 -c "create extension hstore"
psql -h localhost -p 5432 -U postgres -c 'create database xxx;'
- run:
# pip install --user installs scripts to ~/.local/bin
name: Setup Path
command: echo 'export PATH=/home/circleci/.local/bin:$PATH' >> $BASH_ENV
- run:
name: PyTest
no_output_timeout: 8m
environment:
DJANGO_SETTINGS_MODULE: xxx.settings.test
TEST_NO_MIGRATE: '1'
BOTO_CONFIG: /dev/null
DATABASE_HOST: localhost
DATABASE_NAME: xxx
DATABASE_USER: postgres
DATABASE_PASSWORD: xxx
REDIS_HOST: localhost
BROKER_URL: 'pyamqp://xxx:yyy@localhost:5672//'
command: |
cd myapp
mkdir test-reports
TESTFILES=$(circleci tests glob "**/tests/**/test*.py" "**/tests.py" | circleci tests split --split-by=timings)
# coverage disabled until we can find a way to aggregate parallel cov reports
# --cov=apps --cov-report html:test-reports/coverage
pytest --rootdir="." --tb=native --durations=20 --nomigrations --create-db --log-level=ERROR -v --junitxml=test-reports/python/junit.xml --timeout=20 $TESTFILES
- store_test_results:
path: myapp/test-reports