python-distributions.yml 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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@v3
  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@v1
  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 -- --default-toolchain=nightly --profile=minimal -y &&
  44. rustup default nightly &&
  45. rustup target add all &&
  46. rustup show
  47. - name: Upload wheels
  48. uses: actions/upload-artifact@v3
  49. with:
  50. path: ./wheelhouse/*.whl
  51. build-sdist:
  52. runs-on: ubuntu-latest
  53. steps:
  54. - uses: actions/checkout@v4
  55. - uses: actions/setup-python@v3
  56. - name: Install dependencies
  57. run: |
  58. python -m pip install --upgrade pip
  59. pip install build
  60. - name: Build sdist
  61. run: python -m build --sdist
  62. - name: Upload sdist
  63. uses: actions/upload-artifact@v3
  64. with:
  65. path: ./dist/*.tar.gz
  66. publish:
  67. runs-on: ubuntu-latest
  68. needs:
  69. - build-wheels
  70. - build-sdist
  71. if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/dulwich-')
  72. steps:
  73. - name: Install twine
  74. run: |
  75. python -m pip install --upgrade pip
  76. pip install twine
  77. - name: Download distributions
  78. uses: actions/download-artifact@v2
  79. with:
  80. name: artifact
  81. path: dist
  82. - name: Publish distributions
  83. env:
  84. TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
  85. TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
  86. run: twine upload dist/*