Skip to content

Commit c3cfae7

Browse files
committed
Refactor CircleCI config to have less duplication
1 parent ed7c466 commit c3cfae7

File tree

1 file changed

+120
-135
lines changed

1 file changed

+120
-135
lines changed

.circleci/config.yml

Lines changed: 120 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -1,139 +1,124 @@
1-
version: 2
1+
version: 2.1
2+
3+
executors:
4+
python:
5+
parameters:
6+
version:
7+
type: string
8+
docker:
9+
- image: python:<< parameters.version >>-alpine
10+
- image: postgres:11.0
11+
environment:
12+
POSTGRES_DB: 'psqlextra'
13+
POSTGRES_USER: 'psqlextra'
14+
POSTGRES_PASSWORD: 'psqlextra'
15+
16+
commands:
17+
install-dependencies:
18+
parameters:
19+
extra:
20+
type: string
21+
22+
steps:
23+
- run:
24+
name: Install packages
25+
command: apk add postgresql-libs gcc musl-dev postgresql-dev git
26+
27+
- run:
28+
name: Install Python packages
29+
command: pip install --progress-bar off .[<< parameters.extra >>]
30+
31+
run-tests:
32+
parameters:
33+
pyversion:
34+
type: integer
35+
djversions:
36+
type: string
37+
38+
steps:
39+
- run:
40+
name: Run tests
41+
command: tox -e 'py<< parameters.pyversion >>-dj{<< parameters.djversions >>}'
42+
environment:
43+
DATABASE_URL: 'postgres://psqlextra:psqlextra@localhost:5432/psqlextra'
44+
45+
246
jobs:
3-
test-python36:
4-
docker:
5-
- image: python:3.6-alpine
6-
- image: postgres:11.0
7-
environment:
8-
POSTGRES_DB: 'psqlextra'
9-
POSTGRES_USER: 'psqlextra'
10-
POSTGRES_PASSWORD: 'psqlextra'
11-
steps:
12-
- checkout
13-
- run:
14-
name: Install packages
15-
command: apk add postgresql-libs gcc musl-dev postgresql-dev git
16-
17-
- run:
18-
name: Install Python packages
19-
command: pip install --progress-bar off .[test]
20-
21-
- run:
22-
name: Run tests
23-
command: tox -e 'py36-dj{20,21,22,30,31}'
24-
environment:
25-
DATABASE_URL: 'postgres://psqlextra:psqlextra@localhost:5432/psqlextra'
26-
27-
test-python37:
28-
docker:
29-
- image: python:3.7-alpine
30-
- image: postgres:11.0
31-
environment:
32-
POSTGRES_DB: 'psqlextra'
33-
POSTGRES_USER: 'psqlextra'
34-
POSTGRES_PASSWORD: 'psqlextra'
35-
steps:
36-
- checkout
37-
- run:
38-
name: Install packages
39-
command: apk add postgresql-libs gcc musl-dev postgresql-dev git
40-
41-
- run:
42-
name: Install Python packages
43-
command: pip install --progress-bar off .[test]
44-
45-
- run:
46-
name: Run tests
47-
command: tox -e 'py37-dj{20,21,22,30,31}'
48-
environment:
49-
DATABASE_URL: 'postgres://psqlextra:psqlextra@localhost:5432/psqlextra'
50-
51-
test-python38:
52-
docker:
53-
- image: python:3.8-alpine
54-
- image: postgres:11.0
55-
environment:
56-
POSTGRES_DB: 'psqlextra'
57-
POSTGRES_USER: 'psqlextra'
58-
POSTGRES_PASSWORD: 'psqlextra'
59-
steps:
60-
- checkout
61-
- run:
62-
name: Install packages
63-
command: apk add postgresql-libs gcc musl-dev postgresql-dev git
64-
65-
- run:
66-
name: Install Python packages
67-
command: pip install --progress-bar off .[test]
68-
69-
- run:
70-
name: Run tests
71-
command: tox -e 'py38-dj{20,21,22,30,31}'
72-
environment:
73-
DATABASE_URL: 'postgres://psqlextra:psqlextra@localhost:5432/psqlextra'
74-
75-
- store_test_results:
76-
path: reports
77-
78-
- run:
79-
name: Upload coverage report
80-
command: coveralls
81-
82-
test-python39:
83-
docker:
84-
- image: python:3.9-alpine
85-
- image: postgres:11.0
86-
environment:
87-
POSTGRES_DB: 'psqlextra'
88-
POSTGRES_USER: 'psqlextra'
89-
POSTGRES_PASSWORD: 'psqlextra'
90-
steps:
91-
- checkout
92-
- run:
93-
name: Install packages
94-
command: apk add postgresql-libs gcc musl-dev postgresql-dev git
95-
96-
- run:
97-
name: Install Python packages
98-
command: pip install --progress-bar off .[test]
99-
100-
- run:
101-
name: Run tests
102-
command: tox -e 'py39-dj{21,22,30,31}'
103-
environment:
104-
DATABASE_URL: 'postgres://psqlextra:psqlextra@localhost:5432/psqlextra'
105-
106-
- store_test_results:
107-
path: reports
108-
109-
- run:
110-
name: Upload coverage report
111-
command: coveralls
112-
113-
analysis:
114-
docker:
115-
- image: python:3.8-alpine
116-
steps:
117-
- checkout
118-
- run:
119-
name: Install packages
120-
command: apk add postgresql-libs gcc musl-dev postgresql-dev git
121-
122-
- run:
123-
name: Install Python packages
124-
command: pip install .[analysis]
125-
126-
- run:
127-
name: Verify
128-
command: python setup.py verify
47+
test-python36:
48+
executor:
49+
name: python
50+
version: "3.6"
51+
52+
steps:
53+
- checkout
54+
- install-dependencies:
55+
extra: test
56+
- run-tests:
57+
pyversion: 36
58+
djversions: 20,21,22,30,31
59+
60+
test-python37:
61+
executor:
62+
name: python
63+
version: "3.7"
64+
65+
steps:
66+
- checkout
67+
- install-dependencies:
68+
extra: test
69+
- run-tests:
70+
pyversion: 37
71+
djversions: 20,21,22,30,31
72+
73+
test-python38:
74+
executor:
75+
name: python
76+
version: "3.8"
77+
78+
steps:
79+
- checkout
80+
- install-dependencies:
81+
extra: test
82+
- run-tests:
83+
pyversion: 38
84+
djversions: 20,21,22,30,31
85+
86+
test-python39:
87+
executor:
88+
name: python
89+
version: "3.9"
90+
91+
steps:
92+
- checkout
93+
- install-dependencies:
94+
extra: test
95+
- run-tests:
96+
pyversion: 39
97+
djversions: 21,22,30,31
98+
- store_test_results:
99+
path: reports
100+
- run:
101+
name: Upload coverage report
102+
command: coveralls
103+
104+
analysis:
105+
docker:
106+
- image: python:3.8-alpine
107+
steps:
108+
- checkout
109+
- install-dependencies:
110+
extra: analysis
111+
- run:
112+
name: Verify
113+
command: python setup.py verify
129114

130115

131116
workflows:
132-
version: 2
133-
build:
134-
jobs:
135-
- test-python36
136-
- test-python37
137-
- test-python38
138-
- test-python39
139-
- analysis
117+
version: 2
118+
build:
119+
jobs:
120+
- test-python36
121+
- test-python37
122+
- test-python38
123+
- test-python39
124+
- analysis

0 commit comments

Comments
 (0)