From a97028ae1e0fcc9b886cc51522cfcb817ae5e362 Mon Sep 17 00:00:00 2001 From: "Netzulo.com" Date: Sun, 10 Jun 2018 18:39:48 +0200 Subject: [PATCH] [qacode] add ci, codeclimate, #164 (#165) * [qacode] add ci, codeclimate, #164 * [qacode] fix parse error * [qacode] missing activate env before install * [qacode] activate env at after_test step * [qacode] try to missing not found report file * [qacode] CI codeclimate, more path changes trying to fix this ... * [qacode] another try * [qacode] fix ci imcopatible versions - error here: https://circleci.com/gh/netzulo/qacode/15 * [qacode] missing package... manual install * [qacode] loving codeclimate * [qacode] finixshing ci codeclimate+circleci --- .circleci/config.yml | 36 ++++++-- .gitignore | 8 +- README.rst | 10 +-- pytest.ini | 10 +-- setup.py | 3 +- tests/reports/assets/style.css | 157 --------------------------------- tox.ini | 8 +- 7 files changed, 51 insertions(+), 181 deletions(-) delete mode 100644 tests/reports/assets/style.css diff --git a/.circleci/config.yml b/.circleci/config.yml index de50a54a..7ed8f743 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,6 +2,8 @@ version: 2 jobs: build: + environment: + CC_TEST_REPORTER_ID: 181a274c2c68483ff80af63a8a87e1f5fab71f37744eab702f25695501b5ca85 docker: - image: circleci/python:3.6.1 @@ -9,22 +11,44 @@ jobs: steps: - checkout - - run: - name: install dependencies + name: Install dependencies command: | + # CI, CircleCI dependencies python3 -m venv venv . venv/bin/activate - python setup.py install + # CI, codeclimate dependencies + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + chmod +x ./cc-test-reporter + pip install codeclimate-test-reporter + # project dependencies pip install tox + pip install coverage==4.2 + + - run: + name: Install project + command: | + . venv/bin/activate + python setup.py install + + - run: + name: Before Tests + command: | + ./cc-test-reporter before-build + + - run: + name: Run Tests + command: | + . venv/bin/activate + tox -e coverage,flake8,docs - run: - name: run tests + name: After Tests command: | . venv/bin/activate - tox -e py36,flake8,docs + ls -ltra tests/reports/ + codeclimate-test-reporter --token $CC_TEST_REPORTER_ID --file .coverage - store_artifacts: path: dist destination: dist - \ No newline at end of file diff --git a/.gitignore b/.gitignore index 39baf309..f150a40f 100755 --- a/.gitignore +++ b/.gitignore @@ -103,11 +103,9 @@ ENV/ # QACODE ignores qacode/configs/settings.json -tests/reports/report_xunit.xml -tests/reports/report_html.html -tests/reports/report_coverage.xml -tests/reports/report_coverage_html/* -tests/reports/report_benchmark/benchmarks.*.svg +tests/reports/* +tests/reports/coverage/* +tests/reports/benchmarks/benchmark.*.svg # Visual Studio .vs/ # Visual code diff --git a/README.rst b/README.rst index 4f254617..2601f869 100755 --- a/README.rst +++ b/README.rst @@ -17,11 +17,11 @@ QA Code :alt: Release date on Github :target: https://github.com/netzulo/qacode/releases/latest -+-----------------------+-------------------------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------+ -| Branch | Linux Deploy | Windows Deploy | CircleCI - Docker | -+=======================+===================================================================+================================================================================================+===========================================================================================================================+ -| master | .. image:: https://travis-ci.org/netzulo/qacode.svg?branch=master | .. image:: https://ci.appveyor.com/api/projects/status/4a0tc5pis1bykt9x/branch/master?svg=true | .. image:: https://circleci.com/gh/netzulo/qacode.svg?&style=shield&circle-token=80384cb2233d112dc0785278d5b7c3d8c6a5686c | -+-----------------------+-----------------------+-------------------------------------------+------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------+ ++-----------------------+-------------------------------------------------------------------+------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ +| Branch | Linux Deploy | Windows Deploy | CircleCI - Docker | CodeClimate | ++=======================+===================================================================+================================================================================================+===========================================================================================================================+========================================================================================+ +| master | .. image:: https://travis-ci.org/netzulo/qacode.svg?branch=master | .. image:: https://ci.appveyor.com/api/projects/status/4a0tc5pis1bykt9x/branch/master?svg=true | .. image:: https://circleci.com/gh/netzulo/qacode.svg?&style=shield&circle-token=80384cb2233d112dc0785278d5b7c3d8c6a5686c | .. image:: https://api.codeclimate.com/v1/badges/46279cf9a6a47ed583d6/maintainability | ++-----------------------+-----------------------+-------------------------------------------+------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------+ Python tested versions diff --git a/pytest.ini b/pytest.ini index 09b21448..277be6ac 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,13 +1,13 @@ [pytest] addopts = --verbose - --junit-xml=tests/reports/report_xunit.xml - --html=tests/reports/report_html.html + --junit-xml=tests/reports/test_coverage.xml + --html=tests/reports/test_coverage.html --self-contained-html --cov=qacode tests/ - --cov-report html:tests/reports/report_coverage_html/ - --cov-report xml:tests/reports/report_coverage.xml - --benchmark-histogram=tests/reports/report_benchmark/benchmarks.svg + --cov-report html:tests/reports/coverage/ + --cov-report xml:tests/reports/coverage.xml + --benchmark-histogram=tests/reports/benchmarks/benchmark.svg testpaths = tests console_output_style = progress python_files = suite_*_*.py diff --git a/setup.py b/setup.py index fa4d9802..38eae637 100755 --- a/setup.py +++ b/setup.py @@ -126,7 +126,8 @@ def read(file_name=None, is_encoding=True, ignore_raises=False): tests_require=[ 'pytest-html', 'pytest-dependency', - 'pytest-cov', + 'coverage==4.3.4', + 'pytest-cov==2.5.0', 'pytest-benchmark', 'pytest-benchmark[histogram]' ], diff --git a/tests/reports/assets/style.css b/tests/reports/assets/style.css deleted file mode 100644 index c6ab21c6..00000000 --- a/tests/reports/assets/style.css +++ /dev/null @@ -1,157 +0,0 @@ -body { - font-family: Helvetica, Arial, sans-serif; - font-size: 12px; - min-width: 1200px; - color: #999; -} -h2 { - font-size: 16px; - color: black; -} - -p { - color: black; -} - -a { - color: #999; -} - -table { - border-collapse: collapse; -} - -/****************************** - * SUMMARY INFORMATION - ******************************/ - -#environment td { - padding: 5px; - border: 1px solid #E6E6E6; -} - -#environment tr:nth-child(odd) { - background-color: #f6f6f6; -} - -/****************************** - * TEST RESULT COLORS - ******************************/ -span.passed, .passed .col-result { - color: green; -} -span.skipped, span.xfailed, span.rerun, .skipped .col-result, .xfailed .col-result, .rerun .col-result { - color: orange; -} -span.error, span.failed, span.xpassed, .error .col-result, .failed .col-result, .xpassed .col-result { - color: red; -} - - -/****************************** - * RESULTS TABLE - * - * 1. Table Layout - * 2. Extra - * 3. Sorting items - * - ******************************/ - -/*------------------ - * 1. Table Layout - *------------------*/ - -#results-table { - border: 1px solid #e6e6e6; - color: #999; - font-size: 12px; - width: 100% -} - -#results-table th, #results-table td { - padding: 5px; - border: 1px solid #E6E6E6; - text-align: left -} -#results-table th { - font-weight: bold -} - -/*------------------ - * 2. Extra - *------------------*/ - -.log:only-child { - height: inherit -} -.log { - background-color: #e6e6e6; - border: 1px solid #e6e6e6; - color: black; - display: block; - font-family: "Courier New", Courier, monospace; - height: 230px; - overflow-y: scroll; - padding: 5px; - white-space: pre-wrap -} -div.image { - border: 1px solid #e6e6e6; - float: right; - height: 240px; - margin-left: 5px; - overflow: hidden; - width: 320px -} -div.image img { - width: 320px -} -.collapsed { - display: none; -} -.expander::after { - content: " (show details)"; - color: #BBB; - font-style: italic; - cursor: pointer; -} -.collapser::after { - content: " (hide details)"; - color: #BBB; - font-style: italic; - cursor: pointer; -} - -/*------------------ - * 3. Sorting items - *------------------*/ -.sortable { - cursor: pointer; -} - -.sort-icon { - font-size: 0px; - float: left; - margin-right: 5px; - margin-top: 5px; - /*triangle*/ - width: 0; - height: 0; - border-left: 8px solid transparent; - border-right: 8px solid transparent; -} - -.inactive .sort-icon { - /*finish triangle*/ - border-top: 8px solid #E6E6E6; -} - -.asc.active .sort-icon { - /*finish triangle*/ - border-bottom: 8px solid #999; -} - -.desc.active .sort-icon { - /*finish triangle*/ - border-top: 8px solid #999; -} diff --git a/tox.ini b/tox.ini index a403f1da..163f8a57 100644 --- a/tox.ini +++ b/tox.ini @@ -39,12 +39,16 @@ exclude = [testenv:coverage] description = Environment to generate coverage reports commands = - pytest --self-contained-html --cov=qacode tests/ --cov-report html:tests/reports/report_coverage_html/ --cov-report xml:tests/reports/report_coverage.xml + py.test --self-contained-html --cov=qacode tests/ --cov-report html:tests/reports/coverage/ --cov-report xml:tests/reports/coverage.xml deps = pytest - pytest-cov pytest-html + pytest-dependency + coverage==4.3.4 + pytest-cov==2.5.0 pytest-benchmark + pytest-benchmark[histogram] + exclude = .git, __pycache__,