pythontest.yml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. name: Python tests
  2. on:
  3. push:
  4. branches: [ main, master ]
  5. pull_request:
  6. schedule:
  7. - cron: "0 6 * * *" # Daily 6AM UTC build
  8. jobs:
  9. test:
  10. runs-on: ${{ matrix.os }}
  11. strategy:
  12. matrix:
  13. os: [ubuntu-latest, macos-latest, windows-latest]
  14. python-version:
  15. ["3.9", "3.10", "3.11", "3.12", "3.13"]
  16. fail-fast: false
  17. steps:
  18. - uses: actions/checkout@v4
  19. - name: Set up Python ${{ matrix.python-version }}
  20. uses: actions/setup-python@v5
  21. with:
  22. python-version: ${{ matrix.python-version }}
  23. allow-prereleases: true
  24. cache: pip
  25. - name: Install native dependencies (Ubuntu)
  26. run: sudo apt-get update && sudo apt-get install -y libgpgme-dev libgpg-error-dev
  27. if: "matrix.os == 'ubuntu-latest'"
  28. - name: Provide gpgme-config and gpg-error-config
  29. if: "matrix.os == 'ubuntu-latest'"
  30. run: |
  31. mkdir -p "$HOME/.local/bin"
  32. cp .github/gpgme-config "$HOME/.local/bin/gpgme-config"
  33. cp .github/gpg-error-config "$HOME/.local/bin/gpg-error-config"
  34. echo "$HOME/.local/bin" >> $GITHUB_PATH
  35. - name: Install native dependencies (MacOS)
  36. run: brew install swig gpgme
  37. if: "matrix.os == 'macos-latest'"
  38. - name: Install dependencies
  39. run: |
  40. python -m pip install --upgrade pip
  41. pip install --upgrade ".[fastimport,paramiko,https]" setuptools-rust
  42. - name: Install gpg on supported platforms
  43. run: pip install --upgrade ".[pgp]"
  44. if: "matrix.os != 'windows-latest' && matrix.python-version != 'pypy3'"
  45. - name: Style checks
  46. run: |
  47. pip install ".[dev]"
  48. python -m ruff check .
  49. python -m ruff format --check .
  50. - name: Typing checks
  51. run: |
  52. pip install --upgrade types-paramiko types-requests
  53. python -m mypy dulwich
  54. if: "matrix.python-version != 'pypy3'"
  55. - name: Build
  56. run: |
  57. python setup.py build_ext -i
  58. env:
  59. RUSTFLAGS: "-D warnings"
  60. - name: codespell
  61. run: |
  62. pip install --upgrade codespell
  63. codespell --config .codespellrc .
  64. - name: Coverage test suite run
  65. run: |
  66. pip install --upgrade coverage
  67. python -m coverage run -p -m unittest tests.test_suite