diff --git a/.github/workflows/conan_ci.yml b/.github/workflows/conan_ci.yml new file mode 100644 index 00000000..110aa207 --- /dev/null +++ b/.github/workflows/conan_ci.yml @@ -0,0 +1,49 @@ +name: Conan CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + + - name: Install system packages + run: | + sudo apt-get update + sudo apt-get install -y ninja-build pkg-config python3-pip build-essential + + - name: Install Meson and Conan + run: | + pip install --upgrade pip + pip install meson==1.3.2 conan==2.3.2 + + - name: Detect Conan profile + run: conan profile detect + + - name: Install dependencies + run: conan install . --profile default --build=missing + + - name: Build + run: | + meson setup builddir + meson compile -C builddir + + - name: Test + run: meson test -C builddir + + - name: Package + run: conan create . --name=pizza_test --version=1.2.7 diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 00000000..93c66166 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,51 @@ +from conan import ConanFile +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.files import copy +import os + +class PizzaTestConan(ConanFile): + name = "pizza_test" + version = "1.2.7" + license = "MPL-2.0" + author = "Fossil Logic " + url = "https://github.com/fossillogic/fossil-test" + description = "Unit testing framework for software projects" + topics = ("testing", "mocking", "framework") + + settings = "os", "compiler", "build_type", "arch" + options = {"shared": [True, False]} + default_options = {"shared": False} + + exports_sources = "code/**", "meson.build", "meson.options" + generators = "PkgConfigDeps" + + def layout(self): + """Define a basic build/source folder layout""" + self.folders.source = "." + self.folders.build = "builddir" + + def generate(self): + """Generate Meson toolchain files""" + tc = MesonToolchain(self) + tc.generate() + + def build(self): + """Configure and build the project using Meson""" + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + """Install headers and libraries into package folder""" + meson = Meson(self) + meson.install() + + # Ensure headers are included even if not installed by Meson + copy(self, "*.h", + src="code/logic/fossil/pizza", + dst=os.path.join(self.package_folder, "include", "fossil", "pizza")) + + def package_info(self): + """Set information for consumers of the package""" + self.cpp_info.libs = ["pizza_test"] + self.cpp_info.includedirs = ["include"]