python-distributions.yml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 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 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. - name: Upload wheels
  37. uses: actions/upload-artifact@v3
  38. with:
  39. path: ./wheelhouse/*.whl
  40. build-sdist:
  41. runs-on: ubuntu-latest
  42. steps:
  43. - uses: actions/checkout@v4
  44. - uses: actions/setup-python@v5
  45. - name: Install dependencies
  46. run: |
  47. python -m pip install --upgrade pip
  48. pip install build
  49. - name: Build sdist
  50. run: python -m build --sdist
  51. - name: Upload sdist
  52. uses: actions/upload-artifact@v3
  53. with:
  54. path: ./dist/*.tar.gz
  55. publish:
  56. runs-on: ubuntu-latest
  57. needs:
  58. - build-wheels
  59. - build-sdist
  60. if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/dulwich-')
  61. permissions:
  62. id-token: write
  63. environment:
  64. name: pypi
  65. url: https://pypi.org/p/dulwich
  66. steps:
  67. - name: Download distributions
  68. uses: actions/download-artifact@v2
  69. with:
  70. name: artifact
  71. path: dist
  72. - name: Publish package distributions to PyPI
  73. uses: pypa/gh-action-pypi-publish@release/v1