python.yml 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # sync with https://github.com/fphammerle/ical2vdir/blob/master/.github/workflows/python.yml
  2. # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
  3. # shown in badge
  4. # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/configuring-a-workflow#adding-a-workflow-status-badge-to-your-repository
  5. name: tests
  6. on:
  7. push:
  8. pull_request:
  9. schedule:
  10. - cron: '0 20 * * 5'
  11. jobs:
  12. code-format:
  13. runs-on: ubuntu-20.04
  14. steps:
  15. - uses: actions/checkout@v1
  16. - uses: actions/setup-python@v2.2.2
  17. with:
  18. python-version: '3.9'
  19. - run: pip install --upgrade pipenv==2020.8.13
  20. - run: pipenv install --python "$PYTHON_VERSION" --deploy --dev
  21. env:
  22. PYTHON_VERSION: ${{ matrix.python-version }}
  23. - run: pipenv graph
  24. - run: pipenv run black --check .
  25. tests:
  26. runs-on: ubuntu-20.04
  27. strategy:
  28. matrix:
  29. python-version:
  30. - '3.6'
  31. - '3.7'
  32. - '3.8'
  33. - '3.9'
  34. fail-fast: false
  35. steps:
  36. - uses: actions/checkout@v1
  37. - uses: actions/setup-python@v2.2.2
  38. with:
  39. python-version: ${{ matrix.python-version }}
  40. # test_read_triangular_locale & test_write_triangular_same_locale
  41. - run: sudo locale-gen de_AT.utf8
  42. - run: pip install --upgrade pipenv==2020.8.13
  43. # by default pipenv picks the latest version in PATH
  44. - run: pipenv --python "$(which python)" install --deploy --dev
  45. - run: pipenv graph
  46. - run: pipenv run pytest --cov="$(cat *.egg-info/top_level.txt)" --cov-report=term-missing --cov-fail-under=100
  47. - run: pipenv run pylint --load-plugins=pylint_import_requirements "$(cat *.egg-info/top_level.txt)"
  48. # https://github.com/PyCQA/pylint/issues/352
  49. - run: pipenv run pylint 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
  60. test-examples:
  61. runs-on: ubuntu-20.04
  62. strategy:
  63. matrix:
  64. python-version:
  65. - '3.6'
  66. - '3.7'
  67. - '3.8'
  68. - '3.9'
  69. fail-fast: false
  70. defaults:
  71. run:
  72. working-directory: examples/
  73. steps:
  74. - uses: actions/checkout@v1
  75. - uses: actions/setup-python@v1
  76. with:
  77. python-version: ${{ matrix.python-version }}
  78. - run: pip install --upgrade pipenv==2020.8.13
  79. - run: pipenv --python "$(which python)" install --deploy --dev
  80. - run: pipenv graph
  81. # > the default behaviour is to abort conversion [...] if one of the cells throws an error
  82. - run: pipenv run jupyter nbconvert --execute --inplace *.ipynb
  83. # revert line specifying version of python interpreter
  84. - run: sudo apt-get update
  85. - run: sudo apt-get install --yes --no-install-recommends patchutils
  86. - run: git diff --unified=0 | grepdiff --output-matching=hunk '^ "version":' | patch --reverse
  87. - run: git diff --exit-code