From 39893a0faaa0c49915519af1825d27b723157a63 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Sat, 11 Nov 2023 17:22:23 +0100 Subject: [PATCH] Update conanfile.py and streamline GitHub workflow Added an `export` method in conanfile.py to update the conandata with the current version. Minor modifications were also made to the GitHub workflow, removing redundant job steps and reformatting it for clarity. Version exports are now also disabled in the 'conan-package-export-linux' job. Contributes to CURA-10831 --- .github/workflows/conan-package.yml | 80 +++++++++++------------------ conanfile.py | 5 +- 2 files changed, 33 insertions(+), 52 deletions(-) diff --git a/.github/workflows/conan-package.yml b/.github/workflows/conan-package.yml index 53f11c75a..77dd70122 100644 --- a/.github/workflows/conan-package.yml +++ b/.github/workflows/conan-package.yml @@ -1,57 +1,35 @@ ---- 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: - push: - paths: - - '*.xml.*' - - '*.sig' - - 'conanfile.py' - - '.github/workflows/conan-package.yml' - - '.github/workflows/requirements*.txt' - branches: - - main - - master - - 'CURA-*' - - '[0-9].[0-9]*' - tags: - - '[1-9]+.[0-9]+.[0-9]*' - - '[1-9]+.[0-9]+.[0-9]' + workflow_dispatch: + push: + paths: + - '*.xml.*' + - '*.sig' + - 'conanfile.py' + - '.github/workflows/conan-package.yml' + - '.github/workflows/requirements*.txt' + branches: + - main + - master + - 'CURA-*' + - '[0-9].[0-9]*' + tags: + - '[0-9]+.[0-9]+.[0-9]*' + - '[0-9]+.[0-9]+.[0-9]' +# FIXME: point to `main` once merged jobs: - conan-recipe-version: - uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-version.yml@CURA-10831 - with: - project_name: fdm_materials - - conan-package-export-linux: - needs: [ conan-recipe-version ] - uses: ultimaker/cura/.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_config_branch: 'master' - conan_logging_level: 'info' - conan_export_binaries: true - secrets: inherit - - notify-export: - if: ${{ always() }} - needs: [ conan-recipe-version, conan-package-export-linux ] + conan-recipe-version: + uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-version.yml@CURA-10831 + with: + project_name: fdm_materials - 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 + conan-package-export-linux: + needs: [ conan-recipe-version ] + uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-export.yml@CURA-10831 + with: + recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} + recipe_id_latest: ${{ needs.conan-recipe-version.outputs.recipe_id_latest }} + conan_export_binaries: false + secrets: inherit diff --git a/conanfile.py b/conanfile.py index fb97b8fdf..76cb6cf86 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,7 +1,7 @@ import os from conan import ConanFile -from conan.tools.files import copy +from conan.tools.files import copy, update_conandata from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration @@ -24,6 +24,9 @@ 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, "*.fdm_material", self.recipe_folder, self.export_sources_folder) copy(self, "*.sig", self.recipe_folder, self.export_sources_folder)