python.yml 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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-24.04
  14. strategy:
  15. matrix:
  16. python-version: ['3.13']
  17. steps:
  18. - uses: actions/checkout@v7
  19. - uses: actions/setup-python@v7
  20. with:
  21. python-version: ${{ matrix.python-version }}
  22. - run: pip install --upgrade pipenv==2024.1.0
  23. - run: pipenv install --python "$PYTHON_VERSION" --deploy --dev
  24. env:
  25. PYTHON_VERSION: ${{ matrix.python-version }}
  26. - run: pipenv graph
  27. - run: pipenv run black --check .
  28. tests:
  29. runs-on: ubuntu-24.04
  30. strategy:
  31. matrix:
  32. python-version:
  33. - '3.11'
  34. - '3.12'
  35. - '3.13'
  36. - '3.14'
  37. fail-fast: false
  38. steps:
  39. - uses: actions/checkout@v7
  40. with:
  41. lfs: true # tests/resources/
  42. - uses: actions/setup-python@v7
  43. with:
  44. python-version: ${{ matrix.python-version }}
  45. # pipenv>=2025.0.0 is required for python3.14 compatibility (ast.Str was removed)
  46. - run: pip install --upgrade pipenv==2025.1.3
  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: echo "TOP_LEVEL=$(find . -maxdepth 2 -name __init__.py | cut -d/ -f2 | head -1)" >> "$GITHUB_ENV"
  53. - run: pipenv run pytest --cov="$TOP_LEVEL"
  54. --cov-report=term-missing --cov-fail-under=100
  55. - run: pipenv run pylint "$TOP_LEVEL"
  56. # workaround pylint reporting:
  57. # > E0401: Unable to import 'ical2vdir' (import-error)
  58. # pyproject.toml broken?
  59. - run: >-
  60. printenv GITHUB_WORKSPACE
  61. | tee "$(pipenv --venv)/lib/python${PYTHON_VERSION}/site-packages/easy-install.pth"
  62. env:
  63. PYTHON_VERSION: ${{ matrix.python-version }}
  64. # https://github.com/PyCQA/pylint/issues/352
  65. # disable parse-error due to:
  66. # > tests/resources/__init__.py:1:0: F0010: error while code parsing: Unable to load file tests/resources/__init__.py:
  67. # > [Errno 2] No such file or directory: 'tests/resources/__init__.py' (parse-error)
  68. - run: pipenv run pylint --disable=parse-error tests/*
  69. - run: pipenv run mypy "$TOP_LEVEL" tests