1
- # Python CircleCI 2.0 configuration file
2
- #
3
- # Check https://circleci.com/docs/2.0/language-python/ for more details
4
- #
5
1
version : 2.1
6
2
commands :
3
+
4
+ abort_for_docs :
5
+ steps :
6
+ - run :
7
+ name : Avoid tests for docs
8
+ command : |
9
+ if [[ $CIRCLE_BRANCH == *docs ]]; then
10
+ echo "Identifies as documents PR, no testing required"
11
+ circleci step halt
12
+ fi
13
+
14
+ abort_for_noci :
15
+ steps :
16
+ - run :
17
+ name : Ignore CI for specific branches
18
+ command : |
19
+ if [[ $CIRCLE_BRANCH == *noci ]]; then
20
+ echo "Identifies as actively ignoring CI, no testing required."
21
+ circleci step halt
22
+ fi
23
+
24
+
7
25
early_return_for_forked_pull_requests :
8
26
description : >-
9
27
If this build is from a fork, stop executing the current job and return success.
@@ -12,33 +30,44 @@ commands:
12
30
- run :
13
31
name : Early return if this build is from a forked PR
14
32
command : |
15
- if [ -n "$CIRCLE_PR_NUMBER" ]; then
33
+ if [[ -n "$CIRCLE_PR_NUMBER" ] ]; then
16
34
echo "Nothing to do for forked PRs, so marking this step successful"
17
35
circleci step halt
18
36
fi
19
- jobs :
20
- build :
21
- docker :
22
- - image : circleci/python:3.6.1
23
-
24
- - image : redislabs/redisgraph:edge
25
-
26
- working_directory : ~/repo
27
37
38
+ build_and_test :
28
39
steps :
40
+ - abort_for_docs
41
+ - abort_for_noci
29
42
- checkout
30
43
44
+ - restore_cache : # Download and cache dependencies
45
+ keys :
46
+ - v1-dependencies-{{ checksum "pyproject.toml" }}
47
+ # fallback to using the latest cache if no exact match is found
48
+ - v1-dependencies-
49
+
31
50
- run :
32
- name : Install tox
33
- command : sudo pip install tox
51
+ name : install tox dependencies
52
+ command : |
53
+ pip install --user --quiet -r .circleci/circle_requirements.txt
54
+
55
+ - save_cache :
56
+ paths :
57
+ - ./.tox
58
+ - ~/.cache/pip
59
+ key : v1-dependencies-{{ checksum "pyproject.toml" }}
60
+
34
61
35
62
- run :
36
- name : Test package build
37
- command : tox -e sdist
63
+ name : build sdist and wheels
64
+ command : |
65
+ poetry build
38
66
39
67
- run :
40
- name : Run code styles
41
- command : tox -e pep8
68
+ name : lint
69
+ command : |
70
+ tox -e linters
42
71
43
72
- run :
44
73
name : Run unittest with coverage
@@ -49,27 +78,90 @@ jobs:
49
78
command : tox -e func
50
79
51
80
- early_return_for_forked_pull_requests
52
-
53
81
- run :
54
- name : codecove
82
+ name : codecov
55
83
command : |
56
84
. .tox/func/bin/activate
57
85
codecov --file .tox/cover/report/coverage.xml --name ${CODECOV_NAME}-unittests
58
86
codecov --file .tox/func/report/coverage.xml --name ${CODECOV_NAME}-functional
59
87
88
+ docker :
89
+ parameters :
90
+ docker_version :
91
+ type : string
92
+ default : " edge"
93
+ steps :
94
+ - setup_remote_docker
95
+ - run :
96
+ name : dockers
97
+ description : Build and release docker
98
+ command : |
99
+ bash <(curl -fsSL https://get.docker.com)
100
+ docker login -u redisfab -p $DOCKER_REDISFAB_PWD
101
+ docker build -t redisgraph:<<parameters.docker_version>> .
102
+ docker push
103
+
104
+ jobs :
105
+ build :
106
+ parameters :
107
+ python_version :
108
+ type : string
109
+ docker :
110
+ - image : circleci/python:<<parameters.python_version>>
111
+ - image : redislabs/redisgraph:edge
112
+ steps :
113
+ - build_and_test
114
+
115
+ # since this is used by cron, we by default build against latest
116
+ build_and_publish :
117
+ parameters :
118
+ docker_version :
119
+ type : string
120
+ default : " edge"
121
+ docker :
122
+ - image : circleci/python:latest
123
+ - image : redislabs/redisgraph:edge
124
+
125
+ steps :
126
+ - build_and_test
127
+ - docker
128
+
129
+ on-any-branch : &on-any-branch
130
+ filters :
131
+ branches :
132
+ only :
133
+ - /.*/
134
+ tags :
135
+ ignore : /.*/
136
+
137
+ on-master : &on-master
138
+ filters :
139
+ branches :
140
+ only :
141
+ - master
142
+
143
+ # the is to build and test, per commit against all supported python versions
144
+ python-versions : &python-versions
145
+ matrix :
146
+ parameters :
147
+ python_version :
148
+ - " 3.6.9"
149
+ - " 3.7.9"
150
+ - " 3.8.9"
151
+ - " 3.9.4"
152
+ - " latest"
60
153
61
154
workflows :
62
- version : 2
63
155
commit :
64
156
jobs :
65
- - build
157
+ - build :
158
+ << : *on-any-branch
159
+ << : *python-versions
160
+
66
161
nightly :
67
162
triggers :
68
163
- schedule :
69
164
cron : " 0 0 * * *"
70
- filters :
71
- branches :
72
- only :
73
- - master
165
+ << : *on-master
74
166
jobs :
75
- - build
167
+ - build_and_publish
0 commit comments