mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-16 13:32:44 +00:00
# Description
Add `--strict` for CI and scripted pipelines, and a structured
`warnings`
array in `result.json`.
## `--strict`
A NON_CRITICAL slicing warning is logged and the slice succeeds: return
code
`0`, G-code written. That suits interactive use, but a pipeline then
ships a
slice with a warning nobody saw. With `--strict`, such a warning fails
the run
with `CLI_SLICING_ERROR` before the G-code is exported. Without the
flag,
nothing changes.
In FFF the warning that reaches this path is "support needed but
disabled"
(`PrintObject::generate_support_material`). `--no-check` skips that
check, so
`--strict --no-check` is rejected with `CLI_INVALID_PARAMS`.
`--strict` is read before any work, so it doesn't depend on argument
order and
`result.json` reports it for early failures as well.
## `result.json`
Two new top-level fields:
- `warnings`: `[{"class", ...details}]`. One class is wired:
`slicing_warning_non_critical` with `plate_id` and `text`, recorded
whenever
such a warning fires, with or without `--strict`. The array also fills
on
runs that succeed, so `return_code` stays the verdict.
- `strict_mode`: whether `--strict` was on.
`record_exit_reson` writes `result.json` on Linux only, so both fields
exist
only there. The non-zero exit works on every platform.
## Tests
- `tests/fff_print/test_support_material.cpp` (all platforms): an
overhang
sliced with support off raises the NON_CRITICAL support-needed status,
and
the no-check flag suppresses it.
- `tests/cli/test_cli_strict.sh` (Linux only): runs `orca-slicer`
without
flags, with `--strict`, and with `--strict --no-check`, and checks the
shell
status and `result.json` of each. It runs the built binary, so it
carries the
`RequiresApp` label, which `scripts/run_unit_tests.sh` excludes because
the
unit-test job only receives `build/tests`. Run it with
`ctest --test-dir build/tests -C Release -L RequiresApp`.
- CI: `unit_tests.yml` now passes `Release` on Linux too.
`build_linux.sh`
configures Ninja Multi-Config, and without a config ctest drops the
labels of
plain `add_test()` tests, so this test ran as "Not Run" instead of being
excluded. The docs that assumed Linux was single-config are corrected
too.
Built and run locally on Linux (GCC 14) on current `main`: both tests
pass,
and the touched files compile clean under Clang with `-Werror`.
80 lines
2.7 KiB
YAML
80 lines
2.7 KiB
YAML
name: Unit Tests
|
|
|
|
# Download a platform's test artifact, run ctest, and upload the JUnit
|
|
# results for aggregation. Called once per arch from build_all.yml.
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
os:
|
|
required: true
|
|
type: string
|
|
artifact:
|
|
description: Test artifact uploaded by the build leg
|
|
required: true
|
|
type: string
|
|
test-dir:
|
|
description: Built tests dir; defaults to build/tests, override for arch-separated builds
|
|
required: false
|
|
type: string
|
|
default: build/tests
|
|
|
|
jobs:
|
|
unit_tests:
|
|
# Static "Unit Tests"; the per-arch label is the caller's job name, so the
|
|
# graph shows e.g. "Windows x64 / Unit Tests".
|
|
name: Unit Tests
|
|
runs-on: ${{ inputs.os }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
# Tests reach outside tests/ at runtime: tests/data (TEST_DATA_DIR) and
|
|
# resources/profiles (PROFILES_DIR) by baked-in absolute path, plus
|
|
# resources/info (nozzle data) via resources_dir() during a real slice.
|
|
# Check out all of resources/ so no test hits a missing-file path.
|
|
sparse-checkout: |
|
|
.github
|
|
scripts
|
|
tests
|
|
resources
|
|
- name: Apt-Install Dependencies
|
|
if: runner.os == 'Linux' && !vars.SELF_HOSTED
|
|
uses: ./.github/actions/apt-install-deps
|
|
- name: Restore Test Artifact
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
name: ${{ inputs.artifact }}
|
|
- uses: lukka/get-cmake@latest
|
|
with:
|
|
cmakeVersion: "~4.3.0" # use most recent 4.3.x version
|
|
useLocalCache: true
|
|
useCloudCache: true
|
|
- name: Unpackage and Run Unit Tests
|
|
timeout-minutes: 20
|
|
shell: bash
|
|
run: |
|
|
tar -xvf build_tests.tar
|
|
# Every platform builds with a multi-config generator (build_linux.sh uses Ninja
|
|
# Multi-Config), so ctest needs the config: without it, plain add_test() tests
|
|
# lose their labels and report "Not Run".
|
|
scripts/run_unit_tests.sh "${{ inputs.test-dir }}" Release
|
|
- name: Upload Test Logs
|
|
if: ${{ failure() }}
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: unit-test-logs-${{ inputs.artifact }}
|
|
path: ${{ inputs.test-dir }}/**/*.log
|
|
- name: Upload Test Results
|
|
if: always()
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: test-results-${{ inputs.artifact }}
|
|
path: ctest_results.xml
|
|
retention-days: 5
|
|
if-no-files-found: warn
|
|
- name: Delete Test Artifact
|
|
if: success()
|
|
uses: geekyeggo/delete-artifact@v6
|
|
with:
|
|
name: ${{ inputs.artifact }}
|