You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.0 KiB

2 months ago
  1. name: Build and upload Python wheels
  2. on:
  3. workflow_dispatch:
  4. release:
  5. types:
  6. - published
  7. jobs:
  8. build_sdist:
  9. name: Build source distribution
  10. runs-on: ubuntu-latest
  11. steps:
  12. - name: Check out repo
  13. uses: actions/checkout@v3
  14. - name: Install Python 3.11
  15. uses: actions/setup-python@v4
  16. with:
  17. python-version: 3.11
  18. - name: Build and check sdist
  19. run: |
  20. python setup.py sdist
  21. - name: Upload sdist
  22. uses: actions/upload-artifact@v3
  23. with:
  24. name: dist
  25. path: dist/*.tar.gz
  26. build_wheels:
  27. name: Build Google Benchmark wheels on ${{ matrix.os }}
  28. runs-on: ${{ matrix.os }}
  29. strategy:
  30. matrix:
  31. os: [ubuntu-latest, macos-latest, windows-latest]
  32. steps:
  33. - name: Check out Google Benchmark
  34. uses: actions/checkout@v3
  35. - name: Set up QEMU
  36. if: runner.os == 'Linux'
  37. uses: docker/setup-qemu-action@v2
  38. with:
  39. platforms: all
  40. - name: Build wheels on ${{ matrix.os }} using cibuildwheel
  41. uses: pypa/cibuildwheel@v2.12.0
  42. env:
  43. CIBW_BUILD: 'cp38-* cp39-* cp310-* cp311-*'
  44. CIBW_SKIP: "*-musllinux_*"
  45. CIBW_TEST_SKIP: "*-macosx_arm64"
  46. CIBW_ARCHS_LINUX: x86_64 aarch64
  47. CIBW_ARCHS_MACOS: x86_64 arm64
  48. CIBW_ARCHS_WINDOWS: AMD64
  49. CIBW_BEFORE_ALL_LINUX: bash .github/install_bazel.sh
  50. CIBW_TEST_COMMAND: python {project}/bindings/python/google_benchmark/example.py
  51. - name: Upload Google Benchmark ${{ matrix.os }} wheels
  52. uses: actions/upload-artifact@v3
  53. with:
  54. name: dist
  55. path: ./wheelhouse/*.whl
  56. pypi_upload:
  57. name: Publish google-benchmark wheels to PyPI
  58. needs: [build_sdist, build_wheels]
  59. runs-on: ubuntu-latest
  60. steps:
  61. - uses: actions/download-artifact@v3
  62. with:
  63. name: dist
  64. path: dist
  65. - uses: pypa/gh-action-pypi-publish@v1.6.4
  66. with:
  67. user: __token__
  68. password: ${{ secrets.PYPI_PASSWORD }}