python.yml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
  2. # shown in badge
  3. # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/configuring-a-workflow#adding-a-workflow-status-badge-to-your-repository
  4. name: tests
  5. on:
  6. push:
  7. pull_request:
  8. schedule:
  9. - cron: '0 20 * * 5'
  10. jobs:
  11. code-format:
  12. runs-on: ubuntu-20.04
  13. steps:
  14. - uses: actions/checkout@v2.3.4
  15. - uses: actions/setup-python@v2.2.2
  16. with:
  17. python-version: '3.9'
  18. - run: pip install --upgrade pipenv==2020.8.13
  19. - run: pipenv install --python "$PYTHON_VERSION" --deploy --dev
  20. env:
  21. PYTHON_VERSION: ${{ matrix.python-version }}
  22. - run: pipenv graph
  23. - run: pipenv run black --check .
  24. tests:
  25. runs-on: ubuntu-20.04
  26. strategy:
  27. matrix:
  28. python-version:
  29. - '3.6'
  30. - '3.7'
  31. - '3.8'
  32. - '3.9'
  33. fail-fast: false
  34. steps:
  35. - uses: actions/checkout@v2.3.4
  36. - uses: actions/setup-python@v2.2.2
  37. with:
  38. python-version: ${{ matrix.python-version }}
  39. - run: pip install --upgrade pipenv==2020.8.13
  40. # by default pipenv picks the latest version in PATH
  41. - run: pipenv --python "$(which python)" install --deploy --dev
  42. - run: pipenv graph
  43. - run: pipenv run pytest --cov="$(cat *.egg-info/top_level.txt)" --cov-report=term-missing --cov-fail-under=100
  44. - run: pipenv run pylint --load-plugins=pylint_import_requirements "$(cat *.egg-info/top_level.txt)"
  45. # https://github.com/PyCQA/pylint/issues/352
  46. # disable parse-error due to:
  47. # > tests/resources/__init__.py:1:0: F0010: error while code parsing: Unable to load file tests/resources/__init__.py:
  48. # > [Errno 2] No such file or directory: 'tests/resources/__init__.py' (parse-error)
  49. - run: pipenv run pylint --disable=parse-error tests/*
  50. - run: pipenv run mypy "$(cat *.egg-info/top_level.txt)" tests
  51. # >=2.1.0 to support GITHUB_TOKEN
  52. # COVERALLS_REPO_TOKEN required manual configuration of secret
  53. # https://github.com/TheKevJames/coveralls-python/commit/f597109b62fadaf900af79d4f08a7debee5229e2
  54. - run: pip install 'coveralls>=2.1.0,<4'
  55. - run: coveralls
  56. env:
  57. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  58. # https://github.com/TheKevJames/coveralls-python/issues/240#issuecomment-758336355
  59. COVERALLS_SERVICE_NAME: github