Skip to content

Commit c2ee6ec

Browse files
merge
2 parents 1ec4997 + 5952199 commit c2ee6ec

21 files changed

+346
-137
lines changed

.circleci/circle_requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
poetry>=1.1.6
2+
tox>=3.23.1
3+
tox-poetry>=0.3.0

.circleci/config.yml

Lines changed: 120 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
1-
# Python CircleCI 2.0 configuration file
2-
#
3-
# Check https://circleci.com/docs/2.0/language-python/ for more details
4-
#
51
version: 2.1
62
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+
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

61154
workflows:
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

.github/workflows/publish-pypi.yml

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,43 @@
11
name: Publish Pypi
22
on:
33
release:
4-
types: [published]
4+
types: [ published ]
55

66
jobs:
7-
publish:
8-
name: publish
7+
pytest:
8+
name: Publish to PyPi
99
runs-on: ubuntu-latest
10+
env:
11+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
1012
steps:
1113
- uses: actions/checkout@master
12-
- name: Set up Python 2.7
14+
- name: Set up Python 3.7
1315
uses: actions/setup-python@v1
1416
with:
15-
python-version: 2.7
17+
python-version: 3.7
1618

17-
- name: Install twine
18-
run: |
19-
pip install twine
20-
21-
- name: Install wheel
22-
run: |
23-
pip install wheel
24-
25-
- name: Create a source distribution
26-
run: |
27-
python setup.py sdist
19+
- name: Install Poetry
20+
uses: dschep/install-poetry-action@v1.3
2821

29-
- name: Create a wheel
30-
run: |
31-
python setup.py bdist_wheel
22+
- name: Cache Poetry virtualenv
23+
uses: actions/cache@v1
24+
id: cache
25+
with:
26+
path: ~/.virtualenvs
27+
key: poetry-${{ hashFiles('**/poetry.lock') }}
28+
restore-keys: |
29+
poetry-${{ hashFiles('**/poetry.lock') }}
3230
33-
- name: Create a .pypirc
31+
- name: Set Poetry config
3432
run: |
35-
echo -e "[pypi]" >> ~/.pypirc
36-
echo -e "username = __token__" >> ~/.pypirc
37-
echo -e "password = ${{ secrets.PYPI_TOKEN }}" >> ~/.pypirc
38-
echo -e "[testpypi]" >> ~/.pypirc
39-
echo -e "username = __token__" >> ~/.pypirc
40-
echo -e "password = ${{ secrets.TESTPYPI_TOKEN }}" >> ~/.pypirc
33+
poetry config virtualenvs.in-project false
34+
poetry config virtualenvs.path ~/.virtualenvs
4135
42-
- name: Publish to Test PyPI
43-
if: github.event_name == 'release'
44-
run: |
45-
twine upload --skip-existing -r testpypi dist/*
36+
- name: Install Dependencies
37+
run: poetry install
38+
if: steps.cache.outputs.cache-hit != 'true'
4639

4740
- name: Publish to PyPI
4841
if: github.event_name == 'release'
4942
run: |
50-
twine upload -r pypi dist/*
43+
poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }} --build

.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/profiles_settings.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/redisgraph-py.iml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)