grappa-py/grappa

View on GitHub
.github/workflows/python-package.yml

Summary

Maintainability
Test Coverage
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python CI

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, pypy3]
        experimental: [false]
        include:
          - os: ubuntu-latest
            python-version: pypy2
            experimental: false
          - os: ubuntu-latest
            python-version: 3.10-dev
            experimental: true

    runs-on: ${{ matrix.os }}
    continue-on-error: ${{ matrix.experimental }}
    name: Python ${{ matrix.python-version }} on ${{ matrix.os }}

    steps:
    - uses: actions/checkout@v2

    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v2
      if: "!endsWith(matrix.python-version, '-dev')"
      with:
        python-version: ${{ matrix.python-version }}

    - name: Set up Python ${{ matrix.python-version }}
      uses: deadsnakes/action@v2.0.0
      if: endsWith(matrix.python-version, '-dev')
      with:
        python-version: ${{ matrix.python-version }}
      env:
        ACTIONS_ALLOW_UNSECURE_COMMANDS: true
  
    - name: Install dependencies
      run: |
        pip install -r requirements-dev.txt
        pip install -r requirements.txt

    - name: Lint with flake8
      run: |
        # stop the build if there are Python syntax errors or undefined names
        flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
        # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
        flake8 . --count --max-complexity=10 --statistics

    - name: Test with pytest
      run: |
        pytest -s -v --tb=native --capture=sys --cov grappa --cov-report term-missing tests

    - name: Coverage
      run: |
        coverage run --source grappa -m py.test
        coverage report