diff --git a/.github/workflows/conan-package-resources.yml b/.github/workflows/conan-package-resources.yml new file mode 100644 index 00000000000..7f9ea93a6fc --- /dev/null +++ b/.github/workflows/conan-package-resources.yml @@ -0,0 +1,39 @@ +name: conan-package-resources + +on: + push: + paths: + - '.github/workflows/conan-package-resources.yml' + - 'resources/definitions/**' + - 'resources/extruders/**' + - 'resources/intent/**' + - 'resources/meshes/**' + - 'resources/quality/**' + - 'resources/variants/**' + - 'resources/conanfile.py' + - 'resources/conandata.yml' + branches: + - 'main' + - 'CURA-*' + - 'PP-*' + - 'NP-*' + - '[0-9].[0-9]*' + - '[0-9].[0-9][0-9]*' + +env: + CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }} + CONAN_PASSWORD_CURA: ${{ secrets.CONAN_PASS }} + +jobs: + conan-recipe-version: + uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-version.yml@main + with: + project_name: cura_resources + + conan-package-export: + needs: [ conan-recipe-version ] + uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-export.yml@main + with: + recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} + recipe_id_latest: ${{ needs.conan-recipe-version.outputs.recipe_id_latest }} + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/conan-package.yml b/.github/workflows/conan-package.yml index 8faf1e27e1f..55470425d78 100644 --- a/.github/workflows/conan-package.yml +++ b/.github/workflows/conan-package.yml @@ -4,12 +4,11 @@ on: push: paths: - 'plugins/**' - - 'resources/**' - 'cura/**' - 'icons/**' - 'tests/**' - 'packaging/**' - - '.github/workflows/conan-*.yml' + - '.github/workflows/conan-package.yml' - '.github/workflows/notify.yml' - '.github/workflows/requirements-runner.txt' - 'requirements*.txt' @@ -20,6 +19,7 @@ on: - 'main' - 'CURA-*' - 'PP-*' + - 'NP-*' - '[0-9].[0-9]*' - '[0-9].[0-9][0-9]*' diff --git a/resources/conandata.yml b/resources/conandata.yml new file mode 100644 index 00000000000..4f443db7941 --- /dev/null +++ b/resources/conandata.yml @@ -0,0 +1 @@ +version: "5.8.0-alpha.0" \ No newline at end of file diff --git a/resources/conanfile.py b/resources/conanfile.py new file mode 100644 index 00000000000..65e1821d545 --- /dev/null +++ b/resources/conanfile.py @@ -0,0 +1,49 @@ +import os + +from conan import ConanFile +from conan.tools.files import copy, update_conandata +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.58.0 <2.0.0" + + +class CuraResource(ConanFile): + name = "cura_resources" + license = "" + author = "UltiMaker" + url = "https://github.com/Ultimaker/cura-private-data" + description = "Cura Resources" + topics = ("conan", "cura") + exports = "LICENSE*" + settings = "os", "compiler", "build_type", "arch" + no_copy_source = True + + def set_version(self): + if not self.version: + self.version = self.conan_data["version"] + + def export(self): + update_conandata(self, {"version": self.version}) + + def export_sources(self): + copy(self, "*", os.path.join(self.recipe_folder, "definitions"), os.path.join(self.export_sources_folder, "resources", "definitions")) + copy(self, "*", os.path.join(self.recipe_folder, "extruders"), os.path.join(self.export_sources_folder, "resources", "extruders")) + copy(self, "*", os.path.join(self.recipe_folder, "intent"), os.path.join(self.export_sources_folder, "resources", "intent")) + copy(self, "*", os.path.join(self.recipe_folder, "meshes"), os.path.join(self.export_sources_folder, "resources", "meshes")) + copy(self, "*", os.path.join(self.recipe_folder, "quality"), os.path.join(self.export_sources_folder, "resources", "quality")) + copy(self, "*", os.path.join(self.recipe_folder, "variants"), os.path.join(self.export_sources_folder, "resources", "variants")) + + def validate(self): + if Version(self.version) <= Version("4"): + raise ConanInvalidConfiguration("Only versions 5+ are support") + + def package(self): + copy(self, "*", os.path.join(self.export_sources_folder, "resources"), os.path.join(self.package_folder, "res", "resources")) + + def package_info(self): + self.cpp_info.includedirs = [] + self.cpp_info.resdirs = ["res"] + + def package_id(self): + self.info.clear()