Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 2 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ jobs:
- name: Install Boost
if: ${{ matrix.boost == true }}
run: |
add-apt-repository ppa:nicola-onorata/toolchain
add-apt-repository ppa:mhier/libboost-latest
apt-get update
apt-get install -y boost1.81
apt-get install -y boost1.83
- name: Build
run: script/ci_build.sh -DINFLUXCXX_WITH_BOOST=${{ matrix.boost }}
- name: Check deployment as cmake subdirectory
Expand All @@ -43,32 +43,6 @@ jobs:
run: script/ci_testdeploy.sh -DINFLUXCXX_AS_SUBDIR=OFF


build_conan:
runs-on: ubuntu-latest
strategy:
matrix:
boost:
- "True"
- "False"
name: "conan (Boost: ${{ matrix.boost }})"
steps:
- uses: actions/checkout@main
- name: Cache Conan Packages
uses: actions/cache@main
with:
path: ~/.conan2/p/
key: conan-${{ runner.os }}-${{ matrix.compiler }}-boost_${{ matrix.boost }}-${{ hashFiles('conanfile.py') }}
- name: Setup
run: |
pip install -U conan
sudo apt-get install -y libcurl4-openssl-dev
echo "~/.local/bin" >> $GITHUB_PATH
- name: Setup Conan
run: conan profile detect
- name: Build
run: conan create -o "influxdb-cxx/*":boost=${{ matrix.boost }} -o "influxdb-cxx/*":tests=True --build=missing .


build_windows:
runs-on: windows-latest
strategy:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ jobs:
- name: Install dependencies
run: |
script/ci_setup.sh
apt-get install -y libboost-system-dev
add-apt-repository ppa:mhier/libboost-latest
apt-get update
apt-get install -y boost1.83
- name: CodeQL Initialization
uses: github/codeql-action/init@v2
with:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/systemtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ jobs:
- name: Setup
run: |
script/ci_setup.sh
apt-get install -y libboost-system-dev
add-apt-repository ppa:mhier/libboost-latest
apt-get update
apt-get install -y boost1.83
- name: Build
run: |
cmake --preset conan-release
Expand Down
82 changes: 7 additions & 75 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,93 +1,25 @@
import re
import os
from conan import ConanFile
from conan.tools.files import load, copy, collect_libs
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps
from conan.errors import ConanInvalidConfiguration


class InfluxdbCxxConan(ConanFile):
name = "influxdb-cxx"
license = "MIT"
author = "offa <offa@github>"
url = "https://github.com/offa/influxdb-cxx"
hompage = url
description = "InfluxDB C++ client library."
topics = ("influxdb", "influxdb-client")
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps", "CMakeToolchain"

options = {
"shared": [True, False],
"tests": [True, False],
"system": [True, False],
"boost": [True, False]
}
default_options = {
"shared": False,
"tests": False,
"tests": True,
"system": False,
"boost": True,
"boost/*:shared": True,
}
exports = ["LICENSE"]
exports_sources = ("CMakeLists.txt", "src/*", "include/*", "test/*",
"cmake/*", "3rd-party/*")

def set_version(self):
cmake_lists_content = load(
self, os.path.join(self.recipe_folder, "CMakeLists.txt"))
project_match = re.search(r'project\s*\((.+?)\)', cmake_lists_content,
re.DOTALL)

if not project_match:
raise ConanInvalidConfiguration(
"No valid project() statement found in CMakeLists.txt")

project_params = project_match.group(1).split()
version_string = project_params[project_params.index("VERSION") + 1]

if not re.search(r'\d+\.\d+\.\d+(?:\.\d)?', version_string):
raise ConanInvalidConfiguration(
"No valid version found in CMakeLists.txt")

self.version = version_string
self.output.info(
f"Project version from CMakeLists.txt: '{self.version}'")

def requirements(self):
self.requires("cpr/1.10.0")
self.requires("cpr/1.10.5")
if not self.options.system and self.options.boost:
self.requires("boost/1.81.0")
self.requires("boost/1.85.0")
if self.options.tests:
self.requires("catch2/3.3.1")
self.requires("trompeloeil/43")

def generate(self):
tc = CMakeToolchain(self)
tc.cache_variables["INFLUXCXX_TESTING"] = self.options.tests
tc.cache_variables["INFLUXCXX_WITH_BOOST"] = self.options.boost
tc.generate()

deps = CMakeDeps(self)
deps.generate()

def build(self):
cmake = self._configure_cmake()
cmake.build()

if self.options.tests:
cmake.test()

def package(self):
cmake = self._configure_cmake()
cmake.install()
copy(self, pattern="LICENSE", dst="licenses", src=self.source_folder)

def package_info(self):
self.cpp_info.libs = collect_libs(self)
self.cpp_info.set_property("cmake_file_name", "InfluxDB")
self.cpp_info.set_property("cmake_target_name", "InfluxData::InfluxDB")

def _configure_cmake(self):
cmake = CMake(self)
cmake.configure()
return cmake
self.requires("catch2/3.7.1")
self.requires("trompeloeil/48")
9 changes: 5 additions & 4 deletions script/ci_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

set -ex

export DEBIAN_FRONTEND=noninteractive
export PATH=$HOME/.local/bin:$PATH
apt-get update
apt-get install -y python3-pip libssl-dev libcurl4-openssl-dev
pip3 install -U conan
apt-get install -y pipx
pipx install conan
conan profile detect

mkdir -p build && cd build

conan profile detect

if [[ "${CXX}" == clang* ]]
then
STDLIB_ENV="CXXFLAGS=\"-stdlib=libc++\""
Expand Down
1 change: 1 addition & 0 deletions script/ci_testdeploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -ex
PID=$$
BASEPATH=/tmp/influx-test-${PID}
BUILD_TYPE="Release"
export PATH=$HOME/.local/bin:$PATH

echo "perform deployment test in ${BASEPATH}"
mkdir -p ${BASEPATH}/influxdb-cxx
Expand Down