python-distributions.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. test-sdist:
  57. needs:
  58. - build-sdist
  59. runs-on: ubuntu-latest
  60. steps:
  61. - uses: actions/setup-python@v5
  62. - name: Install dependencies
  63. run: |
  64. python -m pip install --upgrade pip
  65. pip install twine
  66. - name: Download sdist
  67. uses: actions/download-artifact@v2
  68. with:
  69. name: artifact
  70. path: dist
  71. - name: Test sdist
  72. run: twine check dist/*
  73. - name: Test installation from sdist
  74. run: pip install dist/*.tar.gz
  75. publish:
  76. runs-on: ubuntu-latest
  77. needs:
  78. - build-wheels
  79. - build-sdist
  80. if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/dulwich-')
  81. permissions:
  82. id-token: write
  83. environment:
  84. name: pypi
  85. url: https://pypi.org/p/dulwich
  86. steps:
  87. - name: Download distributions
  88. uses: actions/download-artifact@v2
  89. with:
  90. name: artifact
  91. path: dist
  92. - name: Publish package distributions to PyPI
  93. uses: pypa/gh-action-pypi-publish@release/v1