Skip to content

Commit

Permalink
Publish Sentry debug-files
Browse files Browse the repository at this point in the history
Also updated the workflows to our new situation

Contributes to CURA-11482
  • Loading branch information
jellespijker committed Jan 12, 2024
1 parent 644f6ec commit 7c84c29
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 129 deletions.
152 changes: 28 additions & 124 deletions .github/workflows/conan-package.yml
Original file line number Diff line number Diff line change
@@ -1,155 +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. "arcus/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:
- 'src/**'
- 'test_package/**'
- 'include/**'
- 'cmake/**'
- 'conanfile.py'
- 'CMakeLists.txt'
- '.github/workflows/conan-package.yml'
- '.github/workflows/requirements*'
- 'conandata.yml'
- '.gitattributes'
branches:
- 'main'
- 'CURA-*'
- '[1-9]+.[0-9]+'
tags:
- '[1-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: arcus

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.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
runs_on: 'windows-2022'
python_version: '3.11.x'
conan_config_branch: ''
conan_logging_level: 'info'
secrets: inherit

conan-package-create-macos:
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
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
runs_on: 'macos-11'
python_version: '3.11.x'
conan_logging_level: 'info'
secrets: inherit

conan-package-create-linux-modern:
if: ${{ (github.event_name == 'push' && github.ref_name == 'main') || (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
runs_on: 'ubuntu-22.04'
python_version: '3.11.x'
conan_logging_level: 'info'
secrets: inherit

conan-package-create-linux:
if: ${{ (github.event_name == 'push' && github.ref_name == 'main') || (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
runs_on: 'ubuntu-20.04'
python_version: '3.11.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.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
1 change: 0 additions & 1 deletion .github/workflows/requirements-conan-package.txt

This file was deleted.

Empty file.
1 change: 1 addition & 0 deletions conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version: "5.4.0-alpha.0"
32 changes: 28 additions & 4 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
from io import StringIO
from os import path

from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import copy, AutoPackager
from conan.tools.files import copy, AutoPackager, 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
from conans.errors import ConanInvalidSystemRequirements

required_conan_version = ">=1.55.0"

Expand All @@ -24,16 +26,23 @@ class ArcusConan(ConanFile):

options = {
"shared": [True, False],
"fPIC": [True, False]
"fPIC": [True, False],
"enable_sentry": [True, False],
}
default_options = {
"shared": True,
"fPIC": True,
"enable_sentry": False,
}

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):
Expand All @@ -57,6 +66,8 @@ def export_sources(self):
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
if self.conf.get("user.curaengine:sentry_url", "", check_type=str) == "":
del self.options.enable_sentry

def configure(self):
if self.options.shared:
Expand Down Expand Up @@ -108,6 +119,19 @@ def build(self):
cmake.configure()
cmake.build()

if self.options.get_safe("enable_sentry", False):
# Upload debug symbols to sentry
sentry_project = self.conf.get("user.curaengine:sentry_project", "", check_type=str)
if sentry_project == "":
raise ConanInvalidConfiguration("sentry_project is not set")
output = StringIO()
self.run(f"sentry-cli -V", output=output)
if "sentry-cli" not in output.getvalue():
raise ConanInvalidSystemRequirements("sentry-cli is not installed")
self.output.info("Uploading debug symbols to sentry")
self.run(f"sentry-cli debug-files upload --include-sources -o {sentry_project} -p curaengine .")


def package(self):
copy(self, pattern="LICENSE*", dst="licenses", src=self.source_folder)
packager = AutoPackager(self)
Expand Down

0 comments on commit 7c84c29

Please sign in to comment.