1version: 2.1
2
3orbs:
4  python: cjw296/python-ci@2
5
6jobs:
7  check-package:
8    parameters:
9      image:
10        type: string
11      extra_package:
12        type: string
13        default: ""
14      imports:
15        type: string
16        default: "testfixtures"
17    docker:
18      - image: << parameters.image >>
19    steps:
20      - python/check-package:
21          package: "testfixtures"
22          extra_packages: <<  parameters.extra_package >>
23          test:
24          - run:
25              name: "Check Imports"
26              command: python -c "import << parameters.imports >>"
27
28common: &common
29  jobs:
30    - python/pip-run-tests:
31        name: python27
32        image: circleci/python:2.7
33    - python/pip-run-tests:
34        name: python36
35        # so we test the mock monkey patches:
36        image: circleci/python:3.6.6
37    - python/pip-run-tests:
38        name: python37
39        image: circleci/python:3.7
40    - python/pip-run-tests:
41        name: python38
42        image: circleci/python:3.8
43    - python/pip-run-tests:
44        name: python39
45        image: circleci/python:3.9
46    - python/pip-run-tests:
47        name: python39-mock-backport
48        image: circleci/python:3.9
49        extra_packages: "mock"
50    - python/pip-run-tests:
51        name: python27-django-1-9
52        image: circleci/python:2.7
53        extra_packages: "'django<1.10'"
54    - python/pip-run-tests:
55        name: python36-django-1-11
56        image: circleci/python:3.6
57        extra_packages: "'django<1.12'"
58    - python/pip-run-tests:
59        name: python39-django-latest
60        image: circleci/python:3.9
61
62    - python/coverage:
63        name: coverage
64        image: circleci/python:3.7
65        requires:
66          - python27
67          - python36
68          - python37
69          - python38
70          - python39
71          - python39-mock-backport
72          - python27-django-1-9
73          - python36-django-1-11
74          - python39-django-latest
75
76    - python/pip-docs:
77        name: docs
78        requires:
79          - coverage
80
81    - python/pip-setuptools-build-package:
82        name: package
83        requires:
84          - docs
85        filters:
86          branches:
87            only: master
88
89    - check-package:
90        name: check-package-python27
91        image: circleci/python:2.7
92        requires:
93          - package
94
95    - check-package:
96        name: check-package-python39
97        image: circleci/python:3.9
98        requires:
99          - package
100
101    - check-package:
102        name: check-package-python27-mock
103        image: circleci/python:2.7
104        extra_package: mock
105        imports: "testfixtures, testfixtures.mock"
106        requires:
107          - package
108
109    - check-package:
110        name: check-package-python39-mock
111        image: circleci/python:3.9
112        extra_package: mock
113        imports: "testfixtures, testfixtures.mock"
114        requires:
115          - package
116
117    - check-package:
118        name: check-package-python39-django
119        image: circleci/python:3.9
120        extra_package: django
121        imports: "testfixtures, testfixtures.django"
122        requires:
123          - package
124
125    - python/release:
126        name: release
127        config: .carthorse.yml
128        requires:
129          - check-package-python27
130          - check-package-python27-mock
131          - check-package-python39
132          - check-package-python39-mock
133          - check-package-python39-django
134
135workflows:
136  push:
137    <<: *common
138  periodic:
139    <<: *common
140    triggers:
141      - schedule:
142          cron: "0 1 * * *"
143          filters:
144            branches:
145              only: master
146