Skip to content

Commit d8ee31b

Browse files
authored
Switch circle CI to tox (#115)
It makes sense to use the same technologies locally and in CI as it simplifies local debugging and verifing changes Before this patch we did run sdist (bulding package) and functional tests in CI and we were uploading coverage report to covecod After this PR we are adding code style jobs, unittests with coverage as well as keeping old jobs in place (but run through tox) As well now we have 2 reports to upload one for functional tests one for unittests
1 parent 2bd540a commit d8ee31b

File tree

3 files changed

+26
-32
lines changed

3 files changed

+26
-32
lines changed

.circleci/config.yml

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ commands:
1717
circleci step halt
1818
fi
1919
jobs:
20-
build:
20+
test:
2121
docker:
2222
- image: circleci/python:3.6.1
2323

@@ -28,53 +28,41 @@ jobs:
2828
steps:
2929
- checkout
3030

31-
# Download and cache dependencies
32-
- restore_cache:
33-
keys:
34-
- v1-dependencies-{{ checksum "requirements.txt" }}
35-
# fallback to using the latest cache if no exact match is found
36-
- v1-dependencies-
31+
- run:
32+
name: Install tox
33+
command: pip install tox
3734

3835
- run:
39-
name: install dependencies
40-
command: |
41-
python -m venv venv
42-
. venv/bin/activate
43-
pip install -r requirements.txt
44-
pip install codecov
36+
name: Test package build
37+
command: tox -e sdist
4538

46-
- save_cache:
47-
paths:
48-
- ./venv
49-
key: v1-dependencies-{{ checksum "requirements.txt" }}
39+
- run:
40+
name: Run code styles
41+
command: tox -e pep8
5042

5143
- run:
52-
name: test dist
53-
command: python setup.py sdist
44+
name: Run unittest with coverage
45+
command: tox -e cover
5446

5547
- run:
56-
name: run tests
57-
command: |
58-
. venv/bin/activate
59-
coverage run tests/functional/test_all.py
48+
name: Run functional tests
49+
command: tox -e func
6050

6151
- early_return_for_forked_pull_requests
6252

6353
- run:
6454
name: codecove
6555
command: |
66-
. venv/bin/activate
67-
codecov
56+
. .tox/func/bin/activate
57+
codecov --file .tox/cover/report/coverage.xml --name ${CODECOV_NAME}-unittests
58+
codecov --file .tox/func/report/coverage.xml --name ${CODECOV_NAME}-functional
6859
69-
# - store_artifacts:
70-
# path: test-reports
71-
# destination: test-reports
7260
7361
workflows:
7462
version: 2
7563
commit:
7664
jobs:
77-
- build
65+
- test
7866
nightly:
7967
triggers:
8068
- schedule:
@@ -84,4 +72,4 @@ workflows:
8472
only:
8573
- master
8674
jobs:
87-
- build
75+
- test

test-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ pytest-html
66

77
testtools>=1.4.0
88
mock
9+
10+
codecov

tox.ini

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,18 @@ basepython = python3.7
3232
basepython = python3.8
3333

3434
[testenv:cover]
35-
commands = py.test --cov=redisgraph tests/unit/ --cov-report=html:{envdir}/report/
35+
commands = py.test --cov=redisgraph tests/unit/ --cov-report=xml:{envdir}/report/coverage.xml --cov-report=html:{envdir}/report/html
3636

3737
[testenv:func]
38-
commands = py.test --cov=redisgraph tests/functional/ --cov-report=html:{envdir}/report/
38+
commands = py.test --cov=redisgraph tests/functional/ --cov-report=xml:{envdir}/report/coverage.xml --cov-report=html:{envdir}/report/html
3939

4040
[testenv:venv]
4141
commands = {posargs}
4242

43+
[testenv:sdist]
44+
deps =
45+
commands = python setup.py sdist
46+
4347
[flake8]
4448
show-source = true
4549
# TODO(boris-42): Enable E226 and E501 rules

0 commit comments

Comments
 (0)