python.yml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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-version: ['3.9']
  16. steps:
  17. - uses: actions/checkout@v3
  18. - uses: actions/setup-python@v4
  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.7'
  35. - '3.8'
  36. - '3.9'
  37. - '3.10'
  38. fail-fast: false
  39. steps:
  40. - uses: actions/checkout@v3
  41. - uses: actions/setup-python@v4
  42. with:
  43. python-version: ${{ matrix.python-version }}
  44. # did not reduce runtime of `pipenv install` (still approx. 1 min)
  45. #cache: pipenv
  46. - run: pip install --upgrade pipenv==2020.8.13
  47. # by default pipenv picks the latest version in PATH
  48. - run: pipenv install --python "$PYTHON_VERSION" --deploy --dev
  49. env:
  50. PYTHON_VERSION: ${{ matrix.python-version }}
  51. - run: pipenv graph
  52. - run: pipenv run pytest --cov="$(cat *.egg-info/top_level.txt)" --cov-report=term-missing --cov-fail-under=100
  53. - run: pipenv run pylint --load-plugins=pylint_import_requirements "$(cat *.egg-info/top_level.txt)"
  54. - run: pipenv run pylint tests
  55. - run: pipenv run mypy "$(cat *.egg-info/top_level.txt)" tests
  56. # >=2.1.0 to support GITHUB_TOKEN
  57. # COVERALLS_REPO_TOKEN required manual configuration of secret
  58. # https://github.com/TheKevJames/coveralls-python/commit/f597109b62fadaf900af79d4f08a7debee5229e2
  59. - run: pip install 'coveralls>=2.1.0,<4'
  60. - run: coveralls
  61. env:
  62. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  63. # https://github.com/TheKevJames/coveralls-python/issues/240#issuecomment-758336355
  64. COVERALLS_SERVICE_NAME: github
  65. check-links:
  66. runs-on: ubuntu-20.04
  67. strategy:
  68. matrix:
  69. python-version: ['3.9']
  70. steps:
  71. - uses: actions/checkout@v3
  72. - uses: actions/setup-python@v4
  73. with:
  74. python-version: ${{ matrix.python-version }}
  75. - run: pip install --upgrade pipenv==2020.8.13
  76. - run: pipenv install --python "$PYTHON_VERSION" --deploy --dev
  77. env:
  78. PYTHON_VERSION: ${{ matrix.python-version }}
  79. - run: pipenv graph
  80. # `--include '*.md'` fails for https://securipi.co.uk/cc1101.pdf (HTTP403).
  81. # `--include '*.py'` identifies `logging.INFO` as an url.
  82. - run: pipenv run blinkcheck --include CHANGELOG.md