2
0

python-distributions.yml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. name: Build Python distributions
  2. on:
  3. push:
  4. schedule:
  5. - cron: "0 6 * * *" # Daily 6AM UTC build
  6. jobs:
  7. build-wheels:
  8. runs-on: ${{ matrix.os }}
  9. strategy:
  10. matrix:
  11. os: [ubuntu-latest, macos-latest, windows-latest]
  12. fail-fast: true
  13. steps:
  14. - uses: actions/checkout@v4
  15. - uses: actions/setup-python@v5
  16. - name: Install native dependencies (Ubuntu)
  17. run: sudo apt-get update && sudo apt-get install -y libgpgme-dev libgpg-error-dev
  18. if: "matrix.os == 'ubuntu-latest'"
  19. - name: Install native dependencies (MacOS)
  20. run: brew install swig gpgme
  21. if: "matrix.os == 'macos-latest'"
  22. - name: Install dependencies
  23. run: |
  24. python -m pip install --upgrade pip
  25. pip install setuptools wheel fastimport paramiko urllib3 cibuildwheel==2.16.2 setuptools-rust
  26. - name: Install gpg on supported platforms
  27. run: pip install -U gpg
  28. if: "matrix.os != 'windows-latest'"
  29. - name: Run test suite
  30. run: python -m unittest dulwich.tests.test_suite
  31. - name: Set up QEMU
  32. uses: docker/setup-qemu-action@v3
  33. if: "matrix.os == 'ubuntu-latest'"
  34. - name: Build wheels
  35. run: python -m cibuildwheel --output-dir wheelhouse
  36. env:
  37. CIBW_ARCHS_LINUX: x86_64 aarch64
  38. CIBW_ARCHS_MACOS: x86_64 arm64 universal2
  39. CIBW_ARCHS_WINDOWS: AMD64 x86
  40. - name: Upload wheels
  41. uses: actions/upload-artifact@v4
  42. with:
  43. path: ./wheelhouse/*.whl
  44. build-sdist:
  45. runs-on: ubuntu-latest
  46. steps:
  47. - uses: actions/checkout@v4
  48. - uses: actions/setup-python@v5
  49. - name: Install dependencies
  50. run: |
  51. python -m pip install --upgrade pip
  52. pip install build
  53. - name: Build sdist
  54. run: python -m build --sdist
  55. - name: Upload sdist
  56. uses: actions/upload-artifact@v4
  57. with:
  58. path: ./dist/*.tar.gz
  59. publish:
  60. runs-on: ubuntu-latest
  61. needs:
  62. - build-wheels
  63. - build-sdist
  64. if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/dulwich-')
  65. steps:
  66. - name: Install twine
  67. run: |
  68. python -m pip install --upgrade pip
  69. pip install twine
  70. - name: Download distributions
  71. uses: actions/download-artifact@v4
  72. with:
  73. name: artifact
  74. path: dist
  75. - name: Publish distributions
  76. env:
  77. TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
  78. TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
  79. run: twine upload dist/*