python-distributions.yml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 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_ENVIRONMENT: 'PATH="$HOME/.cargo/bin:$PATH"'
  38. CIBW_ARCHS_LINUX: x86_64 aarch64
  39. CIBW_ARCHS_MACOS: x86_64 arm64 universal2
  40. CIBW_ARCHS_WINDOWS: AMD64 x86
  41. CIBW_BEFORE_BUILD: >
  42. pip install -U setuptools-rust &&
  43. curl https://sh.rustup.rs -sSf | sh -s -- --profile=minimal -y &&
  44. rustup show
  45. - name: Upload wheels
  46. uses: actions/upload-artifact@v3
  47. with:
  48. path: ./wheelhouse/*.whl
  49. build-sdist:
  50. runs-on: ubuntu-latest
  51. steps:
  52. - uses: actions/checkout@v4
  53. - uses: actions/setup-python@v5
  54. - name: Install dependencies
  55. run: |
  56. python -m pip install --upgrade pip
  57. pip install build
  58. - name: Build sdist
  59. run: python -m build --sdist
  60. - name: Upload sdist
  61. uses: actions/upload-artifact@v3
  62. with:
  63. path: ./dist/*.tar.gz
  64. publish:
  65. runs-on: ubuntu-latest
  66. needs:
  67. - build-wheels
  68. - build-sdist
  69. if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/dulwich-')
  70. steps:
  71. - name: Install twine
  72. run: |
  73. python -m pip install --upgrade pip
  74. pip install twine
  75. - name: Download distributions
  76. uses: actions/download-artifact@v2
  77. with:
  78. name: artifact
  79. path: dist
  80. - name: Publish distributions
  81. env:
  82. TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
  83. TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
  84. run: twine upload dist/*