Skip to content

Commit

Permalink
Merge pull request #1797 from mopidy/feature/circleci
Browse files Browse the repository at this point in the history
CircleCI and Codecov
  • Loading branch information
jodal committed Sep 9, 2019
2 parents 40d52db + 15c6dc8 commit f91c573
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 70 deletions.
53 changes: 53 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
version: 2.1

orbs:
codecov: codecov/codecov@1.0.5

workflows:
version: 2
test:
jobs:
- py27
#- py37
#- black
#- check-manifest
- docs
- flake8

jobs:
py37: &test-template
docker:
- image: mopidy/ci-python:3.7
steps:
- checkout
- restore_cache:
name: Restoring tox cache
keys:
- tox-v1-{{ .Environment.CIRCLE_JOB }}-{{ .BuildNum }}
- tox-v1-{{ .Environment.CIRCLE_JOB }}
- run:
name: Run tests
command: |
tox -e $CIRCLE_JOB -- \
--junit-xml=test-results/pytest/results.xml \
--cov-report=xml
- save_cache:
name: Saving tox cache
key: tox-v1-{{ .Environment.CIRCLE_JOB }}-{{ .BuildNum }}
paths:
- ./.tox
- ~/.cache/pip
- codecov/upload:
file: coverage.xml
- store_test_results:
path: test-results

py27: *test-template

black: *test-template

check-manifest: *test-template

docs: *test-template

flake8: *test-template
40 changes: 0 additions & 40 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ include *.py
include *.rst
include *.txt
include .mailmap
include .travis.yml
include AUTHORS
include LICENSE
include MANIFEST.in
include tox.ini

recursive-include .circleci *
recursive-include .github *

recursive-include docs *
Expand Down
14 changes: 9 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@ To get started with Mopidy, check out
:target: https://pypi.python.org/pypi/Mopidy/
:alt: Latest PyPI version

.. image:: https://img.shields.io/travis/mopidy/mopidy/develop.svg?style=flat
:target: https://travis-ci.org/mopidy/mopidy
:alt: Travis CI build status
.. image:: https://img.shields.io/circleci/project/github/mopidy/mopidy/develop.svg
:target: https://circleci.com/gh/mopidy/mopidy
:alt: CircleCI build status

.. image:: https://img.shields.io/coveralls/mopidy/mopidy/develop.svg?style=flat
:target: https://coveralls.io/r/mopidy/mopidy?branch=develop
.. image:: https://img.shields.io/readthedocs/mopidy.svg
:target: https://docs.mopidy.com/
:alt: Read the Docs build status

.. image:: https://img.shields.io/codecov/c/github/mopidy/mopidy/develop.svg
:target: https://codecov.io/gh/mopidy/mopidy
:alt: Test coverage
2 changes: 1 addition & 1 deletion docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Pull request guidelines
``docs/add-ext-mopidy-spotify-tunigo``.

#. Follow the :ref:`code style <codestyle>`, especially make sure the
``flake8`` linter does not complain about anything. Travis CI will check
``flake8`` linter does not complain about anything. CircleCI will check
that your pull request is "flake8 clean". See :ref:`code-linting`.

#. Include tests for any new feature or substantial bug fix. See
Expand Down
29 changes: 14 additions & 15 deletions docs/devenv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,10 @@ You need to know at least one command; the one that runs all the tests::

tox

This will run exactly the same tests as `Travis CI
<https://travis-ci.org/mopidy/mopidy>`_ runs for all our branches and pull
This will run exactly the same tests as `CircleCI
<https://circleci.com/gh/mopidy/mopidy>`_ runs for all our branches and pull
requests. If this command turns green, you can be quite confident that your
pull request will get the green flag from Travis as well, which is a
pull request will get the green flag from CircleCI as well, which is a
requirement for it to be merged.

As this is the ultimate test command, it's also the one taking the most time to
Expand Down Expand Up @@ -300,7 +300,7 @@ the given module, ``mopidy`` in this example, are covered by the test suite::
.. note::

Up to date test coverage statistics can also be viewed online at
`coveralls.io <https://coveralls.io/github/mopidy/mopidy>`_.
`Codecov <https://codecov.io/gh/mopidy/mopidy>`_.

If we want to speed up the test suite, we can even get a list of the ten
slowest tests::
Expand All @@ -314,16 +314,16 @@ development can be very useful.
Continuous integration
----------------------

Mopidy uses the free service `Travis CI <https://travis-ci.org/mopidy/mopidy>`_
Mopidy uses the free service `CircleCI`_
for automatically running the test suite when code is pushed to GitHub. This
works both for the main Mopidy repo, but also for any forks. This way, any
contributions to Mopidy through GitHub will automatically be tested by Travis
CI, and the build status will be visible in the GitHub pull request interface,
contributions to Mopidy through GitHub will automatically be tested by CircleCI,
and the build status will be visible in the GitHub pull request interface,
making it easier to evaluate the quality of pull requests.

For each successful build, Travis submits code coverage data to `coveralls.io
<https://coveralls.io/github/mopidy/mopidy>`_. If you're out of work, coveralls might
help you find areas in the code which could need better test coverage.
For each successful build, CircleCI submits code coverage data to `Codecov`_.
If you're out of work, Codecov might help you find areas in the code which
could need better test coverage.


.. _code-linting:
Expand All @@ -338,7 +338,7 @@ Luckily, you can get very far by using the `flake8
<http://flake8.readthedocs.io/>`_ linter to check your code for issues before
submitting a pull request. Mopidy passes all of flake8's checks, with only a
very few exceptions configured in :file:`setup.cfg`. You can either run the
``flake8`` tox environment, like Travis CI will do on your pull request::
``flake8`` tox environment, like CircleCI will do on your pull request::

tox -e flake8

Expand Down Expand Up @@ -559,11 +559,10 @@ https://github.com/mopidy/mopidy, and `create a pull request
Updating a pull request
-----------------------

When the pull request is created, `Travis CI
<https://travis-ci.org/mopidy/mopidy>`__ will run all tests on it. If something
When the pull request is created, `CircleCI`_ will run all tests on it. If something
fails, you'll get notified by email. You might as well just fix the issues
right away, as we won't merge a pull request without a green Travis build. See
:ref:`running-tests` on how to run the same tests locally as Travis CI runs on
right away, as we won't merge a pull request without a green CircleCI build. See
:ref:`running-tests` on how to run the same tests locally as CircleCI runs on
your pull request.

When you've fixed the issues, you can update the pull request simply by pushing
Expand Down
4 changes: 1 addition & 3 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
Sphinx >= 1.0, != 1.8.0
Sphinx >= 1.3, != 1.8.0
pygraphviz
Pykka >= 1.1
# Require newer requests than what Travis/Debian has to work around linkcheck crash
requests > 2.4.3
sphinx_rtd_theme
13 changes: 8 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,33 @@ envlist = py27, docs, flake8

[testenv]
sitepackages = true
commands =
pytest \
--basetemp={envtmpdir} \
--cov=mopidy --cov-report=term-missing \
{posargs}
deps =
mock
pytest
pytest-cov
responses
commands =
pytest \
--basetemp={envtmpdir} \
--cov=mopidy --cov-report=term-missing \
{posargs}

[testenv:docs]
basepython = python2.7
deps = -r{toxinidir}/docs/requirements.txt
changedir = docs
commands = python -m sphinx -b html -d {envtmpdir}/doctrees . {envtmpdir}/html

[testenv:flake8]
basepython = python2.7
deps =
flake8
flake8-import-order
pep8-naming
commands = flake8 --show-source --statistics mopidy tests

[testenv:linkcheck]
basepython = python2.7
deps = -r{toxinidir}/docs/requirements.txt
changedir = docs
commands = python -m sphinx -b linkcheck -d {envtmpdir}/doctrees . {envtmpdir}/html

0 comments on commit f91c573

Please sign in to comment.