python-app.yml 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # This workflow will install Python dependencies, run tests and lint with a single version of Python
  2. # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
  3. name: Python application
  4. on:
  5. push:
  6. branches: [ "main" ]
  7. pull_request:
  8. branches: [ "main" ]
  9. permissions:
  10. contents: read
  11. jobs:
  12. build:
  13. runs-on: ubuntu-latest
  14. steps:
  15. - uses: actions/checkout@v3
  16. - name: Set up Python 3.10
  17. uses: actions/setup-python@v3
  18. with:
  19. python-version: "3.10"
  20. - name: Install dependencies
  21. run: |
  22. python -m pip install --upgrade pip
  23. pip install flake8 pytest
  24. if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
  25. - name: Lint with flake8
  26. run: |
  27. # stop the build if there are Python syntax errors or undefined names
  28. flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
  29. # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
  30. flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
  31. - name: Test with pytest
  32. run: |
  33. pytest