Build and run a test in CI (#10835)

* Actually build tests on Linux and allow RelWithDebInfo

They weren't being built.

Also cleaned up --config flags which enables RelWithDebInfo on Linux,
now that Ninja Multi-Config is used, it's quite trivial.

* Remove obsolete Slic3r Perl tests

The directory doesn't exist, they're already gone.

* Add GH job for running unit tests

* Move unit test execution to script and upload test results

* Don't run scheduled builds on forks

* Only deploy from SoftFever/OrcaSlicer

Will stop failures on forks

* Use artifact instead of cache

* Tweak archive and checkout paths

Keep getting error:

```
/home/runner/work/_temp/902d0a0a-6d23-4fe0-a643-8b5cc4efd25b.sh: line 1: scripts/run_unit_tests.sh: Permission denied
```

That seems to be because I didn't use actions/checkout, the working
directory is never setup correctly? So using checkout to get scripts
directory. Unsure if archive will preserve the `build/tests/` prefix;
will find out soon.

* Use tar to package directory and write results to correct directory

Tar preserves filenames and directory structure

* Use tar -xvf not -xzf

Muscle memory failed me

* Add testing wiki page

* Save test logs on failure and choose correct directory for junit

* Consolidate apt install steps, use for unit tests too, disable non-Linux builds

Temporarily disable non-Linux builds to save time while developing
this.

Cache the apt packages to save some time searching apt and downloading
them again (though I realize this is also downloading, but hopefully
by something closer and faster).

Remove all the redundant packages listed in the workflow and debian
distribution lists.

* Remove apt install steps from workflow

`./build-linux.sh -u` is supposed to install all needed packages, so
it should build without needing anything besides that. If I'm wrong
this commit will be dropped.

* Need composite action checked out locally

* Re-enable non-Linux builds now that it's working

* Skip a deploy and a notarize in forks

They only succeed in the main repo.

* Fix multi-build for non-Release builds: share CONFIG

* Correct build errors in unit tests

Indeterminate method signatures resolved. Updated script to build all
the tests.

* Fix -g vs -e for RelWithDebInfo

* Change CONFIG->BUILD_CONFIG

Missed one in prior commits

* Reduce wasteful redundant build artifact copies

1. Don't copy the artifacts and leave them; make a hard link first;
only make a copy only while creating AppImage.

2. Don't tar up the `package` directory; nothing uses this tar AFAICT

* Fix directory name

* Change jigsaw auth test URLs to httpbin.org

No idea why the basic auth doesn't work, but it doesn't work for
`curl` CLI either. This does.

* Remove force-build

It got reverted at
e3f049829b
for unknown reasons.

* Add timeout for unit tests in GitHub Actions workflow (#11146)

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
coryrc
2025-10-29 05:56:06 -07:00
committed by GitHub
parent bb9c3bb87a
commit 275f3a7f1e
14 changed files with 214 additions and 108 deletions

View File

@@ -152,6 +152,7 @@ OrcaSlicer is a powerful open source slicer for FFF (FDM) 3D Printers. This wiki
![im_code](https://github.com/SoftFever/OrcaSlicer/blob/main/resources/images/im_code.svg?raw=true) This is a documentation from someone exploring the code and is by no means complete or even completely accurate. Please edit the parts you might find inaccurate. This is probably going to be helpful nonetheless.
- [How to build OrcaSlicer](How-to-build)
- [How to run tests](How-to-test)
- [Localization and translation guide](Localization_guide)
- [How to create profiles](How-to-create-profiles)
- [How to contribute to the wiki](How-to-wiki)

View File

@@ -279,9 +279,9 @@ The build system supports multiple Linux distributions including Ubuntu/Debian a
./build_linux.sh -d
```
3. **Build OrcaSlicer:**
3. **Build OrcaSlicer with tests:**
```shell
./build_linux.sh -s
./build_linux.sh -st
```
4. **Build AppImage (optional):**
@@ -291,14 +291,15 @@ The build system supports multiple Linux distributions including Ubuntu/Debian a
5. **All-in-one build (recommended):**
```shell
./build_linux.sh -dsi
./build_linux.sh -dsti
```
**Additional build options:**
- `-b`: Build in debug mode
- `-b`: Build in debug mode (mostly broken at runtime for a long time; avoid unless you want to be fixing failed assertions)
- `-c`: Force a clean build
- `-C`: Enable ANSI-colored compile output (GNU/Clang only)
- `-e`: Build RelWithDebInfo (release + symbols)
- `-j N`: Limit builds to N cores (useful for low-memory systems)
- `-1`: Limit builds to one core
- `-l`: Use Clang instead of GCC
@@ -309,10 +310,14 @@ The build system supports multiple Linux distributions including Ubuntu/Debian a
> The build script automatically detects your Linux distribution and uses the appropriate package manager (apt, pacman) to install dependencies.
> [!TIP]
> For first-time builds, use `./build_linux.sh -u` to install dependencies, then `./build_linux.sh -dsi` to build everything.
> For first-time builds, use `./build_linux.sh -u` to install dependencies, then `./build_linux.sh -dsti` to build everything.
> [!WARNING]
> If you encounter memory issues during compilation, use `-j 1` or `-1` to limit parallel compilation, or `-r` to skip memory checks.
> If you encounter memory issues during compilation, use `-j 1` or `-1` to limit parallel compilation and `-r` to skip memory checks.
#### Unit Testing
See [How to Test](How-to-test) for more details.
---

View File

@@ -0,0 +1,27 @@
# How to Test
This wiki page describes how to build and run tests on Linux. It should eventually provide guidance on how to add tests for a new feature.
## Build Tests
Can be built when you are building Orca Slicer binary by including the `-t` flag for `build_linux.sh`:
```
build_linux.sh -st
```
Test binaries will then appear under `build/tests`. As of this writing, not all tests will be built.
## Run Unit Tests
### Run All
```
ctest --test-dir build/tests
```
### Run a Specific Set
```
ctest --test-dir build/tests/slic3rutils
```