python.yml 3.6 KB

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