pythontest.yml 2.4 KB

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