mirror of https://github.com/google/benchmark.git
Fix dependency typo and unpin cibuildwheel version in wheel building … (#1263)
* Fix dependency typo and unpin cibuildwheel version in wheel building action * Move to monolithic build jobs, restrict to x64 architectures As of this commit, all wheel building jobs complete on GitHub Actions. Since some platform-specific options had to be set to fix different types of build problems underway, the build job matrix was unrolled. Still left TODO: * Wheel testing after build (running the Python bindings test) * Emulating bazel on other architectures to build aarch64/i686/ppc64le * Enabling Win32 (this fails due to linker errors). * Add binding test commands for all wheels, set macOSX deployment target to 10.9 * Add instructions for updating Python __version__ variable before release creation
This commit is contained in:
parent
b3c08f6ec3
commit
a17480dd34
|
@ -2,6 +2,9 @@ name: Build and upload Python wheels
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
release:
|
||||||
|
types:
|
||||||
|
- published
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_sdist:
|
build_sdist:
|
||||||
|
@ -19,21 +22,15 @@ jobs:
|
||||||
- name: Build and check sdist
|
- name: Build and check sdist
|
||||||
run: |
|
run: |
|
||||||
python setup.py sdist
|
python setup.py sdist
|
||||||
ls -al dist/
|
|
||||||
- name: Upload sdist
|
- name: Upload sdist
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
path: dist/*.tar.gz
|
path: dist/*.tar.gz
|
||||||
|
|
||||||
build_wheels:
|
build_linux:
|
||||||
name: Build google-benchmark wheels on ${{ matrix.os }}
|
name: Build google-benchmark manylinux wheels
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
# let runner finish even if there is a failure
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out Google Benchmark
|
- name: Check out Google Benchmark
|
||||||
|
@ -44,15 +41,93 @@ jobs:
|
||||||
with:
|
with:
|
||||||
python-version: 3.9
|
python-version: 3.9
|
||||||
|
|
||||||
- name: Build Python wheels on ${{ matrix.os }}
|
# TODO: Bazel does not seem to work in an emulated Docker environment, see
|
||||||
|
# https://github.com/bazelbuild/bazel/issues/11379
|
||||||
|
# - name: Set up QEMU
|
||||||
|
# uses: docker/setup-qemu-action@v1
|
||||||
|
# with:
|
||||||
|
# platforms: all
|
||||||
|
|
||||||
|
- name: Build Python wheels on ubuntu-latest
|
||||||
env:
|
env:
|
||||||
CIBW_BUILD: 'cp36-* cp37-* cp38-* cp39-*'
|
CIBW_BUILD: 'cp37-* cp38-* cp39-* cp310-*'
|
||||||
|
CIBW_SKIP: "*-musllinux_*"
|
||||||
|
# Bazel repo only exists on CentOS 7 for x86 and ppc, so no manylinux2010
|
||||||
|
# TODO: Build ppc64le, aarch64 using some other trick
|
||||||
|
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
|
||||||
|
CIBW_ARCHS_LINUX: x86_64
|
||||||
|
CIBW_BEFORE_ALL: >
|
||||||
|
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: |
|
run: |
|
||||||
pip install cibuildwheelcibuildwheel==2.0.0a2
|
pip install cibuildwheel
|
||||||
|
python -m cibuildwheel --output-dir wheelhouse
|
||||||
|
|
||||||
|
- name: Upload Linux wheels
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: wheelhouse/*.whl
|
||||||
|
|
||||||
|
build_macos:
|
||||||
|
name: Build google-benchmark macOS wheels
|
||||||
|
runs-on: macos-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out Google Benchmark
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Python 3.9
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: 3.9
|
||||||
|
|
||||||
|
- name: Build Python wheels on macOS
|
||||||
|
env:
|
||||||
|
CIBW_ARCHS_MACOS: "x86_64 arm64"
|
||||||
|
CIBW_BUILD: 'cp37-* cp38-* cp39-* cp310-*'
|
||||||
|
# ARM64 requires Python 3.8 minimum
|
||||||
|
CIBW_SKIP: 'cp37-*-arm64'
|
||||||
|
CIBW_TEST_COMMAND: python {project}/bindings/python/google_benchmark/example.py
|
||||||
|
CIBW_TEST_SKIP: "*_arm64"
|
||||||
|
run: |
|
||||||
|
pip install cibuildwheel
|
||||||
|
python -m cibuildwheel --output-dir wheelhouse
|
||||||
|
|
||||||
|
- name: Upload macOS wheels
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: dist
|
||||||
|
path: wheelhouse/*.whl
|
||||||
|
|
||||||
|
build_windows:
|
||||||
|
name: Build google-benchmark wheels on Windows
|
||||||
|
runs-on: windows-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out Google Benchmark
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Python 3.9
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: 3.9
|
||||||
|
|
||||||
|
- name: Build Python wheels on Windows
|
||||||
|
env:
|
||||||
|
CIBW_BUILD: 'cp37-* cp38-* cp39-* cp310-*'
|
||||||
|
CIBW_ARCHS_WINDOWS: AMD64
|
||||||
|
# otherwise, pip crashes the job by trying to remove an in-use bazel DLL
|
||||||
|
PIP_NO_CLEAN: true
|
||||||
|
CIBW_TEST_COMMAND: python {project}/bindings/python/google_benchmark/example.py
|
||||||
|
run: |
|
||||||
|
pip install cibuildwheel
|
||||||
python -m cibuildwheel --output-dir wheelhouse
|
python -m cibuildwheel --output-dir wheelhouse
|
||||||
|
|
||||||
- name: Upload wheels
|
- name: Upload wheels
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
path: ./wheelhouse/*.whl
|
path: wheelhouse/*.whl
|
|
@ -8,10 +8,23 @@
|
||||||
* `git log $(git describe --abbrev=0 --tags)..HEAD` gives you the list of
|
* `git log $(git describe --abbrev=0 --tags)..HEAD` gives you the list of
|
||||||
commits between the last annotated tag and HEAD
|
commits between the last annotated tag and HEAD
|
||||||
* Pick the most interesting.
|
* Pick the most interesting.
|
||||||
* Create one last commit that updates the version saved in `CMakeLists.txt` to the release version you're creating. (This version will be used if benchmark is installed from the archive you'll be creating in the next step.)
|
* Create one last commit that updates the version saved in `CMakeLists.txt` and the
|
||||||
|
`__version__` variable in `bindings/python/google_benchmark/__init__.py`to the release
|
||||||
|
version you're creating. (This version will be used if benchmark is installed from the
|
||||||
|
archive you'll be creating in the next step.)
|
||||||
|
|
||||||
```
|
```
|
||||||
project (benchmark VERSION 1.5.3 LANGUAGES CXX)
|
project (benchmark VERSION 1.6.0 LANGUAGES CXX)
|
||||||
|
```
|
||||||
|
|
||||||
|
```python
|
||||||
|
# bindings/python/google_benchmark/__init__.py
|
||||||
|
|
||||||
|
# ...
|
||||||
|
|
||||||
|
__version__ = "1.6.0" # <-- change this to the release version you are creating
|
||||||
|
|
||||||
|
# ...
|
||||||
```
|
```
|
||||||
|
|
||||||
* Create a release through github's interface
|
* Create a release through github's interface
|
||||||
|
|
3
setup.py
3
setup.py
|
@ -1,5 +1,6 @@
|
||||||
import os
|
import os
|
||||||
import posixpath
|
import posixpath
|
||||||
|
import platform
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
@ -89,6 +90,8 @@ class BuildBazelExtension(build_ext.build_ext):
|
||||||
# Link with python*.lib.
|
# Link with python*.lib.
|
||||||
for library_dir in self.library_dirs:
|
for library_dir in self.library_dirs:
|
||||||
bazel_argv.append("--linkopt=/LIBPATH:" + library_dir)
|
bazel_argv.append("--linkopt=/LIBPATH:" + library_dir)
|
||||||
|
elif sys.platform == "darwin" and platform.machine() == "x86_64":
|
||||||
|
bazel_argv.append("--macos_minimum_os=10.9")
|
||||||
|
|
||||||
self.spawn(bazel_argv)
|
self.spawn(bazel_argv)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue