Skip to content

Commit 3fe3ae0

Browse files
committed
Add conan workflow
1 parent f8d25e6 commit 3fe3ae0

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

.github/workflows/conan.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Conan
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
conan-package:
10+
runs-on: ubuntu-24.04
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Conan Environment
17+
uses: hankhsu1996/[email protected]
18+
with:
19+
cache-dependencies: true
20+
cache-tool: true
21+
22+
- name: Install conan dependencies
23+
run: |
24+
conan profile detect --force
25+
conan install . --output-folder=build --build=missing -s:a compiler.cppstd=20 -o:a build_tests=True
26+
27+
- name: CMake configuration
28+
run: |
29+
cmake --preset conan-release \
30+
-DSPARROW_IPC_BUILD_TESTS=ON \
31+
-DFETCH_DEPENDENCIES_WITH_CMAKE=MISSING
32+
33+
- name: Build
34+
working-directory: build/build/Release
35+
run: cmake --build . --config Release --target test_sparrow_ipc_lib
36+
37+
- name: Run tests
38+
working-directory: build/build/Release
39+
run: cmake --build . --config Release --target run_tests_with_junit_report

conanfile.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from conan import ConanFile
22
from conan.errors import ConanInvalidConfiguration
33
from conan.tools.build.cppstd import check_min_cppstd
4-
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
4+
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
55
from conan.tools.files import copy
66
from conan.tools.scm import Version
77
import os
@@ -18,7 +18,6 @@ class SparrowIPCRecipe(ConanFile):
1818
topics = ("arrow", "apache arrow", "columnar format", "dataframe", "ipc", "serialization", "deserialization", "flatbuffers")
1919
package_type = "library"
2020
settings = "os", "arch", "compiler", "build_type"
21-
generators = "CMakeDeps"
2221
exports_sources = "include/*", "src/*", "cmake/*", "CMakeLists.txt", "LICENSE"
2322
options = {
2423
"shared": [True, False],
@@ -45,6 +44,9 @@ def requirements(self):
4544
if self.options.get_safe("build_tests"):
4645
self.test_requires("doctest/2.4.12")
4746

47+
def build_requirements(self):
48+
self.tool_requires("cmake/[>=3.28.1 <4.2.0]")
49+
4850
@property
4951
def _min_cppstd(self):
5052
return 20
@@ -73,7 +75,11 @@ def layout(self):
7375
cmake_layout(self, src_folder=".")
7476

7577
def generate(self):
78+
deps = CMakeDeps(self)
79+
deps.generate()
80+
7681
tc = CMakeToolchain(self)
82+
tc.variables["SPARROW_IPC_BUILD_SHARED"] = self.options.shared
7783
tc.variables["SPARROW_IPC_BUILD_TESTS"] = self.options.build_tests
7884
tc.generate()
7985

0 commit comments

Comments
 (0)