Skip to content

Commit

Permalink
Add workflow to exercise bindings (#1041)
Browse files Browse the repository at this point in the history
* Initial version to try to run python bindings example

* python indent issue in setup.py

* better naming
  • Loading branch information
dominichamon authored Sep 10, 2020
1 parent 12e85b2 commit df9e294
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 11 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/test_bindings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: test-bindings

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
python_bindings:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install benchmark
run:
python setup.py install
- name: Run example bindings
run:
python bindings/python/google_benchmark/example.py
22 changes: 11 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,17 @@ def bazel_build(self, ext):
for library_dir in self.library_dirs:
bazel_argv.append('--linkopt=/LIBPATH:' + library_dir)

self.spawn(bazel_argv)

shared_lib_suffix = '.dll' if IS_WINDOWS else '.so'
ext_bazel_bin_path = os.path.join(
self.build_temp, 'bazel-bin',
ext.relpath, ext.target_name + shared_lib_suffix)
ext_dest_path = self.get_ext_fullpath(ext.name)
ext_dest_dir = os.path.dirname(ext_dest_path)
if not os.path.exists(ext_dest_dir):
os.makedirs(ext_dest_dir)
shutil.copyfile(ext_bazel_bin_path, ext_dest_path)
self.spawn(bazel_argv)

shared_lib_suffix = '.dll' if IS_WINDOWS else '.so'
ext_bazel_bin_path = os.path.join(
self.build_temp, 'bazel-bin',
ext.relpath, ext.target_name + shared_lib_suffix)
ext_dest_path = self.get_ext_fullpath(ext.name)
ext_dest_dir = os.path.dirname(ext_dest_path)
if not os.path.exists(ext_dest_dir):
os.makedirs(ext_dest_dir)
shutil.copyfile(ext_bazel_bin_path, ext_dest_path)


setuptools.setup(
Expand Down

0 comments on commit df9e294

Please sign in to comment.