From 2dda29eb7a5831afb90111fdb13cb8c531fe3ac8 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Wed, 17 Jan 2024 10:48:42 +0100 Subject: [PATCH] Update to use common build architecture --- .github/workflows/conan-package.yml | 159 +++--------------- .../workflows/requirements-conan-package.txt | 2 - .github/workflows/requirements-runner.txt | 0 conandata.yml | 3 + conanfile.py | 14 +- 5 files changed, 41 insertions(+), 137 deletions(-) delete mode 100644 .github/workflows/requirements-conan-package.txt create mode 100644 .github/workflows/requirements-runner.txt create mode 100644 conandata.yml diff --git a/.github/workflows/conan-package.yml b/.github/workflows/conan-package.yml index 6539853..9aa6004 100644 --- a/.github/workflows/conan-package.yml +++ b/.github/workflows/conan-package.yml @@ -1,162 +1,59 @@ ---- name: conan-package -# Exports the recipe, sources and binaries for Mac, Windows and Linux and upload these to the server such that these can -# be used downstream. -# -# It should run on pushes against main or CURA-* branches, but it will only create the binaries for main and release branches - on: - workflow_dispatch: - inputs: - # FIXME: Not yet implemented - conan_id: - required: false - type: string - description: 'The full conan package ID, e.g. "pyarcus/1.2.3@ultimaker/stable"' - create_latest_alias: - required: true - default: false - type: boolean - description: 'Create latest alias' - create_binaries_windows: - required: true - default: false - type: boolean - description: 'create binaries Windows' - create_binaries_linux: - required: true - default: false - type: boolean - description: 'create binaries Linux' - create_binaries_macos: - required: true - default: false - type: boolean - description: 'create binaries Macos' - - push: - paths: - - 'python/**' - - 'include/**' - - 'src/**' - - 'test_package/**' - - 'cmake/**' - - 'conanfile.py' - - 'conandata.yml' - - 'CMakeLists.txt' - - '.github/workflows/conan-package.yml' - - '.github/workflows/requirements*' - branches: - - main - - master - - 'CURA-*' - - '[0-9].[0-9]' - - '[0-9].[0-9][0-9]' - tags: - - '[0-9].[0-9].[0-9]*' - - '[0-9].[0-9][0-9].[0-9]*' + push: + paths: + - 'src/**' + - 'test_package/**' + - 'include/**' + - 'cmake/**' + - 'conanfile.py' + - 'CMakeLists.txt' + - '.github/workflows/conan-package.yml' + - '.github/workflows/requirements*' + - 'conandata.yml' + - '.gitattributes' + branches: + - main + - 'CURA-*' + - 'PP-*' + - '[0-9].[0-9]*' + - '[0-9].[0-9][0-9]*' jobs: conan-recipe-version: - uses: ultimaker/cura/.github/workflows/conan-recipe-version.yml@main + uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-version.yml@main with: project_name: pyarcus conan-package-export: needs: [ conan-recipe-version ] - uses: ultimaker/cura/.github/workflows/conan-recipe-export.yml@main + 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 }} - runs_on: 'ubuntu-20.04' - python_version: '3.10.x' - conan_logging_level: 'info' - secrets: inherit - - conan-package-create-windows: - if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch)) || (github.event_name == 'workflow_dispatch' && inputs.create_binaries_windows) }} - needs: [ conan-recipe-version, conan-package-export ] - - uses: ultimaker/cura/.github/workflows/conan-package-create.yml@main - with: - project_name: ${{ needs.conan-recipe-version.outputs.project_name }} - recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} - build_id: 4 - build_info: false - runs_on: 'windows-2022' - python_version: '3.10.x' - conan_config_branch: '' - conan_logging_level: 'info' secrets: inherit conan-package-create-macos: - if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch)) || (github.event_name == 'workflow_dispatch' && inputs.create_binaries_macos) }} needs: [ conan-recipe-version, conan-package-export ] - - uses: ultimaker/cura/.github/workflows/conan-package-create.yml@main + if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }} + uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-macos.yml@main with: - project_name: ${{ needs.conan-recipe-version.outputs.project_name }} recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} - build_id: 3 - build_info: false - runs_on: 'macos-11' - python_version: '3.10.x' - conan_logging_level: 'info' secrets: inherit - - conan-package-create-linux-modern: - if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch)) || (github.event_name == 'workflow_dispatch' && inputs.create_binaries_linux) }} - needs: [ conan-recipe-version, conan-package-export ] - uses: ultimaker/cura/.github/workflows/conan-package-create.yml@main + conan-package-create-windows: + needs: [ conan-recipe-version, conan-package-export ] + if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }} + uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-windows.yml@main with: - project_name: ${{ needs.conan-recipe-version.outputs.project_name }} recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} - build_id: 2 - build_info: false - runs_on: 'ubuntu-22.04' - python_version: '3.10.x' - conan_logging_level: 'info' secrets: inherit conan-package-create-linux: - if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch)) || (github.event_name == 'workflow_dispatch' && inputs.create_binaries_linux) }} needs: [ conan-recipe-version, conan-package-export ] - - uses: ultimaker/cura/.github/workflows/conan-package-create.yml@main + if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }} + uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-linux.yml@main with: - project_name: ${{ needs.conan-recipe-version.outputs.project_name }} recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} - build_id: 1 - build_info: false - runs_on: 'ubuntu-20.04' - python_version: '3.10.x' - conan_logging_level: 'info' - secrets: inherit - - notify-export: - if: ${{ always() }} - needs: [ conan-recipe-version, conan-package-export ] - - uses: ultimaker/cura/.github/workflows/notify.yml@main - with: - success: ${{ contains(join(needs.*.result, ','), 'success') }} - success_title: "New Conan recipe exported in ${{ github.repository }}" - success_body: "Exported ${{ needs.conan-recipe-version.outputs.recipe_id_full }}" - failure_title: "Failed to export Conan Export in ${{ github.repository }}" - failure_body: "Failed to exported ${{ needs.conan-recipe-version.outputs.recipe_id_full }}" - secrets: inherit - - notify-create: - if: ${{ always() && ((github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch)) || (github.event_name == 'workflow_dispatch' && inputs.create_binaries_linux)) }} - needs: [ conan-recipe-version, conan-package-create-macos, conan-package-create-windows, conan-package-create-linux, conan-package-create-linux-modern ] - - uses: ultimaker/cura/.github/workflows/notify.yml@main - with: - success: ${{ contains(join(needs.*.result, ','), 'success') }} - success_title: "New binaries created in ${{ github.repository }}" - success_body: "Created binaries for ${{ needs.conan-recipe-version.outputs.recipe_id_full }}" - failure_title: "Failed to create binaries in ${{ github.repository }}" - failure_body: "Failed to created binaries for ${{ needs.conan-recipe-version.outputs.recipe_id_full }}" secrets: inherit diff --git a/.github/workflows/requirements-conan-package.txt b/.github/workflows/requirements-conan-package.txt deleted file mode 100644 index 790edfb..0000000 --- a/.github/workflows/requirements-conan-package.txt +++ /dev/null @@ -1,2 +0,0 @@ -conan -sip diff --git a/.github/workflows/requirements-runner.txt b/.github/workflows/requirements-runner.txt new file mode 100644 index 0000000..e69de29 diff --git a/conandata.yml b/conandata.yml new file mode 100644 index 0000000..d9079d7 --- /dev/null +++ b/conandata.yml @@ -0,0 +1,3 @@ +version: "5.4.0-alpha.0" +requirements: + - "arcus/5.3.1" diff --git a/conanfile.py b/conanfile.py index 3aca4ea..aa2c8d8 100644 --- a/conanfile.py +++ b/conanfile.py @@ -6,9 +6,9 @@ from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout from conan.tools.env import VirtualBuildEnv -from conan.tools.files import copy +from conan.tools.files import copy, update_conandata from conan.tools.microsoft import check_min_vs, is_msvc, is_msvc_static_runtime -from conan.tools.scm import Version +from conan.tools.scm import Version, Git required_conan_version = ">=1.58.0" @@ -42,7 +42,12 @@ class ArcusConan(ConanFile): def set_version(self): if not self.version: - self.version = "5.4.0-alpha" + build_meta = "" if self.develop else "+source" + self.version = self.conan_data["version"] + build_meta + + def export(self): + git = Git(self) + update_conandata(self, {"version": self.version, "commit": git.get_commit()}) @property def _min_cppstd(self): @@ -65,8 +70,9 @@ def export_sources(self): copy(self, "*", path.join(self.recipe_folder, "python"), path.join(self.export_sources_folder, "python")) def requirements(self): + for req in self.conan_data["requirements"]: + self.requires(req) self.requires("protobuf/3.21.9", transitive_headers=True) - self.requires("arcus/5.3.1") self.requires("cpython/3.10.4") # Maybe place this in build_requirements as well self.requires("zlib/1.2.12")