mirror of
https://github.com/google/benchmark.git
synced 2024-12-29 14:00:16 +08:00
6f75bb5273
This commit adds a `bazel shutdown` command to the setuptools BazelExtension. This has the effect that wheel builds shut down the Bazel server and terminate gracefully after the build, something that was previously an issue on Windows builds. Since the windows-specific `--no-clean` flag option to `pip wheel` becomes unnecessary due to this change, this change has the side-effect that GitHub Actions wheel builds via `cibuildwheel` can now be written as a compact job matrix again, which leads to a lot of deduplicated code in the corresponding workflow file. Lastly, some GitHub-provided actions (checkout, setup-python, upload/download-artifact) were bumped to the latest v3 version.
84 lines
2.3 KiB
YAML
84 lines
2.3 KiB
YAML
name: Build and upload Python wheels
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
release:
|
|
types:
|
|
- published
|
|
|
|
jobs:
|
|
build_sdist:
|
|
name: Build source distribution
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out repo
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install Python 3.9
|
|
uses: actions/setup-python@v3
|
|
with:
|
|
python-version: 3.9
|
|
|
|
- name: Build and check sdist
|
|
run: |
|
|
python setup.py sdist
|
|
- name: Upload sdist
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: dist
|
|
path: dist/*.tar.gz
|
|
|
|
build_wheels:
|
|
name: Build Google Benchmark wheels on ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
|
|
steps:
|
|
- name: Check out Google Benchmark
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Python 3.9
|
|
uses: actions/setup-python@v3
|
|
with:
|
|
python-version: 3.9
|
|
|
|
- name: Install and run cibuildwheel on ${{ matrix.os }}
|
|
env:
|
|
CIBW_BUILD: 'cp37-* cp38-* cp39-* cp310-*'
|
|
CIBW_SKIP: "cp37-*-arm64 *-musllinux_*"
|
|
# TODO: Build ppc64le, aarch64 using some other trick
|
|
CIBW_ARCHS_LINUX: x86_64
|
|
CIBW_ARCHS_MACOS: x86_64 arm64
|
|
CIBW_ARCHS_WINDOWS: AMD64
|
|
CIBW_BEFORE_ALL_LINUX: >
|
|
curl -O --retry-delay 5 --retry 5 https://copr.fedorainfracloud.org/coprs/vbatts/bazel/repo/epel-7/vbatts-bazel-epel-7.repo &&
|
|
cp vbatts-bazel-epel-7.repo /etc/yum.repos.d/bazel.repo &&
|
|
yum install -y bazel4
|
|
CIBW_TEST_COMMAND: python {project}/bindings/python/google_benchmark/example.py
|
|
run: |
|
|
pip install cibuildwheel
|
|
python -m cibuildwheel --output-dir wheelhouse
|
|
|
|
- name: Upload Google Benchmark ${{ matrix.os }} wheels
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: dist
|
|
path: ./wheelhouse/*.whl
|
|
|
|
pypi_upload:
|
|
name: Publish google-benchmark wheels to PyPI
|
|
needs: [build_sdist, build_linux, build_macos, build_windows]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: dist
|
|
path: dist
|
|
|
|
- uses: pypa/gh-action-pypi-publish@v1.5.0
|
|
with:
|
|
user: __token__
|
|
password: ${{ secrets.PYPI_PASSWORD }}
|