pythontest.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. # Install build-time dependencies
  41. python -m pip install --upgrade "setuptools>=77"
  42. python -m pip install --upgrade pip
  43. pip install --upgrade ".[merge,fastimport,paramiko,https]" setuptools-rust
  44. - name: Install gpg on supported platforms
  45. run: pip install --upgrade ".[pgp]"
  46. if: "matrix.os != 'windows-latest' && matrix.python-version != 'pypy3'"
  47. - name: Style checks
  48. run: |
  49. pip install ".[dev]"
  50. python -m ruff check .
  51. python -m ruff format --check .
  52. - name: Typing checks
  53. run: |
  54. pip install --upgrade types-paramiko types-requests
  55. python -m mypy dulwich
  56. if: "matrix.python-version != 'pypy3'"
  57. - name: Build
  58. run: |
  59. python setup.py build_ext -i
  60. env:
  61. RUSTFLAGS: "-D warnings"
  62. - name: codespell
  63. run: |
  64. pip install --upgrade codespell
  65. codespell --config .codespellrc .
  66. - name: Coverage test suite run
  67. run: |
  68. pip install --upgrade coverage
  69. python -m coverage run -p -m unittest tests.test_suite