diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 059ef365cf..ee49634a2a 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -37,10 +37,10 @@ jobs: benchmark: uses: ultimaker/cura-workflows/.github/workflows/benchmark.yml@main with: - conan_extra_args: "-o \"curaengine/*:enable_benchmarks=True\"" - benchmark_cmd: "./build/Release/benchmark/benchmarks --benchmark_format=json --benchmark_out=benchmark_result.json" + conan_extra_args: "-c tools.build:skip_test=False -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" + output_file_path: "benchmark_result.json" data_dir: "dev/bench" tool: "googlecpp" alert_threshold: "150%" diff --git a/.github/workflows/gcodeanalyzer.yml b/.github/workflows/gcodeanalyzer.yml index be45106c2c..8145b07e83 100644 --- a/.github/workflows/gcodeanalyzer.yml +++ b/.github/workflows/gcodeanalyzer.yml @@ -24,20 +24,13 @@ permissions: contents: write deployments: write -# TODO: Make cura-workflows/benchmark.yml generic enough to fit the gcodeanalyzer benchmark jobs: check_actor: 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-workflows/.github/workflows/conan-recipe-version.yml@main - gcodeanalyzer: - needs: [ conan-recipe-version ] name: Run GCodeAnalyzer on the engine runs-on: ubuntu-latest steps: @@ -64,17 +57,19 @@ jobs: fetch-depth: 1 token: ${{ secrets.GITHUB_TOKEN }} - - name: Install dependencies - run: conan install . ${{ needs.conan-recipe-version.outputs.version_full }} -s "*:build_type=Release" --build=missing --update -g VirtualRunEnv -c tools.build:skip_test=True -o with_cura_resources=True - - - name: Build CuraEngine and tests + - name: Install Python requirements run: | - source build/Release/generators/conanbuild.sh - cmake --preset release - cmake --build --preset release + pip install pandas + pip install git+https://github.com/ultimaker/libcharon@CURA-9495_analyzer_requisites#egg=charon + + - name: Install dependencies and build CuraEngine + run: conan build . -s build_type=Release --build=missing --update -g VirtualRunEnv -o "curaengine/*:with_cura_resources=True" - name: Collect STL-files, run CuraEngine, output GCode-files run: | + source build/Release/generators/conanrun.sh + echo $CURA_RESOURCES + ls $CURA_RESOURCES for file in `ls NightlyTestModels/*.stl`; do ( time ./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 ) 2> `basename $file .stl`.time @@ -83,6 +78,8 @@ jobs: # TODO: Move this to GCodeAnalyzer - name: Run GCodeAnalyzer on generated GCode files id: gcode_out + shell: python + working-directory: GCodeAnalyzer run: | import sys import os @@ -205,8 +202,6 @@ jobs: with open("../output.json", "w") as outfile: outfile.write(json.dumps(jzon)) - shell: python - working-directory: GCodeAnalyzer - name: Store benchmark result uses: benchmark-action/github-action-benchmark@v1 diff --git a/.github/workflows/lint-formatter.yml b/.github/workflows/lint-formatter.yml index 1c56380978..5316ab9599 100644 --- a/.github/workflows/lint-formatter.yml +++ b/.github/workflows/lint-formatter.yml @@ -15,3 +15,7 @@ on: jobs: lint-formatter-job: uses: ultimaker/cura-workflows/.github/workflows/lint-formatter.yml@main + with: + file_patterns: +(include|src)/**/*.+(h|hpp|c|cpp) + command: clang-format --verbose -i + commit_message: "Apply clang-format" diff --git a/.github/workflows/stress_benchmark.yml b/.github/workflows/stress_benchmark.yml index 56432c9899..a76be61f33 100644 --- a/.github/workflows/stress_benchmark.yml +++ b/.github/workflows/stress_benchmark.yml @@ -27,30 +27,19 @@ permissions: contents: write deployments: write -env: - CONAN_LOGIN_USERNAME: ${{ secrets.CONAN_USER }} - CONAN_PASSWORD: ${{ secrets.CONAN_PASS }} - jobs: check_actor: 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-workflows/.github/workflows/conan-recipe-version.yml@main - benchmark: - needs: [ conan-recipe-version ] 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" + conan_extra_args: "-c tools.build:skip_test=False -o \"curaengine/*:enable_benchmarks=True\"" benchmark_cmd: "stress_benchmark/stress_benchmark -o benchmark_result.json" name: "Stress Benchmark" - output_file_path: "build/Release/benchmark_result.json" + output_file_path: "benchmark_result.json" data_dir: "dev/stress_bench" tool: "customSmallerIsBetter" secrets: inherit diff --git a/src/LayerPlan.cpp b/src/LayerPlan.cpp index 3587bd94a7..de3594c58d 100644 --- a/src/LayerPlan.cpp +++ b/src/LayerPlan.cpp @@ -1322,7 +1322,7 @@ std::vector for (const auto& reversed_chunk : paths | ranges::views::enumerate | ranges::views::reverse | ranges::views::chunk_by( - [](const auto&path_a, const auto&path_b) + [](const auto& path_a, const auto& path_b) { return (! std::get<1>(path_a).isTravelPath()) || std::get<1>(path_b).isTravelPath(); })) @@ -2512,8 +2512,24 @@ void LayerPlan::writeGCode(GCodeExport& gcode) { ExtruderPlan& extruder_plan = extruder_plans_[extruder_plan_idx]; - const RetractionAndWipeConfig* retraction_config - = current_mesh ? ¤t_mesh->retraction_wipe_config : &storage_.retraction_wipe_config_per_extruder[extruder_plan.extruder_nr_]; + auto get_retraction_config = [&extruder_nr, this](std::shared_ptr& mesh) -> std::optional + { + if (mesh) + { + if (extruder_nr == mesh->settings.get("extruder_nr")) [[likely]] + { + return &mesh->retraction_wipe_config; + } + + // We are printing a part of a mesh with a different extruder, use this extruder settings instead (mesh-specific settings will be ignored) + return &storage_.retraction_wipe_config_per_extruder[extruder_nr]; + } + + // We have no mesh yet, a more global config should be used + return std::nullopt; + }; + + const RetractionAndWipeConfig* retraction_config = get_retraction_config(current_mesh).value_or(&storage_.retraction_wipe_config_per_extruder[extruder_plan.extruder_nr_]); coord_t z_hop_height = retraction_config->retraction_config.zHop; if (extruder_nr != extruder_plan.extruder_nr_) @@ -2697,7 +2713,7 @@ void LayerPlan::writeGCode(GCodeExport& gcode) if (path.retract) { - retraction_config = path.mesh ? &path.mesh->retraction_wipe_config : retraction_config; + retraction_config = get_retraction_config(path.mesh).value_or(retraction_config); gcode.writeRetraction(retraction_config->retraction_config); if (path.retract_for_nozzle_switch) {