/
config.yml
119 lines (110 loc) · 2.99 KB
/
config.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
version: 2.1
executors:
# define our execution environment
py-exec:
docker:
- image: circleci/python:3.7.1
environment:
PIPENV_VENV_IN_PROJECT: true
TEST_DATABASE_URL: postgresql://postgres@localhost/circle_test?sslmode=disable
- image: circleci/postgres:11-alpine-postgis
environment:
POSTGRES_USER: postgres
POSTGRES_DB: circle
working_directory: ~/pybuild
workflows:
version: 2
build_and_test:
jobs:
- checkout_code
- deps:
requires:
- checkout_code
- tests:
requires:
- deps
- lint:
requires:
- deps
- type_checks:
requires:
- deps
# - analysis:
# requires:
# - deps
jobs:
# git clone
checkout_code:
executor: py-exec
working_directory: ~/pybuild
steps:
- checkout
- save_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/pybuild
# run pipenv install and save the .venv dir
deps:
executor: py-exec
steps:
- run: sudo chown -R circleci:circleci /usr/local/bin
- run: sudo chown -R circleci:circleci /usr/local/lib/python3.7/site-packages
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
key: v2-dep-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- run:
command: |
sudo pip install pipenv
pipenv sync --bare --dev
- save_cache: # cache Python dependencies using checksum of Pipfile as the cache-key
key: v2-dep-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
paths:
- "~/pybuild/.venv"
# pytest
tests:
executor: py-exec
steps:
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
key: v2-dep-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- run:
command: |
mkdir test-reports
pipenv run pytest --junitxml=test-reports/junit.xml
- store_test_results:
path: test-reports
# mypy
type_checks:
executor: py-exec
steps:
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
key: v2-dep-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- run:
command: |
pipenv run mypy .
# flake8
lint:
executor: py-exec
steps:
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
key: v2-dep-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- run:
command: |
pipenv run flake8
# bento
analysis:
executor: py-exec
steps:
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
key: v2-dep-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- run:
command: |
pipenv run bento --agree --email mischa@jetbridge.com check