python-package.yml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
  2. # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
  3. name: Python package
  4. on: [push, pull_request]
  5. jobs:
  6. build:
  7. runs-on: ubuntu-latest
  8. strategy:
  9. matrix:
  10. python-version: ['3.5', '3.6', '3.7', '3.8']
  11. steps:
  12. - uses: actions/checkout@v2
  13. - name: Set up Python ${{ matrix.python-version }}
  14. uses: actions/setup-python@v2
  15. with:
  16. python-version: ${{ matrix.python-version }}
  17. - name: Install dependencies
  18. run: |
  19. python -m pip install --upgrade pip
  20. python -m pip install flake8 pytest
  21. if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
  22. - name: Lint with flake8
  23. run: |
  24. # stop the build if there are Python syntax errors or undefined names
  25. flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
  26. # exit-zero treats all errors as warnings
  27. flake8 . --count --exit-zero --max-complexity=10 --max-line-length=79 --statistics
  28. - name: Test with pytest
  29. run: |
  30. pytest