1- # Python CircleCI 2.0 configuration file
2- #
3- # Check https://circleci.com/docs/2.0/language-python/ for more details
4- #
51version : 2.1
62commands :
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+
725 early_return_for_forked_pull_requests :
826 description : >-
927 If this build is from a fork, stop executing the current job and return success.
@@ -12,33 +30,44 @@ commands:
1230 - run :
1331 name : Early return if this build is from a forked PR
1432 command : |
15- if [ -n "$CIRCLE_PR_NUMBER" ]; then
33+ if [[ -n "$CIRCLE_PR_NUMBER" ] ]; then
1634 echo "Nothing to do for forked PRs, so marking this step successful"
1735 circleci step halt
1836 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
2737
38+ build_and_test :
2839 steps :
40+ - abort_for_docs
41+ - abort_for_noci
2942 - checkout
3043
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+
3150 - 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+
3461
3562 - run :
36- name : Test package build
37- command : tox -e sdist
63+ name : build sdist and wheels
64+ command : |
65+ poetry build
3866
3967 - run :
40- name : Run code styles
41- command : tox -e pep8
68+ name : lint
69+ command : |
70+ tox -e linters
4271
4372 - run :
4473 name : Run unittest with coverage
@@ -49,27 +78,90 @@ jobs:
4978 command : tox -e func
5079
5180 - early_return_for_forked_pull_requests
52-
5381 - run :
54- name : codecove
82+ name : codecov
5583 command : |
5684 . .tox/func/bin/activate
5785 codecov --file .tox/cover/report/coverage.xml --name ${CODECOV_NAME}-unittests
5886 codecov --file .tox/func/report/coverage.xml --name ${CODECOV_NAME}-functional
5987
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"
60153
61154workflows :
62- version : 2
63155 commit :
64156 jobs :
65- - build
157+ - build :
158+ << : *on-any-branch
159+ << : *python-versions
160+
66161 nightly :
67162 triggers :
68163 - schedule :
69164 cron : " 0 0 * * *"
70- filters :
71- branches :
72- only :
73- - master
165+ << : *on-master
74166 jobs :
75- - build
167+ - build_and_publish
0 commit comments