Cloud ci: travis-ci and drone.io


    It is always nice to have statistics about the state of the technical part (code) of the project, this is what coviolations.io deals with . But to use it, you need some kind of ci-solution. Not everyone will want to raise jenkins / travis / etc on their server, but it will be easier to resort to using cloud services. We will look at the two most popular: travis-ci and drone.io .

    As a “victim” we will use the usual django project - the coviolations themselves . For projects on ror / nodejs / flask / etc, everything will be almost the same. As a result, we get a bunch of statistics and graphs .

    Training


    We want to test PEP8, package freshness, tests and coverage. To do this, create in the root of the project .covio.yml:
    violations:
      pep8: pep8 . --exclude='*migrations*,*settings*,*components*,*docs*'
      sloccount: sloccount .
      py_unittest:
        command: coverage run manage.py test violations projects tasks services coviolations_web push
        stderr: true
      coverage: coverage report
      pip_review:
        command: pip-review
        nofail: true
    

    All checks will be run automatically when called covio.

    travis-ci


    The task is described in .travis.yml; there is good documentation on its contents . For our project, it will contain:
    language: python
    python:
      - "2.7"
    services:
      - mongodb
      - redis-server
    before_install:
      - sudo apt-get update -qq
      - sudo apt-get install -qq sloccount
    install:
      - pip install -r requirements/ci.txt
      - cp coviolations_web/settings/local_ci.py coviolations_web/settings/local.py
      - ./manage.py syncdb
      - ./manage.py migrate
    script:
      - covio
    

    For open projects, the service is provided free of charge, for closed - 129 $ + per month .
    Of the goodies, the service provides:
    • dice with the status: ;
    • work with pull requests;
    • affixing status is broken / works for commits;
    • rest api for third-party services (thanks to this, you do not need to manually transfer COVIO_TOKEN).

    drone.io


    In drone.io, the task must be described on the project page in the service itself. For coviolations, you will need to check the boxes opposite the MongoDB and Redis databases, register the token in Environment Variables:
    COVIO_TOKEN='17c0f6b3-habr-4d9c-not3-token5af9fe'
    

    And in the section, Commandsdescribe the task as a simple script:
    sudo apt-get update -qq
    sudo apt-get install -qq sloccount
    pip install -r requirements/ci.txt
    cp coviolations_web/settings/local_ci.py coviolations_web/settings/local.py
    ./manage.py syncdb
    ./manage.py migrate
    covio
    

    For open projects, the service is free, for closed - $ 25 + per month .
    Of the additional amenities, the service provides:
    • die with the status: ;
    • the ability to deploy in Heroku, AppEngine, dotColud and on your server via ssh if successful;
    • artifact preservation.

    Result

    travis-cidrone-io
    Support for pull requestsYesNot
    Deployment OpportunityNotYes
    Statusing commitsYesNot
    Saving ArtifactsNotYes
    Api for third-party servicesYesNot
    Price129 $ + per month25 $ + per month

    Also popular now: