Browse Source

Merge branch 'CURA-9365_fix_building_cura_main' into 5.1

Ghostkeeper 2 years ago
parent
commit
83bad98ea3

+ 0 - 4
.dockerignore

@@ -1,4 +0,0 @@
-.git
-.github
-resources/materials
-CuraEngine

+ 0 - 21
.github/workflows/ci.yml

@@ -1,21 +0,0 @@
----
-name: CI
-on:
-  push:
-    branches:
-      - master
-      - 'WIP**'
-      - '4.*'
-      - 'CURA-*'
-  pull_request:
-jobs:
-  build:
-    runs-on: ubuntu-latest
-    container: ultimaker/cura-build-environment
-    steps:
-    - name: Checkout Cura
-      uses: actions/checkout@v2
-    - name: Build
-      run: docker/build.sh
-    - name: Test
-      run: docker/test.sh

+ 114 - 0
.github/workflows/conan-package-create.yml

@@ -0,0 +1,114 @@
+name: Create and Upload Conan package
+
+on:
+    workflow_call:
+        inputs:
+            recipe_id_full:
+                required: true
+                type: string
+
+            runs_on:
+                required: true
+                type: string
+
+            python_version:
+                required: true
+                type: string
+
+            conan_config_branch:
+                required: false
+                type: string
+
+            conan_logging_level:
+                required: false
+                type: string
+
+            conan_clean_local_cache:
+                required: false
+                type: boolean
+                default: false
+
+env:
+    CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }}
+    CONAN_PASSWORD_CURA: ${{ secrets.CONAN_PASS }}
+    CONAN_LOGIN_USERNAME_CURA_CE: ${{ secrets.CONAN_USER }}
+    CONAN_PASSWORD_CURA_CE: ${{ secrets.CONAN_PASS }}
+    CONAN_LOG_RUN_TO_OUTPUT: 1
+    CONAN_LOGGING_LEVEL: ${{ inputs.conan_logging_level }}
+    CONAN_NON_INTERACTIVE: 1
+
+jobs:
+    conan-package-create:
+        runs-on: ${{ inputs.runs_on }}
+
+        steps:
+            -   name: Checkout
+                uses: actions/checkout@v3
+
+            -   name: Setup Python and pip
+                uses: actions/setup-python@v4
+                with:
+                    python-version: ${{ inputs.python_version }}
+                    cache: 'pip'
+                    cache-dependency-path: .github/workflows/requirements-conan-package.txt
+
+            -   name: Install Python requirements and Create default Conan profile
+                run: |
+                    pip install -r .github/workflows/requirements-conan-package.txt
+                    conan profile new default --detect
+
+            -   name: Use Conan download cache (Bash)
+                if: ${{ runner.os != 'Windows' }}
+                run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache"
+
+            -   name: Use Conan download cache (Powershell)
+                if: ${{ runner.os == 'Windows' }}
+                run: conan config set storage.download_cache="C:\Users\runneradmin\.conan\conan_download_cache"
+
+            -   name: Cache Conan local repository packages (Bash)
+                uses: actions/cache@v3
+                if: ${{ runner.os != 'Windows' }}
+                with:
+                    path: |
+                        $HOME/.conan/data
+                        $HOME/.conan/conan_download_cache
+                    key: conan-${{ runner.os }}-${{ runner.arch }}
+
+            -   name: Cache Conan local repository packages (Powershell)
+                uses: actions/cache@v3
+                if: ${{ runner.os == 'Windows' }}
+                with:
+                    path: |
+                        C:\Users\runneradmin\.conan\data
+                        C:\.conan
+                        C:\Users\runneradmin\.conan\conan_download_cache
+                    key: conan-${{ runner.os }}-${{ runner.arch }}
+
+            -   name: Install MacOS system requirements
+                if:  ${{ runner.os == 'Macos' }}
+                run: brew install autoconf automake ninja
+
+            -   name: Install Linux system requirements
+                if: ${{ runner.os == 'Linux' }}
+                run: sudo apt install build-essential checkinstall zlib1g-dev libssl-dev ninja-build autoconf libx11-dev libx11-xcb-dev libfontenc-dev libice-dev libsm-dev libxau-dev libxaw7-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxi-dev libxinerama-dev libxkbfile-dev libxmu-dev libxmuu-dev libxpm-dev libxrandr-dev libxrender-dev libxres-dev libxss-dev libxt-dev libxtst-dev libxv-dev libxvmc-dev libxxf86vm-dev xtrans-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-xkb-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-xinerama0-dev xkb-data libxcb-dri3-dev uuid-dev libxcb-util-dev -y
+
+            -   name: Clean Conan local cache
+                if: ${{ inputs.conan_clean_local_cache }}
+                run: conan remove "*" -f
+
+            -   name: Get Conan configuration from branch
+                if: ${{ inputs.conan_config_branch != '' }}
+                run: conan config install https://github.com/Ultimaker/conan-config.git -a "-b ${{ inputs.conan_config_branch }}"
+
+            -   name: Get Conan configuration
+                if: ${{ inputs.conan_config_branch == '' }}
+                run: conan config install https://github.com/Ultimaker/conan-config.git
+
+            -   name: Create the Packages
+                run: conan install ${{ inputs.recipe_id_full }} --build=missing --update
+
+            -   name: Upload the Package(s)
+                if: always()
+                run: |
+                    conan upload "*" -r cura --all -c
+                    conan upload "*" -r cura-ce -c

+ 105 - 0
.github/workflows/conan-package.yml

@@ -0,0 +1,105 @@
+---
+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:
+            create_binaries_windows:
+                required: true
+                default: false
+                description: 'create binaries Windows'
+            create_binaries_linux:
+                required: true
+                default: false
+                description: 'create binaries Linux'
+            create_binaries_macos:
+                required: true
+                default: false
+                description: 'create binaries Macos'
+
+    push:
+        paths:
+            - 'plugins/**'
+            - 'resources/**'
+            - 'cura/**'
+            - 'icons/**'
+            - 'tests/**'
+            - '.github/workflows/conan-*.yml'
+            - '.github/workflows/notify.yml'
+            - '.github/workflows/requirements-conan-package.txt'
+            - 'requirements*.txt'
+            - 'conanfile.py'
+            - 'conandata.yml'
+            - 'GitVersion.yml'
+        branches:
+            - main
+            - 'CURA-*'
+            - '[1-9]+.[0-9]+'
+        tags:
+            - '[1-9]+.[0-9]+.[0-9]+'
+
+jobs:
+    conan-recipe-version:
+        uses: ultimaker/cura/.github/workflows/conan-recipe-version.yml@5.1
+        with:
+            project_name: cura
+
+    conan-package-export-macos:
+        needs: [ conan-recipe-version ]
+        uses: ultimaker/cura/.github/workflows/conan-recipe-export.yml@5.1
+        with:
+            recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
+            recipe_id_latest: ${{ needs.conan-recipe-version.outputs.recipe_id_latest }}
+            recipe_id_pr: ${{ needs.conan-recipe-version.outputs.recipe_id_pr }}
+            runs_on: 'macos-10.15'
+            python_version: '3.10.4'
+            conan_config_branch: 'master'
+            conan_logging_level: 'info'
+            conan_export_binaries: true
+        secrets: inherit
+
+    conan-package-export-linux:
+        needs: [ conan-recipe-version ]
+        uses: ultimaker/cura/.github/workflows/conan-recipe-export.yml@5.1
+        with:
+            recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
+            recipe_id_latest: ${{ needs.conan-recipe-version.outputs.recipe_id_latest }}
+            recipe_id_pr: ${{ needs.conan-recipe-version.outputs.recipe_id_pr }}
+            runs_on: 'ubuntu-20.04'
+            python_version: '3.10.4'
+            conan_config_branch: 'master'
+            conan_logging_level: 'info'
+            conan_export_binaries: true
+        secrets: inherit
+
+    conan-package-export-windows:
+        needs: [ conan-recipe-version ]
+        uses: ultimaker/cura/.github/workflows/conan-recipe-export.yml@5.1
+        with:
+            recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }}
+            recipe_id_latest: ${{ needs.conan-recipe-version.outputs.recipe_id_latest }}
+            recipe_id_pr: ${{ needs.conan-recipe-version.outputs.recipe_id_pr }}
+            runs_on: 'windows-2022'
+            python_version: '3.10.4'
+            conan_config_branch: 'master'
+            conan_logging_level: 'info'
+            conan_export_binaries: true
+        secrets: inherit
+
+    notify-export:
+        if: ${{ always() }}
+        needs: [ conan-package-export-linux, conan-package-export-macos, conan-package-export-windows ]
+
+        uses: ultimaker/cura/.github/workflows/notify.yml@5.1
+        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

+ 101 - 0
.github/workflows/conan-recipe-export.yml

@@ -0,0 +1,101 @@
+name: Export Conan Recipe to server
+
+on:
+    workflow_call:
+        inputs:
+            recipe_id_full:
+                required: true
+                type: string
+
+            recipe_id_latest:
+                required: false
+                type: string
+
+            recipe_id_pr:
+                required: false
+                type: string
+
+            runs_on:
+                required: true
+                type: string
+
+            python_version:
+                required: true
+                type: string
+
+            conan_config_branch:
+                required: false
+                type: string
+
+            conan_logging_level:
+                required: false
+                type: string
+
+            conan_export_binaries:
+                required: false
+                type: boolean
+
+env:
+    CONAN_LOGIN_USERNAME_CURA: ${{ secrets.CONAN_USER }}
+    CONAN_PASSWORD_CURA: ${{ secrets.CONAN_PASS }}
+    CONAN_LOGIN_USERNAME_CURA_CE: ${{ secrets.CONAN_USER }}
+    CONAN_PASSWORD_CURA_CE: ${{ secrets.CONAN_PASS }}
+    CONAN_LOG_RUN_TO_OUTPUT: 1
+    CONAN_LOGGING_LEVEL: ${{ inputs.conan_logging_level }}
+    CONAN_NON_INTERACTIVE: 1
+
+jobs:
+    package-export:
+        runs-on: ${{ inputs.runs_on }}
+
+        steps:
+            -   name: Checkout project
+                uses: actions/checkout@v3
+
+            -   name: Setup Python and pip
+                uses: actions/setup-python@v4
+                with:
+                    python-version: ${{ inputs.python_version }}
+                    cache: 'pip'
+                    cache-dependency-path: .github/workflows/requirements-conan-package.txt
+
+            -   name: Install Python requirements and Create default Conan profile
+                run: |
+                    pip install -r .github/workflows/requirements-conan-package.txt
+                    conan profile new default --detect
+
+            -   name: Cache Conan local repository packages
+                uses: actions/cache@v3
+                with:
+                    path: $HOME/.conan/data
+                    key: ${{ runner.os }}-conan
+
+            -   name: Get Conan configuration from branch
+                if: ${{ inputs.conan_config_branch != '' }}
+                run: conan config install https://github.com/Ultimaker/conan-config.git -a "-b ${{ inputs.conan_config_branch }}"
+
+            -   name: Get Conan configuration
+                if: ${{ inputs.conan_config_branch == '' }}
+                run: conan config install https://github.com/Ultimaker/conan-config.git
+
+            -   name: Export the Package (binaries)
+                if: ${{ inputs.conan_export_binaries == 'true' }}
+                run: conan export-pkg . ${{ inputs.recipe_id_full }}
+
+            -   name: Export the Package
+                if: ${{ inputs.conan_export_binaries != 'true' && github.event_name != 'pull_request' }}
+                run: conan export . ${{ inputs.recipe_id_full }}
+
+            -   name: Create the latest alias
+                if: ${{ inputs.recipe_id_latest != '' && github.event_name != 'pull_request' }}
+                run: conan alias ${{ inputs.recipe_id_latest }} ${{ inputs.recipe_id_full }}
+
+            -   name: Create the pull request alias
+                if: ${{ inputs.recipe_id_pr != '' && github.event_name == 'pull_request' }}
+                run: conan alias ${{ inputs.recipe_id_latest }} ${{ inputs.recipe_id_full }}
+
+            -   name: Upload the Package(s)
+                run: |
+                    # Only use --all (upload binaries) for the cura repository
+                    conan upload "*" -r cura --all -c
+                    conan upload "*" -r cura-ce -c

+ 99 - 0
.github/workflows/conan-recipe-version.yml

@@ -0,0 +1,99 @@
+name: Get Conan Recipe Version
+
+on:
+    workflow_call:
+        inputs:
+            project_name:
+                required: true
+                type: string
+
+        outputs:
+            recipe_id_full:
+                description: "The full Conan recipe id: <name>/<version>@<user>/<channel>"
+                value: ${{ jobs.get-semver.outputs.recipe_id_full }}
+
+            recipe_id_latest:
+                description: "The full Conan recipe aliased (latest) id: <name>/(latest)@<user>/<channel>"
+                value: ${{ jobs.get-semver.outputs.recipe_id_latest }}
+
+            recipe_semver_full:
+                description: "The full semver <Major>.<Minor>.<Patch>-<PreReleaseTag>+<BuildMetaData>"
+                value: ${{ jobs.get-semver.outputs.semver_full }}
+
+jobs:
+    get-semver:
+
+        runs-on: ubuntu-latest
+
+        outputs:
+            recipe_id_full: ${{ inputs.project_name }}/${{ steps.git-tool.outputs.Major }}.${{ steps.git-tool.outputs.Minor }}.${{ steps.git-tool.outputs.Patch }}-${{ steps.git-tool.outputs.PreReleaseLabel }}+${{ steps.git-tool.outputs.BuildMetaData }}@${{ steps.get-conan-broadcast-data.outputs.user }}/${{ steps.get-conan-broadcast-data.outputs.channel }}
+            recipe_id_latest: ${{ steps.latest-alias.outputs.recipe_id_latest }}
+            recipe_id_pr: ${{ steps.pr-alias.outputs.recipe_id_pr }}
+            semver_full: ${{ steps.git-tool.outputs.Major }}.${{ steps.git-tool.outputs.Minor }}.${{ steps.git-tool.outputs.Patch }}-${{ steps.git-tool.outputs.PreReleaseLabel }}+${{ steps.git-tool.outputs.BuildMetaData }}
+            user: ${{ steps.get-conan-broadcast-data.outputs.user }}
+            channel: ${{ steps.get-conan-broadcast-data.outputs.channel }}
+
+        steps:
+            -   name: Checkout repo
+                uses: actions/checkout@v3
+                with:
+                    ref: ${{ github.head_ref }}
+                    fetch-depth: 0
+
+            -   name: Install GitVersion
+                uses: gittools/actions/gitversion/setup@v0.9.13
+                with:
+                    versionSpec: '5.x'
+
+            -   name: GitTools
+                id: git-tool
+                uses: gittools/actions/gitversion/execute@v0.9.13
+
+            -   id: get-conan-broadcast-data
+                name: Get Conan broadcast data
+                run: |
+                    if [ "${{ github.ref_type == 'tag' && github.ref_name == '5.1' }}" = "true" ]; then
+                      # tagged commits on a release branch are actual released version and should have no user and channel
+                      # name/major.minor.patch@_/_
+                      # FIXME: For release branches: maybe rename the branch to release/**
+                      echo '::set-output name=user::_'
+                      echo '::set-output name=channel::_'
+                    elif [ "${{ github.ref_name == 'main' }}" = "true" ]; then
+                      # commits on main are alpha's (nightlies) and are considered stable
+                      # name/major.minor.patch-alpha+build@ultimaker/stable
+                      echo ${{ github.repository_owner }} | awk '{print "::set-output name=user::"tolower($0)}'
+                      echo '::set-output name=channel::stable'
+                    elif [ "${{ github.ref_name == '5.1' }}" = "true" ]; then
+                      # commits on release branches are beta's and are considered stable
+                      # name/major.minor.patch-beta+build@ultimaker/stable
+                      # FIXME: For release branches: maybe rename the branch to release/**
+                      echo ${{ github.repository_owner }} | awk '{print "::set-output name=user::"tolower($0)}'
+                      echo '::set-output name=channel::stable'                    
+                    else
+                      # commits on other branches are considered unstable and for development purposes only
+                      # Use the Cura branch naming scheme CURA-1234_foo_bar
+                      # we use the first 9 characters of the branch name
+                      # name/major.minor.patch-beta+build@ultimaker/cura_<jira_number>
+                      echo ${{ github.repository_owner }} | awk '{print "::set-output name=user::"tolower($0)}'
+                      branch=${{ github.ref_name }}
+                      sanitized_branch="${branch//-/_}"
+                      echo $sanitized_branch | awk '{print "::set-output name=channel::"substr(tolower($0),0,9)}'
+                    fi
+
+            -   name: Get pull request alias
+                id: pr-alias
+                run: |
+                    if [ "${{ github.event_name == 'pull_request' }}" = "true" ]; then
+                      # pull request events are considered unstable and are for testing purposes
+                      # name/latest@ultimaker/pr_<number>
+                      echo "::set-output name=recipe_id_pr::${{ inputs.project_name }}/latest@${{ steps.get-conan-broadcast-data.outputs.user }}/pr_$PR_NUMBER"
+                    else
+                      echo "::set-output name=recipe_id_pr::''"
+                    fi
+                env:
+                    PR_NUMBER: ${{ github.event.issue.number }}
+
+            -   name: Get latest alias
+                id: latest-alias
+                run: |
+                    echo "::set-output name=recipe_id_latest::${{ inputs.project_name }}/latest@${{ steps.get-conan-broadcast-data.outputs.user }}/${{ steps.get-conan-broadcast-data.outputs.channel }}"

+ 1 - 1
.github/workflows/no-response.yml

@@ -7,7 +7,7 @@ on:
     types: [created]
   schedule:
     # Schedule for ten minutes after the hour, every hour
-    - cron: '10 * * * *'
+    - cron: '* */12 * * *'
 
 # By specifying the access of one of the scopes, all of those that are not
 # specified are set to 'none'.

+ 54 - 0
.github/workflows/notify.yml

@@ -0,0 +1,54 @@
+name: Get Conan Recipe Version
+
+on:
+    workflow_call:
+        inputs:
+            success:
+                required: true
+                type: boolean
+
+            success_title:
+                required: true
+                type: string
+
+            success_body:
+                required: true
+                type: string
+
+            failure_title:
+                required: true
+                type: string
+
+            failure_body:
+                required: true
+                type: string
+
+
+jobs:
+    slackNotification:
+        name: Slack Notification
+
+        runs-on: ubuntu-latest
+
+        steps:
+            -   name: Slack notify on-success
+                if: ${{ inputs.success }}
+                uses: rtCamp/action-slack-notify@v2
+                env:
+                    SLACK_USERNAME: ${{ github.repository }}
+                    SLACK_COLOR: #00ff00
+                    SLACK_ICON: https://github.com/Ultimaker/Cura/blob/main/icons/cura-128.png?raw=true
+                    SLACK_TITLE: ${{ inputs.success_title }}
+                    SLACK_MESSAGE: ${{ inputs.success_body }}
+                    SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
+
+            -   name: Slack notify on-failure
+                if: ${{ !inputs.success }}
+                uses: rtCamp/action-slack-notify@v2
+                env:
+                    SLACK_USERNAME: ${{ github.repository }}
+                    SLACK_COLOR: #ff0000
+                    SLACK_ICON: https://github.com/Ultimaker/Cura/blob/main/icons/cura-128.png?raw=true
+                    SLACK_TITLE: ${{ inputs.failure_title }}
+                    SLACK_MESSAGE: ${{ inputs.failure_body }}
+                    SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

+ 2 - 0
.github/workflows/requirements-conan-package.txt

@@ -0,0 +1,2 @@
+conan
+sip==6.5.1

+ 10 - 1
.gitignore

@@ -89,4 +89,13 @@ CuraEngine
 #Prevents import failures when plugin running tests
 plugins/__init__.py
 
-/venv
+venv/
+build/
+dist/
+conaninfo.txt
+conan.lock
+conan_imports_manifest.txt
+conanbuildinfo.txt
+graph_info.json
+Ultimaker-Cura.spec
+/.run/

Some files were not shown because too many files changed in this diff