python.yml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. strategy:
  14. matrix:
  15. python-verison: ['3.9']
  16. steps:
  17. - uses: actions/checkout@v2.4.0
  18. - uses: actions/setup-python@v2.3.1
  19. with:
  20. python-version: ${{ matrix.python-version }}
  21. # did not reduce runtime of `pipenv install` (still approx. 1 min)
  22. #cache: pipenv
  23. - run: pip install --upgrade pipenv==2020.8.13
  24. - run: pipenv install --python "$PYTHON_VERSION" --deploy --dev
  25. env:
  26. PYTHON_VERSION: ${{ matrix.python-version }}
  27. - run: pipenv graph
  28. - run: pipenv run black --check .
  29. tests:
  30. runs-on: ubuntu-20.04
  31. strategy:
  32. matrix:
  33. python-version:
  34. - '3.6'
  35. - '3.7'
  36. - '3.8'
  37. - '3.9'
  38. - '3.10'
  39. fail-fast: false
  40. steps:
  41. - uses: actions/checkout@v2.4.0
  42. - uses: actions/setup-python@v2.3.1
  43. with:
  44. python-version: ${{ matrix.python-version }}
  45. # did not reduce runtime of `pipenv install` (still approx. 1 min)
  46. #cache: pipenv
  47. - run: pip install --upgrade pipenv==2020.8.13
  48. # by default pipenv picks the latest version in PATH
  49. - run: pipenv install --python "$PYTHON_VERSION" --deploy --dev
  50. env:
  51. PYTHON_VERSION: ${{ matrix.python-version }}
  52. - run: pipenv graph
  53. - run: pipenv run pytest --cov="$(cat *.egg-info/top_level.txt)" --cov-report=term-missing --cov-fail-under=100
  54. - run: pipenv run pylint --load-plugins=pylint_import_requirements "$(cat *.egg-info/top_level.txt)"
  55. # https://github.com/PyCQA/pylint/issues/352
  56. # disable parse-error due to:
  57. # > tests/resources/__init__.py:1:0: F0010: error while code parsing: Unable to load file tests/resources/__init__.py:
  58. # > [Errno 2] No such file or directory: 'tests/resources/__init__.py' (parse-error)
  59. - run: pipenv run pylint --disable=parse-error tests/*
  60. - run: pipenv run mypy --strict "$(cat *.egg-info/top_level.txt)" tests
  61. # >=2.1.0 to support GITHUB_TOKEN
  62. # COVERALLS_REPO_TOKEN required manual configuration of secret
  63. # https://github.com/TheKevJames/coveralls-python/commit/f597109b62fadaf900af79d4f08a7debee5229e2
  64. - run: pip install 'coveralls>=2.1.0,<4'
  65. - run: coveralls
  66. env:
  67. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  68. # https://github.com/TheKevJames/coveralls-python/issues/240#issuecomment-758336355
  69. COVERALLS_SERVICE_NAME: github
  70. check-links:
  71. runs-on: ubuntu-20.04
  72. strategy:
  73. matrix:
  74. python-verison: ['3.9']
  75. steps:
  76. - uses: actions/checkout@v2.4.0
  77. - uses: actions/setup-python@v2.3.1
  78. with:
  79. python-version: ${{ matrix.python-version }}
  80. - run: pip install --upgrade pipenv==2020.8.13
  81. - run: pipenv install --python "$PYTHON_VERSION" --deploy --dev
  82. env:
  83. PYTHON_VERSION: ${{ matrix.python-version }}
  84. - run: pipenv graph
  85. # `--include '*.md'` fails for https://securipi.co.uk/cc1101.pdf (HTTP403).
  86. # `--include '*.py'` identifies `logging.INFO` as an url.
  87. - run: pipenv run blinkcheck --include CHANGELOG.md