python-distributions.yml 2.3 KB

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