Skip to content

Commit

Permalink
Add Github actions to run c++ tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ybubnov committed Apr 18, 2024
1 parent 4bfe7e3 commit 518e1a5
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 7 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/cmake.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: CMake

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install third-party libraries
run: sudo apt install -y libboost-test-dev libtorch-dev

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build

- name: Build
run: cmake --build ${{github.workspace}}/build

- name: Test
working-directory: ${{github.workspace}}/build
run: make test ARGS=--verbose"
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
project(torch_geopooling, CXX)
add_definitions(-std=c++17)


find_package(fmt CONFIG REQUIRED)
find_package(Torch CONFIG REQUIRED)

Expand All @@ -27,7 +26,7 @@ add_library(torch_geopooling SHARED ${torch_geopooling_SOURCES})
set_target_properties(torch_geopooling PROPERTIES CXX_STANDARD 17)
set_target_properties(torch_geopooling PROPERTIES VERSION ${torch_geopooling_LIBRARY_VERSION})
set_target_properties(torch_geopooling PROPERTIES SOVERSION ${torch_geopooling_LIBRARY_SOVERSION})
target_link_libraries(torch_geopooling fmt::fmt)
target_link_libraries(torch_geopooling fmt::fmt-header-only)
target_link_libraries(torch_geopooling "${TORCH_LIBRARIES}")


Expand Down
30 changes: 26 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,29 @@

setup(
name="torch_geopooling",
version="1.0.0",
description="Geopooling modules for PyTorch framework",

url="https://github.com/ybubnov/torch_geopooling",
author="Yakau Bubnou",
author_email="[email protected]",

package_dir={"torch_geopooling": "torch_geopooling"},
packages=["torch_geopooling"],

# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries",
"Topic :: System :: Archiving :: Compression",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: MIT License",
],

ext_modules=[
cpp_extension.CppExtension(
name="torch_geopooling._C",
Expand All @@ -18,11 +37,14 @@
"src/tile.cc",
"torch_geopooling/__bind__/python_module.cc",
],
include_dirs=[
str(Path.cwd() / "include"),
],
libraries=["fmt", "torch", "c10"],
include_dirs=[str(Path.cwd() / "include")],
libraries=["torch", "c10"],
extra_compile_args=["-DFMT_HEADER_ONLY=1"],
),
],
cmdclass={"build_ext": cpp_extension.BuildExtension},

test_require=["pytest"],
install_requires=["torch>=2.0.0"],
setup_requires=["torch>=2.0.0"],
)
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ foreach(torch_geopooling_TEST_SOURCE ${torch_geopooling_TEST_SOURCES})

add_executable(${torch_geopooling_TEST} ${torch_geopooling_TEST_SOURCE})
target_link_libraries(${torch_geopooling_TEST} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
target_link_libraries(${torch_geopooling_TEST} fmt::fmt)
target_link_libraries(${torch_geopooling_TEST} fmt::fmt-header-only)
target_link_libraries(${torch_geopooling_TEST} "${TORCH_LIBRARIES}")
target_link_libraries(${torch_geopooling_TEST} torch_geopooling)

Expand Down

0 comments on commit 518e1a5

Please sign in to comment.