Commit Graph

42 Commits

Author SHA1 Message Date
dominic 94083ca441
remove best effort support for ubuntu 18.04 (#1537)
* remove deprecated ubuntu-18.04 target

* update docs

* force an apt update for perfcounters
2023-02-06 15:37:26 +00:00
Nicholas Junge 80a3c5e4d9
Switch bindings implementation to `nanobind` (#1526)
* End support for Python 3.7, update cibuildwheel and publish actions

Removes Python 3.7 from the support matrix, since it does not support
PEP590 vectorcalls.

Bumps the `cibuildwheel` and `pypa-publish` actions to their latest
available versions respectively.

* Add nanobind to the Bazel dependencies, add a BUILD file

The build file builds nanobind as a static `cc_library`. Currently,
the git SHA points to HEAD, since some necessary features have not
been included in a release yet.

* Delete pybind11 BUILD file

* Switch bindings implementation to nanobind

Switches over the binding tool to `nanobind` from `pybind11`. Most
changes in the build setup itself were drop-in replacements of existing
code changed to nanobind names, no new concepts needed to be
implemented.

Sets the minimum required macOS to 10.14 for full C++17 support. Also,
to avoid ambiguities in Bazel, build for macOS 11 on Mac ARM64.

* Use Bazel select for linker options

Guards against unknown linker option errors by selecting required
linker options for nanobind only on macOS, where they are relevant.

Other changes:
* Bump cibuildwheel action to v2.12.0
* Bump Bazel for aarch64 linux wheels to 6.0.0
* Remove C++17 flag from build files since it is present in setup.py `bazel build` command
* Bump nanobind commit to current HEAD (TBD: Bump to next stable release)

* Unbreak Windows builds of nanobind-based bindings

Guards compiler options behind a new `select` macro choosing between
MSVC and not MSVC.

Other changes:
* Inject the proper C++17 standard cxxopt in the `setup.py` build
command.
* Bump nanobind to current HEAD.
* Make `macos` a benchmark-wide condition, with public visibility to
allow its use in the nanobind BUILD file.

* Fall back to `nb::implicitly_convertible` for Counter construction

Since `benchmark::Counter` only has a constructor for `double`,
the nanobind `nb::init_implicit` template cannot be used. Therefore,
to support implicit construction from ints, we fall back to the
`nb::implicitly_convertible` template instead.
2023-02-06 13:07:17 +00:00
Nicholas Junge f59d021ebc
Modernize setup.py, extend Python bindings CI (#1535)
distutils is deprecated and will be removed in Python 3.12, so this
commit modernizes the Python bindings `setup.py` file in order to
future-proof the code.

On top of this, type hints were added for all of the convenience
functions to make static type checking adoption easier in the future,
if desired.

A context manager was added to temporarily write the Python include
path to the Bazel WORKSPACE file - but unlike previously, the
WORKSPACE file is reverted to its previous state after the build to not
produce changes on every rebuild.

Lastly, the Python bindings test matrix was extended to all major
platforms to create a more complete picture of the current state of
the bindings, especially with regards to upcoming wheel builds.
2023-02-03 09:47:02 +00:00
Dominic Hamon 49aa374da9
bump cmake dep and docs (#1468)
* bump cmake dep and docs
2022-09-14 15:11:37 +01:00
Nicholas Junge 9265511257
Bump pybind11 version to enable Python 3.11 wheel builds (#1489)
This commit bumps the pybind11 version to 2.10.0, which is the first
pybind version coming with Python 3.11 support. This change is necessary
to facilitate wheel builds for Python 3.11 and upward, as changes to
Python internals in 3.11 broke compatibility with older pybind11
versions.

Co-authored-by: Dominic Hamon <dominichamon@users.noreply.github.com>
2022-09-13 15:01:46 +01:00
Nicholas Junge ff629d847c
Enable aarch64 Linux wheel builds, use cibuildwheel action directly (#1472)
This commit enables arm64 Linux wheel builds for Python.
It also changes the build procedure on Linux using
cibuildwheel in GitHub Actions. Instead of the more granular, verbose
approach that was used until now, we opt for the GitHub Action released
by cibuildwheel directly.

We also change the Bazel install procedure in the manylinux Docker
container image. Previously, Bazel was installed from an added RHEL repo, since that is
the recommended official way of installing Bazel on CentOS platforms.
However, the last successful build available for manylinux2014 has been Bazel 4,
which is showing its age with the release of Bazel 6 coming up as of this commit.

After this change, prebuilt Bazel binaries are downloaded using
wget directly from the Bazel GitHub release page. Since Bazel is built
for both x86 and arm64 on Linux, we immediately gain wheel build
support for these architectures. However, since the architecture
of the manylinux image is aarch64 instead of arm64,
a shell script was added that normalizes aarch64 to arm64,
and installs the correct arm64 Bazel binary if necessary.
2022-08-30 13:35:50 +01:00
Dominic Hamon ac8a6d3de9 cleanup comments 2022-07-05 10:42:36 +01:00
Dominic Hamon 8205547ceb
fix sanitizer builds by using clang 13 (#1426)
* attempt to fix sanitizer builds by moving away from llvm head

* extra verbosity

* try clang 13 and add extra logging

* get latest clang and try again
2022-07-05 10:41:38 +01:00
Dominic Hamon a8bc318b9b fix cmake warning for libcxx setup 2022-07-04 12:15:49 +01:00
Dominic Hamon 2365c4a603
add multiple OSes to bazel workflow (#1412)
* add multiple OSes to bazel workflow

* correct indent

* only set copts when they're supported by the OS

* os check should work

* pull out cxx03_test for per-platform stuff

* attempt to fix windows test output
2022-06-13 17:45:20 +01:00
Nicholas Junge dc901ff909
Fix wheel job name for PyPI uploads (#1384)
Previously, with the unrolled job matrix, all jobs had to be listed individually in the `needs` section of the PyPI upload job. But as the wheel build job was reimplemented as a job matrix now, with a
single build job name `build_wheels`, we need to adjust the name in the PyPI upload job as well here to avoid errors.
2022-04-11 09:17:54 +01:00
Nicholas Junge 6f75bb5273
Shut down Bazel gracefully and revert wheel build strategy to job matrix (#1383)
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.
2022-04-08 15:00:46 +01:00
Nicholas Junge 3eab98544f
Change artifact download name to dist to match upload name (#1371) 2022-03-15 12:56:01 +00:00
Nicholas Junge 7d6f1534e9
Remove conditional trigger from PyPI upload job (#1370) 2022-03-15 11:06:30 +00:00
Nicholas Junge 705202d22a
Add PyPI upload job to wheel building workflow (#1359)
This commit adds a job running after the wheel building job responsible for uploading the built wheels to PyPI.
The job only runs on successful completion of all build jobs, and uploads to PyPI using a secret added to the Google Benchmark repo (TBD).
Also, the setup-python action has been bumped to the latest version v3.
2022-03-10 16:56:55 +00:00
Sergiu Deitsch 9e47d070fe
annotate and export public symbols (#1321) 2022-02-14 10:48:53 +00:00
dominc8 680d3fdbb5
Add clang-tidy check (#1290)
* Add clang-tidy.yml and .clang-tidy

* Add mention to authors/contributors

* Temp fix 2 clang-tidy issues

* Enable clang-tidy on pull requests

* Exclude gtest source files from clang-tidy
2021-11-25 15:47:44 +00:00
Nicholas Junge a17480dd34
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
2021-11-11 14:51:22 +00:00
Dominic Hamon b3c08f6ec3
check clang format on pull requests and merges (#1281)
* check clang format on pull requests and merges

* manage some formatting by hand

* undo one format too many
2021-11-10 16:49:49 +00:00
Dominic Hamon da01c5e662
use docker container for ubuntu-16.04 builds (#1265)
* use docker container for ubuntu-16.04 builds

* install some bits

* no sudo in docker container

* cmake, not cmake3

* include perfcounters

* still no sudo in docker containers

* yes please, apt
2021-10-27 16:29:37 +01:00
Vitaly Zaitsev 365670e432
Added Doxygen support. (#1228)
Signed-off-by: Vitaly Zaitsev <vitaly@easycoding.org>
2021-10-25 12:32:33 +01:00
Dominic Hamon 04c466603f
force cmake version to 3.5.1 2021-08-24 14:30:36 +01:00
Nicholas Junge 9433793f3e
Add wheel and sdist building action to GH Workflow (#1180) 2021-07-19 09:45:16 +01:00
Dominic Hamon e451e50e9b
add g++ to sanitizer buildbots (#1197)
* add g++ to sanitizer buildbots

* add compiler to sanitizer build name

* spell g++ correctly. look, it's early, ok?

* only set libcxx if we're using clang
2021-07-01 10:02:54 +01:00
Dominic Hamon 342409126b
Use modern clang/libc++ for sanitizers (#1171)
* Use modern clang/libc++ for sanitizers

* update ubuntu

* new llvm builds differently

* clang, not clang-3.8

* just build what we need
2021-06-04 11:06:38 +01:00
Dominic Hamon bdd6c44787
Enable various sanitizer builds in github actions (#1167)
* Enable various sanitizer builds in github actions

* try with off the shelf versions

* nope

* specific version?

* rats

* oops

* remove msan for now

* reorder so env is set before building libc++
2021-06-03 19:45:02 +01:00
Dominic Hamon 4ff734960c
Run build-and-test on all branches 2021-06-01 15:48:44 +01:00
Roman Lebedev f10b9c0cb3
Un-disable github actions :] 2021-06-01 13:04:32 +03:00
Dominic Hamon 604112c2d5
Run build-and-test on all branches 2021-06-01 11:00:37 +01:00
Dominic Hamon 0852c79f35
remove done TODOs 2021-05-07 14:24:00 +01:00
Dominic Hamon 551a21bad0
add g++-6 to ubuntu-14.04 (#1144)
* add g++-6 to ubuntu-14.04

* fix syntax

* fix yamllint errors for build-and-test

* fix 'add-apt-repository' command not found

* make 'run tests' explicit

* enable testing and run both release and debug

* oops
2021-05-07 14:23:05 +01:00
Dominic Hamon a53b8853aa
Add ubuntu-14.04 build and test workflow (#1131)
* Add ubuntu-14.04 build and test workflow

* avoid '.' in job name

* no need for fail fast

* fix workflow syntax

* install some stuff

* better compiler installations

* update before install

* just say yes

* trying to match up some paths

* Difference between runner and github context in container?

* Try some judicious logging

* cmake 3.5+ required

* specific compiler versions

* need git for googletest

* Disable testing on old compilers

* disable testing properly
2021-05-07 12:39:04 +01:00
Dominic Hamon ba9a763def
Add multiple compiler support to build-and-test workflow (#1128)
* Add 32-bit build support to build-and-test

* attempt different yaml multiline string format

* syntax fixes to yaml

* switch to getting alternative compilers working

* remove done TODO

* trying to separate out windows

* oops, typo.

* add TODOs for missing builds wrt travis
2021-04-30 14:22:15 +01:00
Mircea Trofin 376ebc2635
Support optional, user-directed collection of performance counters (#1114)
* Support optional, user-directed collection of performance counters

The patch allows an engineer wishing to drill into the root causes
of a regression, for example. Currently, only single threaded runs
are supported. The feature is a build-time opt in, and then a runtime
opt in.

The engineer may run the benchmark executable, passing a list of
performance counter names (using libpfm's naming scheme) at the
command line. The counter values will then be collected and reported
back as UserCounters.

This is different from #240 in that it is a benchmark user opt-in, and
the counter collection is transparent to the benchmark.

Currently, this is only supported on platforms where libpfm is
supported.

libpfm: http://perfmon2.sourceforge.net/

* 'Use' values param in Snapshot when BENCHMARK_OS_WINDOWS

This is to avoid unused parameter warning-as-error

* Added missing include for <vector> in perf_counters.cc

* Moved doc to docs

* Added license blurbs
2021-04-28 09:25:29 +01:00
Dominic Hamon 86da5ec294
Add verbosity to CI logs (#1122) 2021-04-26 18:26:33 +01:00
Dominic Hamon 2dad9aef78
Re-enable bazel without bazelisk and with scoped build/test targets (#1109)
* See if bazel "just works" now (almost)

* Add cache and better bazel test command line

* Narrow focus of bazel build
2021-04-19 10:51:12 +01:00
Dominic Hamon 4c26070de0
disable bazel for now (#1101)
Unclear why this is failing so disabling for now. bazel build still works locally so this is a bazelisk/github workflow thing.
2021-03-05 15:04:18 +00:00
Dominic Hamon a6d08aea4b
Create workflow to exercise bazel build (#1079)
* Create workflow to exercise bazel build
2020-12-22 11:47:52 +00:00
Dominic Hamon df9e2948fa
Add workflow to exercise bindings (#1041)
* Initial version to try to run python bindings example

* python indent issue in setup.py

* better naming
2020-09-10 16:32:25 +01:00
Dominic Hamon beb360d03e
Create pylint.yml (#1039)
* Create pylint.yml

* improve file matching

* fix some pylint issues

* run on PR and push (force on master only)

* more pylint fixes

* suppress noisy exit code and filter to fatals

* add conan as a dep so the module is importable

* fix lint error on unreachable branch
2020-09-09 09:43:26 +01:00
Dominic Hamon 4986d0b2ea
Create build-and-test.yml (#1013)
First attempt at a non-travis/non appveyor CI solution
2020-08-18 08:53:21 +01:00
Dominic Hamon 8e0b1913d4 Update issue templates 2020-02-25 11:21:58 +00:00