Skip to content

Documentation #1

Description

@vhirtham

GitHub Actions (CI)

Informations

Badge

  • See badge section of thislink
  • One possibility: https://github.com/<OWNER>/<REPOSITORY>/workflows/<WORKFLOW_NAME>/badge.svg
  • White spaces in the <WORKFLOW_NAME> must be replaced by %20

Installation

  • Add a .github/workflows directory to the projects root directory
  • Create a .yml for each individual workflow
  • Edit the .yml. Example:
name: CI Windows
on: [push]

jobs:
  test:
    name: CI Build
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [windows-latest]
    steps:
    - uses: actions/checkout@v1
    - name: Add conda directories to PATH
      run: |
        echo ::add-path::C:\Miniconda
        echo ::add-path::C:\Miniconda\Scripts
    - name: Print conda info
      run: conda info -a
    - name: Create conda environment
      run: conda create -yy -q -n test-environment python=3.7 pytest
    - name: Init bash
      run: conda init powershell
    - name: Run tests
      run: |
        conda activate test-environment
        pytest

Travis CI

Informations

Badge

  • Go to the Projects Travis site and click on the badge
  • Copy the link and add it to the README.md

Installation

  • Activate Travis CI via GitHub and Travis homepages (Travis homepage)
  • Create .travis.yml in the project root directory
  • Modify the .travis.yml as needed. Example:
language: python
python:
  - "3.7"      # current default Python on Travis CI

install:
  - sudo apt-get update
  # We do this conditionally because it saves us some downloading if the
  # version is the same.
  - if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
      wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh;
    else
      wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
    fi
  - bash miniconda.sh -b -p $HOME/miniconda
  - source "$HOME/miniconda/etc/profile.d/conda.sh"
  - hash -r
  - conda config --set always_yes yes --set changeps1 no
  - conda update -q conda
  - conda info -a

  - conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION pytest pytest-cov codecov
  - conda activate test-environment

script:
  - pytest --cov-report term --cov=MyPackages

after_success:
  - codecov

Appveyor CI

Informations

Badge

  • Go to the Projects Appveyor site
  • Go to the settings menu
  • Click on the Badges tab
  • Copy the link and add it to the README.md

Installation

  • Activate Appveyor CI via GitHub and appvayor homepages (Travis homepage)
  • Create .appveyor.yml in the project root directory
  • Modify the .appveyor.yml as needed. Example:
environment:
  matrix:
    - PYTHON_VERSION: 3.6
      MINICONDA: "C:\\Miniconda36"



install:
  - "set path=%path%;%MINICONDA%;%MINICONDA%\\Scripts;"
  - conda config --set always_yes yes --set changeps1 no
  - conda info -a
  - "conda create -q -n test-environment python=%PYTHON_VERSION% pytest"
  - activate test-environment

build: false

test_script:
  - pytest

Coverage / Codecov

Informations

  • Codecov documentation
  • Codecov is a web-service to check how many lines of code are tested in your project
  • Coverage reports must be generated and uploaded manually or by a CI service (the common approach)
  • pytest-cov documentation

Badge

  • Go to the Projects Codecov site
  • Go to the settings menu
  • Click on the Badges tab
  • Copy the link and add it to the README.md

Installation

  • Activate codecov via GitHub and codecov homepages (Codecov homepage)
  • Add to .travis.yml:
install:
  - conda install pytest-cov
  - conda install codecov

script:
  - pytest --cov-report term --cov=$directory$

after_success:
  - codecov
  • To configure when a coverage report should be considered as a failure (on GitHub) and which files should be ignored, add a .codecov.yml to the project root directory
  • Modify .appveyor.yml as needed. Example:
codecov:
    branch: master
    notify:
        require_ci_to_pass: yes

coverage:
    precision: 2
    round: down
    range: "70...100"

    status:
        project:
            default:
                enabled: yes
                target: 85%
                threshold: 5%


        patch:
            default:
                enabled: yes
                target: 85%

ignore:
    - "tests"
    - "*__init__.py"

Typo CI

Information

  • A tool to check for typos in the code of pull requests
  • Leaves a comment in the pull request
  • Documentation

Installation

  • Activate App on GitHub
  • Optionally add .typo-ci.yml and configure it (see documentation)

Pep8Speaks

Information

  • Checks pull request for coding style violations
  • Uses pycodestyle or flake8 as linter
  • Leaves a comment in the pull request if an error is found
  • Documentation
  • Write a comment with @pep8speaks suggest diff to get a gist with suggested fixes
  • Write a comment with @pep8speaks pep8ify to get an automatically generated pull request against the current branch that fixes most of the PEP8 errors

Installation

  • Activate the App on GitHub
  • Optionally add a .pep8speaks.yml and configure it
  • Optionally add an entry for pycodestyle or flake8 in setup.cfg to configure them

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions