From c2164247a71f86dcdcac661e4029398e72f4d58d Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Thu, 14 Dec 2023 16:16:33 +0100 Subject: [PATCH] Update Conan and GitHub workflows Implemented significant changes to the Conan file and GitHub workflow files in order to increase stability and maintainability. The Conan file now fetches versions and requirements from a new data source, while unnecessary or redundant code in the workflow files has been removed or simplified. This ensures smoother implementation and easier troubleshooting for future needs. Contributes to CURA-11440 --- .github/workflows/benchmark.yml | 150 +++------------------- .github/workflows/conan-package.yml | 110 ++-------------- .github/workflows/gcodeanalyzer.yml | 122 +++++++++--------- .github/workflows/requirements-runner.txt | 0 .github/workflows/unit-test-post.yml | 13 ++ .github/workflows/unit-test.yml | 128 +++--------------- CMakeLists.txt | 4 +- conandata.yml | 5 + conanfile.py | 39 +++--- 9 files changed, 154 insertions(+), 417 deletions(-) create mode 100644 .github/workflows/requirements-runner.txt create mode 100644 .github/workflows/unit-test-post.yml create mode 100644 conandata.yml diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index e3b80ad8ce..adb24aa2ff 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -1,4 +1,5 @@ name: Benchmark + on: push: paths: @@ -6,11 +7,9 @@ on: - 'src/**' - 'benchmark/**' - '.github/workflows/benchmark.yml' - - '.github/workflows/requirements-conan-package.txt' branches: - main - tags: - - '[0-9].[0-9].[0-9]*' + pull_request: types: [ opened, reopened, synchronize ] paths: @@ -18,153 +17,42 @@ on: - 'src/**' - 'benchmark/**' - '.github/workflows/benchmark.yml' - - '.github/workflows/requirements-conan-package.txt' branches: - main - 'CURA-*' + - 'PP-*' - '[0-9]+.[0-9]+' - tags: - - '[0-9]+.[0-9]+.[0-9]+' permissions: contents: write deployments: write 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: info - CONAN_NON_INTERACTIVE: 1 + CONAN_LOGIN_USERNAME: ${{ secrets.CONAN_USER }} + CONAN_PASSWORD: ${{ secrets.CONAN_PASS }} + jobs: check_actor: - runs-on: ubuntu-latest - outputs: - proceed: ${{ steps.skip_check.outputs.proceed }} - steps: - - id: skip_check - run: | - if [[ "${{ github.actor }}" == *"[bot]"* ]]; then - echo "proceed=true" >> $GITHUB_OUTPUT - elif [[ "${{ github.event.pull_request }}" == "" ]]; then - echo "proceed=true" >> $GITHUB_OUTPUT - elif [[ "${{ github.event.pull_request.head.repo.fork }}" == "false" ]]; then - echo "proceed=true" >> $GITHUB_OUTPUT - else - echo "proceed=false" >> $GITHUB_OUTPUT - fi - shell: bash + uses: ultimaker/cura-workflows/.github/workflows/check-actor.yml@main + secrets: inherit conan-recipe-version: needs: [ check_actor ] if: ${{ needs.check_actor.outputs.proceed == 'true' }} - uses: ultimaker/cura/.github/workflows/conan-recipe-version.yml@main + uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-version.yml@main with: project_name: curaengine benchmark: needs: [ conan-recipe-version ] - name: Run C++ benchmark - runs-on: ubuntu-22.04 - steps: - - name: Checkout CuraEngine - uses: actions/checkout@v3 - - - name: Setup Python and pip - uses: actions/setup-python@v4 - with: - python-version: '3.11.x' - architecture: 'x64' - cache: 'pip' - cache-dependency-path: .github/workflows/requirements-conan-package.txt - - - name: Cache Benchmark library - uses: actions/cache@v1 - with: - path: ./cache - key: ${{ runner.os }}-googlebenchmark-v1.5.0 - - - name: Install Python requirements and Create default Conan profile - run: | - pip install -r .github/workflows/requirements-conan-package.txt - - # NOTE: Due to what are probably github issues, we have to remove the cache and reconfigure before the rest. - # This is maybe because grub caches the disk it uses last time, which is recreated each time. - - name: Install Linux system requirements - if: ${{ runner.os == 'Linux' }} - run: | - sudo rm /var/cache/debconf/config.dat - sudo dpkg --configure -a - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - sudo apt update - sudo apt upgrade - sudo apt install build-essential checkinstall libegl-dev 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 libxkbcommon-x11-dev pkg-config -y - - - name: Install GCC-132 on ubuntu - run: | - sudo apt install g++-13 gcc-13 -y - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 13 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 13 - - - name: Create the default Conan profile - run: conan profile new default --detect - - - name: Get Conan configuration - run: | - conan config install https://github.com/Ultimaker/conan-config.git - conan config install https://github.com/Ultimaker/conan-config.git -a "-b runner/${{ runner.os }}/${{ runner.arch }}" - - - name: Use Conan download cache (Bash) - if: ${{ runner.os != 'Windows' }} - run: conan config set storage.download_cache="$HOME/.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: Install dependencies - run: conan install . ${{ needs.conan-recipe-version.outputs.recipe_id_full }} -o enable_benchmarks=True -s build_type=Release --build=missing --update -g GitHubActionsRunEnv -g GitHubActionsBuildEnv - - - name: Upload the Dependency package(s) - run: conan upload "*" -r cura --all -c - - - name: Set Environment variables from Conan install (bash) - if: ${{ runner.os != 'Windows' }} - run: | - . ./activate_github_actions_runenv.sh - . ./activate_github_actions_buildenv.sh - working-directory: build/Release/generators - - - name: Build CuraEngine and tests - run: | - cmake --preset release - cmake --build --preset release - - - name: Run benchmark CuraEngine - id: run-test - run: ./benchmarks --benchmark_format=json --benchmark_out=benchmark_result.json - working-directory: build/Release/benchmark - - - name: Store benchmark result - uses: benchmark-action/github-action-benchmark@v1 - with: - name: C++ Benchmark - output-file-path: build/Release/benchmark/benchmark_result.json - gh-repository: github.com/Ultimaker/CuraEngineBenchmarks - gh-pages-branch: main - benchmark-data-dir-path: dev/bench - tool: 'googlecpp' - github-token: ${{ secrets.CURA_BENCHMARK_PAT }} - auto-push: true - # alert-threshold: '175%' - # summary-always: true - # comment-on-alert: true - max-items-in-chart: 250 + uses: ultimaker/cura-workflows/.github/workflows/benchmark.yml@main + with: + recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} + conan_extra_args: "-o curaengine:enable_benchmarks=True" + benchmark_cmd: "benchmark/benchmarks --benchmark_format=json --benchmark_out=benchmark_result.json" + name: "C++ Benchmark" + output_file_path: "build/Release/benchmark_result.json" + data_dir: "dev/bench" + tool: "googlecpp" + secrets: inherit diff --git a/.github/workflows/conan-package.yml b/.github/workflows/conan-package.yml index 749c67ac9d..76060d3063 100644 --- a/.github/workflows/conan-package.yml +++ b/.github/workflows/conan-package.yml @@ -1,143 +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. "curaengine/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: - 'include/**' - 'src/**' - - 'cmake/**' - - 'tests/**' - 'test_package/**' - 'conanfile.py' - 'conandata.yml' - 'CMakeLists.txt' - '.github/workflows/conan-package.yml' - - '.github/worflows/requirements-conan-package.txt' branches: - main - 'CURA-*' - - '[1-9].[0-9]*' - - '[1-9].[0-9][0-9]*' + - 'PP-*' + - '[0-9].[0-9]*' + - '[0-9].[0-9][0-9]*' tags: - - '[1-9]+.[0-9]+.[0-9]*' - - '[1-9]+.[0-9]+.[0-9]' + - '[0-9]+.[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: curaengine 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-22.04' - python_version: '3.11.x' - 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 == 'true')) || (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 - runs_on: 'macos-11' - python_version: '3.11.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 == 'true' )) || (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 + 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: 4 - runs_on: 'windows-2022' - python_version: '3.11.x' - conan_config_branch: '' - 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 == 'true')) || (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: 2 - runs_on: 'ubuntu-22.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.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) || (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 ] - - 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/gcodeanalyzer.yml b/.github/workflows/gcodeanalyzer.yml index 123aa31d1b..b73d5900ad 100644 --- a/.github/workflows/gcodeanalyzer.yml +++ b/.github/workflows/gcodeanalyzer.yml @@ -5,7 +5,6 @@ on: - 'include/**' - 'src/**' - '.github/workflows/gcodeanalyzer.yml' - - '.github/workflows/requirements-conan-package.txt' branches: - main pull_request: @@ -14,62 +13,54 @@ on: - 'include/**' - 'src/**' - '.github/workflows/gcodeanalyzer.yml' - - '.github/workflows/requirements-conan-package.txt' branches: - main - 'CURA-*' + - 'PP-*' - '[0-9]+.[0-9]+' - tags: - - '[0-9]+.[0-9]+.[0-9]+' permissions: contents: write deployments: write 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: info - CONAN_NON_INTERACTIVE: 1 + CONAN_LOGIN_USERNAME: ${{ secrets.CONAN_USER }} + CONAN_PASSWORD: ${{ secrets.CONAN_PASS }} + +# TODO: Make cura-workflows/benchmark.yml generic enough to fit the gcodeanalyzer benchmark jobs: check_actor: - runs-on: ubuntu-latest - outputs: - proceed: ${{ steps.skip_check.outputs.proceed }} - steps: - - id: skip_check - run: | - if [[ "${{ github.actor }}" == *"[bot]"* ]]; then - echo "proceed=true" >> $GITHUB_OUTPUT - elif [[ "${{ github.event.pull_request }}" == "" ]]; then - echo "proceed=true" >> $GITHUB_OUTPUT - elif [[ "${{ github.event.pull_request.head.repo.fork }}" == "false" ]]; then - echo "proceed=true" >> $GITHUB_OUTPUT - else - echo "proceed=false" >> $GITHUB_OUTPUT - fi - shell: bash + uses: ultimaker/cura-workflows/.github/workflows/check-actor.yml@main + secrets: inherit conan-recipe-version: needs: [ check_actor ] if: ${{ needs.check_actor.outputs.proceed == 'true' }} - uses: ultimaker/cura/.github/workflows/conan-recipe-version.yml@main + uses: ultimaker/cura-workflows/.github/workflows/conan-recipe-version.yml@main with: project_name: curaengine gcodeanalyzer: needs: [ conan-recipe-version ] name: Run GCodeAnalyzer on the engine - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - - name: Checkout CuraEngine - uses: actions/checkout@v3 + - name: Checkout repo + uses: actions/checkout@v4 + if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} with: path: 'CuraEngine' + fetch-depth: 1 + ref: ${{ github.head_ref }} + + - name: Checkout repo PR + uses: actions/checkout@v4 + if: ${{ github.event.pull_request.head.repo.full_name != github.repository }} + with: + path: 'CuraEngine' + fetch-depth: 1 + ref: ${{ github.base_ref }} - name: Checkout GCodeAnalyzer uses: actions/checkout@v3 @@ -77,6 +68,7 @@ jobs: repository: 'Ultimaker/GCodeAnalyzer' ref: 'main' path: 'GCodeAnalyzer' + fetch-depth: 1 token: ${{ secrets.CURA_BENCHMARK_PAT }} - name: Checkout Test Models @@ -85,6 +77,7 @@ jobs: repository: 'Ultimaker/NightlyTestModels' ref: 'main' path: 'NightlyTestModels' + fetch-depth: 1 token: ${{ secrets.GITHUB_TOKEN }} - name: Determine the corresponding Cura branch @@ -104,44 +97,43 @@ jobs: repository: 'Ultimaker/Cura' ref: ${{ steps.curabranch.outputs.branch}} path: 'Cura' + fetch-depth: 1 sparse-checkout: | resources/definitions resources/extruders + - name: Sync pip requirements + run: curl -O https://raw.githubusercontent.com/Ultimaker/cura-workflows/main/.github/workflows/requirements-runner.txt + working-directory: CuraEngine/.github/workflows + - name: Setup Python and pip uses: actions/setup-python@v4 with: - python-version: '3.10.x' - architecture: 'x64' - cache: 'pip' - cache-dependency-path: CuraEngine/.github/workflows/requirements-conan-package.txt + python-version: 3.11.x + cache: pip + cache-dependency-path: CuraEngine/.github/workflows/requirements-runner.txt - name: Install Python requirements and Create default Conan profile run: | - pip install -r CuraEngine/.github/workflows/requirements-conan-package.txt + pip install -r CuraEngine/.github/workflows/requirements-runner.txt pip install wheel numpy pandas python-dateutil pytz six pip install git+https://github.com/ultimaker/libcharon@CURA-9495_analyzer_requisites#egg=charon pip install pytest pytest-benchmark - # NOTE: Due to what are probably github issues, we have to remove the cache and reconfigure before the rest. - # This is maybe because grub caches the disk it uses last time, which is recreated each time. - - name: Install Linux system requirements - if: ${{ runner.os == 'Linux' }} + - name: Install Linux system requirements for building run: | - sudo rm /var/cache/debconf/config.dat - sudo dpkg --configure -a - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - sudo apt update - sudo apt upgrade - sudo apt install build-essential checkinstall libegl-dev 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 libxkbcommon-x11-dev pkg-config -y + mkdir runner_scripts + cd runner_scripts + curl -O https://raw.githubusercontent.com/Ultimaker/cura-workflows/main/runner_scripts/ubuntu_setup.sh + chmod +x ubuntu_setup.sh + sudo ./ubuntu_setup.sh - - name: Install GCC-132 on ubuntu + - name: Setup pipeline caches run: | - sudo apt install g++-13 gcc-13 -y - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 13 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 13 + mkdir -p /home/runner/.conan/downloads + mkdir -p /home/runner/.conan/data - - name: Create the default Conan profile + - name: Create default Conan profile run: conan profile new default --detect - name: Get Conan configuration @@ -149,21 +141,32 @@ jobs: conan config install https://github.com/Ultimaker/conan-config.git conan config install https://github.com/Ultimaker/conan-config.git -a "-b runner/${{ runner.os }}/${{ runner.arch }}" - - name: Use Conan download cache (Bash) - run: conan config set storage.download_cache="$HOME/.conan/conan_download_cache" + - name: Cache Conan packages + uses: actions/cache@v3 + with: + path: /home/runner/.conan/data + key: ${{ runner.os }}-conan-data-${{ github.run_id }} + restore-keys: | + ${{ runner.os }}-conan-data- + + - name: Cache Conan downloads + uses: actions/cache@v3 + with: + path: /home/runner/.conan/downloads + key: ${{ runner.os }}-conan-downloads-${{ github.run_id }} + restore-keys: | + ${{ runner.os }}-conan-downloads- - name: Install dependencies - run: conan install . ${{ needs.conan-recipe-version.outputs.recipe_id_full }} -o enable_benchmarks=False -s build_type=Release --build=missing --update -g GitHubActionsRunEnv -g GitHubActionsBuildEnv -c tools.build:skip_test=True + run: conan install . ${{ needs.conan-recipe-version.outputs.recipe_id_full }} -s build_type=Release --build=missing --update -g GitHubActionsRunEnv -g GitHubActionsBuildEnv -c tools.build:skip_test=True working-directory: CuraEngine - - name: Upload the Dependency package(s) - run: conan upload "*" -r cura --all -c - - name: Set Environment variables from Conan install (bash) if: ${{ runner.os != 'Windows' }} run: | . ./activate_github_actions_runenv.sh . ./activate_github_actions_buildenv.sh + echo "CURA_ENGINE_SEARCH_PATH=$GITHUB_WORKSPACE/Cura/resources/definitions:$GITHUB_WORKSPACE/Cura/resources/extruders" >> $GITHUB_ENV working-directory: CuraEngine/build/Release/generators - name: Build CuraEngine and tests @@ -174,13 +177,13 @@ jobs: - name: Collect STL-files, run CuraEngine, output GCode-files run: | - export CURA_ENGINE_SEARCH_PATH=../Cura/resources/definitions:../Cura/resources/extruders for file in `ls ../NightlyTestModels/*.stl`; do ./build/Release/CuraEngine slice --force-read-parent --force-read-nondefault -v -p -j ../Cura/resources/definitions/ultimaker_s3.def.json -l $file -o ../`basename $file .stl`.gcode done working-directory: CuraEngine + # TODO: Move this to GCodeAnalyzer - name: Run GCodeAnalyzer on generated GCode files id: gcode_out run: | @@ -306,7 +309,4 @@ jobs: tool: customBiggerIsBetter github-token: ${{ secrets.CURA_BENCHMARK_PAT }} auto-push: true - # alert-threshold: '110%' - # summary-always: true - # comment-on-alert: true max-items-in-chart: 250 diff --git a/.github/workflows/requirements-runner.txt b/.github/workflows/requirements-runner.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.github/workflows/unit-test-post.yml b/.github/workflows/unit-test-post.yml new file mode 100644 index 0000000000..d916418dd4 --- /dev/null +++ b/.github/workflows/unit-test-post.yml @@ -0,0 +1,13 @@ +name: unit-test-post + +on: + workflow_run: + workflows: [ unit-test ] + types: [ completed ] + +jobs: + publish-test-results: + uses: ultimaker/cura-workflows/.github/workflows/unit-test-post.yml@main + with: + event: ${{ github.event.workflow_run.event }} + conclusion: ${{ github.event.workflow_run.conclusion }} diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 04e325df79..8879bb28a1 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -5,141 +5,53 @@ on: paths: - 'include/**' - 'src/**' - - 'cmake/**' - 'tests/**' - - 'test_package/**' - 'conanfile.py' + - 'conandata.yml' - 'CMakeLists.txt' - '.github/workflows/unit-test.yml' - - '.github/workflows/requirements-conan-package.txt' + - '.github/workflows/unit-test-post.yml' branches: - main + - 'CURA-*' + - 'PP-*' - '[0-9]+.[0-9]+' - tags: - - '[0-9]+.[0-9]+.[0-9]+' + pull_request: types: [ opened, reopened, synchronize ] paths: - 'include/**' - 'src/**' - - 'cmake/**' - 'tests/**' - - 'test_package/**' - 'conanfile.py' + - 'conandata.yml' - 'CMakeLists.txt' - '.github/workflows/unit-test.yml' - - '.github/workflows/requirements-conan-package.txt' + - '.github/workflows/unit-test-post.yml' branches: - main - - 'CURA-*' - '[0-9]+.[0-9]+' - tags: - - '[0-9]+.[0-9]+.[0-9]+' + +permissions: + contents: read 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: info - CONAN_NON_INTERACTIVE: 1 + CONAN_LOGIN_USERNAME: ${{ secrets.CONAN_USER }} + CONAN_PASSWORD: ${{ secrets.CONAN_PASS }} 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: curaengine testing: - runs-on: ubuntu-22.04 + uses: ultimaker/cura-workflows/.github/workflows/unit-test.yml@main needs: [ conan-recipe-version ] + with: + recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} + conan_extra_args: '-c tools.build:skip_test=False' + unit_test_cmd: 'ctest --output-junit engine_test.xml' + unit_test_dir: 'build/Release' + build: true - steps: - - name: Checkout CuraEngine - uses: actions/checkout@v3 - - - name: Setup Python and pip - uses: actions/setup-python@v4 - with: - python-version: '3.10.x' - architecture: 'x64' - 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 - - # NOTE: Due to what are probably github issues, we have to remove the cache and reconfigure before the rest. - # This is maybe because grub caches the disk it uses last time, which is recreated each time. - - name: Install Linux system requirements - if: ${{ runner.os == 'Linux' }} - run: | - sudo rm /var/cache/debconf/config.dat - sudo dpkg --configure -a - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y - sudo apt update - sudo apt upgrade - sudo apt install build-essential checkinstall libegl-dev 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 libxkbcommon-x11-dev pkg-config -y - - - name: Install GCC-132 on ubuntu - run: | - sudo apt install g++-13 gcc-13 -y - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 13 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 13 - - - name: Create the default Conan profile - run: conan profile new default --detect - - - name: Get Conan configuration - run: | - conan config install https://github.com/Ultimaker/conan-config.git - conan config install https://github.com/Ultimaker/conan-config.git -a "-b runner/${{ runner.os }}/${{ runner.arch }}" - - - name: Use Conan download cache (Bash) - if: ${{ runner.os != 'Windows' }} - run: conan config set storage.download_cache="$HOME/.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: Install dependencies - run: conan install . ${{ needs.conan-recipe-version.outputs.recipe_id_full }} -s build_type=Release --build=missing --update -g GitHubActionsRunEnv -g GitHubActionsBuildEnv - - - name: Upload the Dependency package(s) - run: conan upload "*" -r cura --all -c - - - name: Set Environment variables from Conan install (bash) - if: ${{ runner.os != 'Windows' }} - run: | - . ./activate_github_actions_runenv.sh - . ./activate_github_actions_buildenv.sh - working-directory: build/Release/generators - - - name: Build CuraEngine and tests - run: | - cmake --preset release - cmake --build --preset release - - - name: Run Unit Test CuraEngine - id: run-test - run: ctest --output-junit engine_test.xml - working-directory: build/Release - - - name: Publish Unit Test Results - id: test-results - uses: EnricoMi/publish-unit-test-result-action@v1 - if: ${{ always() }} - with: - files: | - **/*.xml - - - name: Conclusion - run: echo "Conclusion is ${{ fromJSON( steps.test-results.outputs.json ).conclusion }}" diff --git a/CMakeLists.txt b/CMakeLists.txt index 27fcdf5bd8..f2eec82974 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -200,7 +200,7 @@ find_package(spdlog REQUIRED) find_package(fmt REQUIRED) find_package(range-v3 REQUIRED) find_package(scripta REQUIRED) -find_package(neargye-semver REQUIRED) +find_package(semver REQUIRED) if (ENABLE_TESTING) find_package(GTest REQUIRED) @@ -216,7 +216,7 @@ target_link_libraries(_CuraEngine stb::stb boost::boost scripta::scripta - neargye-semver::neargye-semver + semver::semver curaengine_grpc_definitions::curaengine_grpc_definitions asio-grpc::asio-grpc grpc::grpc diff --git a/conandata.yml b/conandata.yml new file mode 100644 index 0000000000..b4a8b4ea0a --- /dev/null +++ b/conandata.yml @@ -0,0 +1,5 @@ +version: "5.6.1-beta.0" +requirements: + - "arcus/5.3.0" + - "curaengine_grpc_definitions/0.1.0" + - "scripta/0.1.0@ultimaker/testing" \ No newline at end of file diff --git a/conanfile.py b/conanfile.py index b3e464843a..5fc47436f1 100644 --- a/conanfile.py +++ b/conanfile.py @@ -5,7 +5,7 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import copy, mkdir +from conan.tools.files import copy, mkdir, update_conandata from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout from conan.tools.build import check_min_cppstd from conan.tools.scm import Version @@ -40,7 +40,10 @@ class CuraEngineConan(ConanFile): def set_version(self): if not self.version: - self.version = "5.6.0-beta.1" + self.version = self.conan_data["version"] + + def export(self): + update_conandata(self, {"version": self.version}) def export_sources(self): copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) @@ -60,10 +63,11 @@ def config_options(self): def configure(self): self.options["boost"].header_only = True self.options["clipper"].shared = True - self.options["protobuf"].shared = False if self.options.enable_arcus: self.options["arcus"].shared = True + if self.settings.os == "Linux": + self.options["openssl"].shared = True def validate(self): if self.settings.compiler.get_safe("cppstd"): @@ -81,23 +85,23 @@ def build_requirements(self): self.test_requires("benchmark/1.7.0") def requirements(self): - if self.options.enable_arcus: - self.requires("arcus/5.3.0") + for req in self.conan_data["requirements"]: + if "arcus" in req and not self.options.enable_arcus: + continue + self.requires(req) self.requires("asio-grpc/2.6.0") self.requires("grpc/1.50.1") - self.requires("curaengine_grpc_definitions/(latest)@ultimaker/testing") self.requires("clipper/6.4.2") self.requires("boost/1.82.0") self.requires("rapidjson/1.1.0") self.requires("stb/20200203") - self.requires("spdlog/1.10.0") - self.requires("fmt/9.0.0") + self.requires("spdlog/1.12.0") + self.requires("fmt/10.1.1") self.requires("range-v3/0.12.0") - self.requires("scripta/0.1.0@ultimaker/testing") self.requires("neargye-semver/0.3.0") self.requires("protobuf/3.21.9") self.requires("zlib/1.2.12") - self.requires("openssl/1.1.1l") + self.requires("openssl/3.2.0") def generate(self): deps = CMakeDeps(self) @@ -124,15 +128,14 @@ def generate(self): if len(dep.cpp_info.bindirs) > 0: copy(self, "*.dll", dep.cpp_info.bindirs[0], self.build_folder) if not self.conf.get("tools.build:skip_test", False, check_type=bool): - test_path = path.join(self.build_folder, "tests") + test_path = path.join(self.build_folder, "tests") if not path.exists(test_path): mkdir(self, test_path) if len(dep.cpp_info.libdirs) > 0: - copy(self, "*.dylib", dep.cpp_info.libdirs[0], path.join(self.build_folder, "tests")) - copy(self, "*.dll", dep.cpp_info.libdirs[0], path.join(self.build_folder, "tests")) + copy(self, "*.dylib", dep.cpp_info.libdirs[0], path.join(self.build_folder, "tests")) + copy(self, "*.dll", dep.cpp_info.libdirs[0], path.join(self.build_folder, "tests")) if len(dep.cpp_info.bindirs) > 0: - copy(self, "*.dll", dep.cpp_info.bindirs[0], path.join(self.build_folder, "tests")) - + copy(self, "*.dll", dep.cpp_info.bindirs[0], path.join(self.build_folder, "tests")) def layout(self): cmake_layout(self) @@ -146,9 +149,9 @@ def build(self): def package(self): ext = ".exe" if self.settings.os == "Windows" else "" - copy(self, f"CuraEngine{ext}", src = self.build_folder, dst = path.join(self.package_folder, "bin")) - copy(self, f"_CuraEngine.*", src = self.build_folder, dst = path.join(self.package_folder, "lib")) - copy(self, "LICENSE*", src = self.source_folder, dst = path.join(self.package_folder, "license")) + copy(self, f"CuraEngine{ext}", src=self.build_folder, dst=path.join(self.package_folder, "bin")) + copy(self, f"_CuraEngine.*", src=self.build_folder, dst=path.join(self.package_folder, "lib")) + copy(self, "LICENSE*", src=self.source_folder, dst=path.join(self.package_folder, "license")) def package_info(self): ext = ".exe" if self.settings.os == "Windows" else ""