Merge branch 'main' into dev/p2s-pr

This commit is contained in:
SoftFever
2025-10-29 22:28:09 +08:00
committed by GitHub
15 changed files with 227 additions and 110 deletions

View File

@@ -0,0 +1,11 @@
name: 'Apt Install Deps'
description: 'Install the packages needed for building and deploying'
runs:
using: 'composite'
steps:
- name: Install dependencies from build_linux.sh
shell: bash
run: |
mkdir -p ${{ github.workspace }}/deps/build/destdir
sudo env "ORCA_UPDATER_SIG_KEY=$ORCA_UPDATER_SIG_KEY" ./build_linux.sh -ur
sudo chown $USER -R ./

View File

@@ -33,6 +33,9 @@ on:
- 'resources/**' - 'resources/**'
schedule:
- cron: '0 17 * * *' # run once a day at 1 AM Singapore time (UTC+8)
workflow_dispatch: # allows for manual dispatch workflow_dispatch: # allows for manual dispatch
inputs: inputs:
build-deps-only: build-deps-only:
@@ -46,24 +49,72 @@ concurrency:
jobs: jobs:
build_linux:
name: Build Linux
strategy:
fail-fast: false
# Don't run scheduled builds on forks:
if: github.event_name != 'schedule' || github.repository == 'SoftFever/OrcaSlicer'
uses: ./.github/workflows/build_check_cache.yml
with:
os: ubuntu-24.04
build-deps-only: ${{ inputs.build-deps-only || false }}
secrets: inherit
build_all: build_all:
name: Build All name: Build Non-Linux
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
# Deprecate 20.04appimage
# - os: ubuntu-20.04
- os: ubuntu-24.04
- os: windows-latest - os: windows-latest
- os: macos-14 - os: macos-14
arch: arm64 arch: arm64
# Don't run scheduled builds on forks:
if: github.event_name != 'schedule' || github.repository == 'SoftFever/OrcaSlicer'
uses: ./.github/workflows/build_check_cache.yml uses: ./.github/workflows/build_check_cache.yml
with: with:
os: ${{ matrix.os }} os: ${{ matrix.os }}
arch: ${{ matrix.arch }} arch: ${{ matrix.arch }}
build-deps-only: ${{ inputs.build-deps-only || false }} build-deps-only: ${{ inputs.build-deps-only || false }}
force-build: ${{ github.event_name == 'schedule' }}
secrets: inherit secrets: inherit
unit_tests:
name: Unit Tests
runs-on: ubuntu-24.04
needs: build_linux
if: ${{ success() }}
steps:
- name: Checkout
uses: actions/checkout@v5
with:
sparse-checkout: |
.github
scripts
- name: Apt-Install Dependencies
uses: ./.github/actions/apt-install-deps
- name: Restore Test Artifact
uses: actions/download-artifact@v4
with:
name: ${{ github.sha }}-tests
- uses: lukka/get-cmake@latest
with:
cmakeVersion: "~3.28.0" # use most recent 3.28.x version
- name: Unpackage and Run Unit Tests
timeout-minutes: 20
run: |
tar -xvf build_tests.tar
scripts/run_unit_tests.sh
- name: Upload Test Logs
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: unit-test-logs
path: build/tests/**/*.log
- name: Publish Test Results
if: always()
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: "ctest_results.xml"
flatpak: flatpak:
name: "Flatpak" name: "Flatpak"
container: container:
@@ -82,6 +133,8 @@ jobs:
runner: ubuntu-24.04 runner: ubuntu-24.04
- arch: aarch64 - arch: aarch64
runner: ubuntu-24.04-arm runner: ubuntu-24.04-arm
# Don't run scheduled builds on forks:
if: github.event_name != 'schedule' || github.repository == 'SoftFever/OrcaSlicer'
runs-on: ${{ matrix.variant.runner }} runs-on: ${{ matrix.variant.runner }}
env: env:
date: date:
@@ -120,7 +173,7 @@ jobs:
name: OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak name: OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak
path: '/__w/OrcaSlicer/OrcaSlicer/OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak' path: '/__w/OrcaSlicer/OrcaSlicer/OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak'
- name: Deploy Flatpak to nightly release - name: Deploy Flatpak to nightly release
if: ${{github.ref == 'refs/heads/main'}} if: github.repository == 'SoftFever/OrcaSlicer' && github.ref == 'refs/heads/main'
uses: WebFreak001/deploy-nightly@v3.2.0 uses: WebFreak001/deploy-nightly@v3.2.0
with: with:
upload_url: https://uploads.github.com/repos/SoftFever/OrcaSlicer/releases/137995723/assets{?name,label} upload_url: https://uploads.github.com/repos/SoftFever/OrcaSlicer/releases/137995723/assets{?name,label}

View File

@@ -12,6 +12,9 @@ on:
build-deps-only: build-deps-only:
required: false required: false
type: boolean type: boolean
force-build:
required: false
type: boolean
jobs: jobs:
check_cache: # determines if there is a cache and outputs variables used in caching process check_cache: # determines if there is a cache and outputs variables used in caching process
@@ -55,4 +58,5 @@ jobs:
os: ${{ inputs.os }} os: ${{ inputs.os }}
arch: ${{ inputs.arch }} arch: ${{ inputs.arch }}
build-deps-only: ${{ inputs.build-deps-only }} build-deps-only: ${{ inputs.build-deps-only }}
force-build: ${{ inputs.force-build }}
secrets: inherit secrets: inherit

View File

@@ -19,11 +19,14 @@ on:
build-deps-only: build-deps-only:
required: false required: false
type: boolean type: boolean
force-build:
required: false
type: boolean
jobs: jobs:
build_deps: build_deps:
name: Build Deps name: Build Deps
if: inputs.build-deps-only || inputs.valid-cache != true if: inputs.build-deps-only || inputs.force-build || inputs.valid-cache != true
runs-on: ${{ inputs.os }} runs-on: ${{ inputs.os }}
env: env:
date: date:
@@ -85,28 +88,15 @@ jobs:
brew install zstd brew install zstd
- name: Install Ubuntu Build Dependencies - name: Apt-Install Dependencies
if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04' if: inputs.os == 'ubuntu-24.04'
working-directory: ${{ github.workspace }} uses: ./.github/actions/apt-install-deps
env:
apt-cmd: ${{ (inputs.os == 'ubuntu-20.04' && 'apt-fast') || (inputs.os == 'ubuntu-24.04' && 'sudo apt-get') || '' }}
webkit-ver: ${{ (inputs.os == 'ubuntu-20.04' && '4.0') || (inputs.os == 'ubuntu-24.04' && '4.1') || '' }}
run: |
${{ env.apt-cmd }} update
${{ env.apt-cmd }} install -y cmake git g++ build-essential libgl1-mesa-dev m4 \
libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules pkgconf \
libglu1-mesa-dev libcairo2-dev libgtk-3-dev libsoup2.4-dev libwebkit2gtk-${{ env.webkit-ver }}-dev \
libgstreamer1.0-dev libgstreamer-plugins-good1.0-dev libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-bad wget sudo autoconf curl libunwind-dev texinfo
- name: Build on Ubuntu - name: Build on Ubuntu
if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04' if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04'
working-directory: ${{ github.workspace }} working-directory: ${{ github.workspace }}
run: | run: |
mkdir -p ${{ github.workspace }}/deps/build
mkdir -p ${{ github.workspace }}/deps/build/destdir mkdir -p ${{ github.workspace }}/deps/build/destdir
sudo ./build_linux.sh -ur
sudo chown $USER -R ./
./build_linux.sh -dr ./build_linux.sh -dr
cd deps/build cd deps/build
tar -czvf OrcaSlicer_dep_ubuntu_$(date +"%Y%m%d").tar.gz destdir tar -czvf OrcaSlicer_dep_ubuntu_$(date +"%Y%m%d").tar.gz destdir
@@ -139,7 +129,7 @@ jobs:
build_orca: build_orca:
name: Build OrcaSlicer name: Build OrcaSlicer
needs: [build_deps] needs: [build_deps]
if: ${{ !cancelled() && !inputs.build-deps-only && (inputs.valid-cache == true && needs.build_deps.result == 'skipped') || (inputs.valid-cache != true && success()) }} if: ${{ !cancelled() && !inputs.build-deps-only && (inputs.force-build || (inputs.valid-cache == true && needs.build_deps.result == 'skipped') || (inputs.valid-cache != true && success())) }}
uses: ./.github/workflows/build_orca.yml uses: ./.github/workflows/build_orca.yml
with: with:
cache-key: ${{ inputs.cache-key }} cache-key: ${{ inputs.cache-key }}

View File

@@ -108,7 +108,7 @@ jobs:
# Thanks to RaySajuuk, it's working now # Thanks to RaySajuuk, it's working now
- name: Sign app and notary - name: Sign app and notary
if: (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) && inputs.os == 'macos-14' if: github.repository == 'SoftFever/OrcaSlicer' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) && inputs.os == 'macos-14'
working-directory: ${{ github.workspace }} working-directory: ${{ github.workspace }}
env: env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
@@ -195,7 +195,7 @@ jobs:
if-no-files-found: ignore if-no-files-found: ignore
- name: Deploy Mac release - name: Deploy Mac release
if: github.ref == 'refs/heads/main' && inputs.os == 'macos-14' if: github.repository == 'SoftFever/OrcaSlicer' && github.ref == 'refs/heads/main' && inputs.os == 'macos-14'
uses: WebFreak001/deploy-nightly@v3.2.0 uses: WebFreak001/deploy-nightly@v3.2.0
with: with:
upload_url: https://uploads.github.com/repos/SoftFever/OrcaSlicer/releases/137995723/assets{?name,label} upload_url: https://uploads.github.com/repos/SoftFever/OrcaSlicer/releases/137995723/assets{?name,label}
@@ -206,7 +206,7 @@ jobs:
max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted
- name: Deploy Mac OrcaSlicer_profile_validator DMG release - name: Deploy Mac OrcaSlicer_profile_validator DMG release
if: github.ref == 'refs/heads/main' && inputs.os == 'macos-14' if: github.repository == 'SoftFever/OrcaSlicer' && github.ref == 'refs/heads/main' && inputs.os == 'macos-14'
uses: WebFreak001/deploy-nightly@v3.2.0 uses: WebFreak001/deploy-nightly@v3.2.0
with: with:
upload_url: https://uploads.github.com/repos/SoftFever/OrcaSlicer/releases/137995723/assets{?name,label} upload_url: https://uploads.github.com/repos/SoftFever/OrcaSlicer/releases/137995723/assets{?name,label}
@@ -282,7 +282,7 @@ jobs:
path: ${{ github.workspace }}/build/src/Release/OrcaSlicer_profile_validator.exe path: ${{ github.workspace }}/build/src/Release/OrcaSlicer_profile_validator.exe
- name: Deploy Windows release portable - name: Deploy Windows release portable
if: github.ref == 'refs/heads/main' && inputs.os == 'windows-latest' if: github.repository == 'SoftFever/OrcaSlicer' && github.ref == 'refs/heads/main' && inputs.os == 'windows-latest'
uses: WebFreak001/deploy-nightly@v3.2.0 uses: WebFreak001/deploy-nightly@v3.2.0
with: with:
upload_url: https://uploads.github.com/repos/SoftFever/OrcaSlicer/releases/137995723/assets{?name,label} upload_url: https://uploads.github.com/repos/SoftFever/OrcaSlicer/releases/137995723/assets{?name,label}
@@ -293,7 +293,7 @@ jobs:
max_releases: 1 max_releases: 1
- name: Deploy Windows release installer - name: Deploy Windows release installer
if: github.ref == 'refs/heads/main' && inputs.os == 'windows-latest' if: github.repository == 'SoftFever/OrcaSlicer' && github.ref == 'refs/heads/main' && inputs.os == 'windows-latest'
uses: WebFreak001/deploy-nightly@v3.2.0 uses: WebFreak001/deploy-nightly@v3.2.0
with: with:
upload_url: https://uploads.github.com/repos/SoftFever/OrcaSlicer/releases/137995723/assets{?name,label} upload_url: https://uploads.github.com/repos/SoftFever/OrcaSlicer/releases/137995723/assets{?name,label}
@@ -304,7 +304,7 @@ jobs:
max_releases: 1 max_releases: 1
- name: Deploy Windows OrcaSlicer_profile_validator release - name: Deploy Windows OrcaSlicer_profile_validator release
if: github.ref == 'refs/heads/main' && inputs.os == 'windows-latest' if: github.repository == 'SoftFever/OrcaSlicer' && github.ref == 'refs/heads/main' && inputs.os == 'windows-latest'
uses: WebFreak001/deploy-nightly@v3.2.0 uses: WebFreak001/deploy-nightly@v3.2.0
with: with:
upload_url: https://uploads.github.com/repos/SoftFever/OrcaSlicer/releases/137995723/assets{?name,label} upload_url: https://uploads.github.com/repos/SoftFever/OrcaSlicer/releases/137995723/assets{?name,label}
@@ -315,39 +315,34 @@ jobs:
max_releases: 1 max_releases: 1
# Ubuntu # Ubuntu
- name: Install dependencies - name: Apt-Install Dependencies
if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04' if: inputs.os == 'ubuntu-24.04'
env: uses: ./.github/actions/apt-install-deps
apt-cmd: ${{ (inputs.os == 'ubuntu-20.04' && 'apt-fast') || (inputs.os == 'ubuntu-24.04' && 'sudo apt-get') || '' }}
webkit-ver: ${{ (inputs.os == 'ubuntu-20.04' && '4.0') || (inputs.os == 'ubuntu-24.04' && '4.1') || '' }}
libfuse2-pkg: ${{ (inputs.os == 'ubuntu-20.04' && 'libfuse2') || (inputs.os == 'ubuntu-24.04' && 'libfuse2t64') || '' }}
run: |
${{ env.apt-cmd }} update
${{ env.apt-cmd }} install -y autoconf build-essential cmake curl eglexternalplatform-dev \
extra-cmake-modules file git libcairo2-dev libcurl4-openssl-dev libdbus-1-dev libglew-dev libglu1-mesa-dev \
libglu1-mesa-dev libgstreamer1.0-dev libgstreamerd-3-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev \
libgtk-3-dev libgtk-3-dev libmspack-dev libsecret-1-dev libsoup2.4-dev libssl-dev libudev-dev libwayland-dev \
libwebkit2gtk-${{ env.webkit-ver }}-dev libxkbcommon-dev locales locales-all m4 pkgconf sudo wayland-protocols wget ${{ env.libfuse2-pkg }}
- name: Install dependencies from build_linux.sh # Tests must built at the same time as the slicer;
if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04' # if you untangle them feel free to separate them here too
shell: bash - name: Build slicer and tests
run: sudo env "ORCA_UPDATER_SIG_KEY=$ORCA_UPDATER_SIG_KEY" ./build_linux.sh -ur
- name: Fix permissions
if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04'
shell: bash
run: sudo chown $USER -R ./
- name: Build slicer
if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04' if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04'
shell: bash shell: bash
env: env:
ubuntu-ver-str: ${{ (inputs.os == 'ubuntu-24.04' && '_Ubuntu2404') || '' }} ubuntu-ver-str: ${{ (inputs.os == 'ubuntu-24.04' && '_Ubuntu2404') || '' }}
run: | run: |
./build_linux.sh -isr ./build_linux.sh -istr
mv -n ./build/OrcaSlicer_Linux_V${{ env.ver_pure }}.AppImage ./build/OrcaSlicer_Linux_AppImage${{ env.ubuntu-ver-str }}_${{ env.ver }}.AppImage mv -n ./build/OrcaSlicer_Linux_V${{ env.ver_pure }}.AppImage ./build/OrcaSlicer_Linux_AppImage${{ env.ubuntu-ver-str }}_${{ env.ver }}.AppImage
chmod +x ./build/OrcaSlicer_Linux_AppImage${{ env.ubuntu-ver-str }}_${{ env.ver }}.AppImage chmod +x ./build/OrcaSlicer_Linux_AppImage${{ env.ubuntu-ver-str }}_${{ env.ver }}.AppImage
tar -cvpf build_tests.tar build/tests
# Use tar because upload-artifacts won't always preserve directory structure
# and doesn't preserve file permissions
- name: Upload Test Artifact
if: inputs.os == 'ubuntu-24.04'
uses: actions/upload-artifact@v4
with:
name: ${{ github.sha }}-tests
overwrite: true
path: build_tests.tar
retention-days: 5
if-no-files-found: error
- name: Build orca_custom_preset_tests - name: Build orca_custom_preset_tests
if: github.ref == 'refs/heads/main' && inputs.os == 'ubuntu-24.04' if: github.ref == 'refs/heads/main' && inputs.os == 'ubuntu-24.04'
@@ -378,7 +373,7 @@ jobs:
path: './build/src/Release/OrcaSlicer_profile_validator' path: './build/src/Release/OrcaSlicer_profile_validator'
- name: Deploy Ubuntu release - name: Deploy Ubuntu release
if: ${{ ! env.ACT && github.ref == 'refs/heads/main' && (inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04') }} if: ${{ github.repository == 'SoftFever/OrcaSlicer' && ! env.ACT && github.ref == 'refs/heads/main' && (inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04') }}
env: env:
ubuntu-ver-str: ${{ (inputs.os == 'ubuntu-24.04' && '_Ubuntu2404') || '' }} ubuntu-ver-str: ${{ (inputs.os == 'ubuntu-24.04' && '_Ubuntu2404') || '' }}
uses: WebFreak001/deploy-nightly@v3.2.0 uses: WebFreak001/deploy-nightly@v3.2.0
@@ -390,7 +385,7 @@ jobs:
asset_content_type: application/octet-stream asset_content_type: application/octet-stream
max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted
- name: Deploy Ubuntu release - name: Deploy Ubuntu release
if: ${{ ! env.ACT && github.ref == 'refs/heads/main' && inputs.os == 'ubuntu-24.04' }} if: ${{ github.repository == 'SoftFever/OrcaSlicer' && ! env.ACT && github.ref == 'refs/heads/main' && inputs.os == 'ubuntu-24.04' }}
uses: rickstaa/action-create-tag@v1 uses: rickstaa/action-create-tag@v1
with: with:
tag: "nightly-builds" tag: "nightly-builds"
@@ -399,7 +394,7 @@ jobs:
message: "nightly-builds" message: "nightly-builds"
- name: Deploy Ubuntu OrcaSlicer_profile_validator release - name: Deploy Ubuntu OrcaSlicer_profile_validator release
if: ${{ ! env.ACT && github.ref == 'refs/heads/main' && (inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04') }} if: ${{ github.repository == 'SoftFever/OrcaSlicer' && ! env.ACT && github.ref == 'refs/heads/main' && (inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04') }}
env: env:
ubuntu-ver-str: ${{ (inputs.os == 'ubuntu-24.04' && '_Ubuntu2404') || '' }} ubuntu-ver-str: ${{ (inputs.os == 'ubuntu-24.04' && '_Ubuntu2404') || '' }}
uses: WebFreak001/deploy-nightly@v3.2.0 uses: WebFreak001/deploy-nightly@v3.2.0
@@ -412,7 +407,7 @@ jobs:
max_releases: 1 max_releases: 1
- name: Deploy orca_custom_preset_tests - name: Deploy orca_custom_preset_tests
if: ${{ ! env.ACT && github.ref == 'refs/heads/main' && inputs.os == 'ubuntu-24.04' }} if: ${{ github.repository == 'SoftFever/OrcaSlicer' && ! env.ACT && github.ref == 'refs/heads/main' && inputs.os == 'ubuntu-24.04' }}
uses: WebFreak001/deploy-nightly@v3.2.0 uses: WebFreak001/deploy-nightly@v3.2.0
with: with:
upload_url: https://uploads.github.com/repos/SoftFever/OrcaSlicer/releases/137995723/assets{?name,label} upload_url: https://uploads.github.com/repos/SoftFever/OrcaSlicer/releases/137995723/assets{?name,label}

View File

@@ -65,7 +65,8 @@ build_release_vs2022.bat slicer
# Performance and debug options: # Performance and debug options:
./build_linux.sh -j N # limit to N cores ./build_linux.sh -j N # limit to N cores
./build_linux.sh -1 # single core build ./build_linux.sh -1 # single core build
./build_linux.sh -b # debug build ./build_linux.sh -b # Debug build
./build_linux.sh -e # RelWithDebInfo build
./build_linux.sh -c # clean build ./build_linux.sh -c # clean build
./build_linux.sh -r # skip RAM/disk checks ./build_linux.sh -r # skip RAM/disk checks
./build_linux.sh -l # use Clang instead of GCC ./build_linux.sh -l # use Clang instead of GCC
@@ -107,9 +108,10 @@ cd build && ctest --output-on-failure
Run individual test suites: Run individual test suites:
```bash ```bash
# From build directory # From build directory
./tests/libslic3r/libslic3r_tests ctest --test-dir ./tests/libslic3r/libslic3r_tests
./tests/fff_print/fff_print_tests ctest --test-dir ./tests/fff_print/fff_print_tests
./tests/sla_print/sla_print_tests ctest --test-dir ./tests/sla_print/sla_print_tests
# and so on
``` ```
## Architecture ## Architecture
@@ -254,4 +256,4 @@ Run individual test suites:
- **Regression testing** important due to algorithm complexity - **Regression testing** important due to algorithm complexity
- **Performance benchmarks** help catch performance regressions - **Performance benchmarks** help catch performance regressions
- **Memory leak** detection important for long-running GUI application - **Memory leak** detection important for long-running GUI application
- **Cross-platform** testing required before releases - **Cross-platform** testing required before releases

View File

@@ -117,7 +117,6 @@ option(SLIC3R_PROFILE "Compile OrcaSlicer with an invasive Shiny profiler" 0)
option(SLIC3R_PCH "Use precompiled headers" 1) option(SLIC3R_PCH "Use precompiled headers" 1)
option(SLIC3R_MSVC_COMPILE_PARALLEL "Compile on Visual Studio in parallel" 1) option(SLIC3R_MSVC_COMPILE_PARALLEL "Compile on Visual Studio in parallel" 1)
option(SLIC3R_MSVC_PDB "Generate PDB files on MSVC in Release mode" 1) option(SLIC3R_MSVC_PDB "Generate PDB files on MSVC in Release mode" 1)
option(SLIC3R_PERL_XS "Compile XS Perl module and enable Perl unit and integration tests" 0)
option(SLIC3R_ASAN "Enable ASan on Clang and GCC" 0) option(SLIC3R_ASAN "Enable ASan on Clang and GCC" 0)
# If SLIC3R_FHS is 1 -> SLIC3R_DESKTOP_INTEGRATION is always 0, othrewise variable. # If SLIC3R_FHS is 1 -> SLIC3R_DESKTOP_INTEGRATION is always 0, othrewise variable.
CMAKE_DEPENDENT_OPTION(SLIC3R_DESKTOP_INTEGRATION "Allow perfoming desktop integration during runtime" 1 "NOT SLIC3R_FHS" 0) CMAKE_DEPENDENT_OPTION(SLIC3R_DESKTOP_INTEGRATION "Allow perfoming desktop integration during runtime" 1 "NOT SLIC3R_FHS" 0)
@@ -171,7 +170,6 @@ endif ()
if (IS_CROSS_COMPILE) if (IS_CROSS_COMPILE)
message("Detected cross compilation setup. Tests and encoding checks will be forcedly disabled!") message("Detected cross compilation setup. Tests and encoding checks will be forcedly disabled!")
set(SLIC3R_PERL_XS OFF CACHE BOOL "" FORCE)
set(BUILD_TESTS OFF CACHE BOOL "" FORCE) set(BUILD_TESTS OFF CACHE BOOL "" FORCE)
endif () endif ()
@@ -883,13 +881,6 @@ set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT O
add_dependencies(gettext_make_pot hintsToPot) add_dependencies(gettext_make_pot hintsToPot)
# Perl bindings, currently only used for the unit / integration tests of libslic3r.
# Also runs the unit / integration tests.
#FIXME Port the tests into C++ to finally get rid of the Perl!
if (SLIC3R_PERL_XS)
add_subdirectory(xs)
endif ()
if(SLIC3R_BUILD_SANDBOXES) if(SLIC3R_BUILD_SANDBOXES)
add_subdirectory(sandboxes) add_subdirectory(sandboxes)
endif() endif()

View File

@@ -7,7 +7,7 @@ SCRIPT_PATH=$(dirname "$(readlink -f "${0}")")
pushd "${SCRIPT_PATH}" > /dev/null pushd "${SCRIPT_PATH}" > /dev/null
function usage() { function usage() {
echo "Usage: ./${SCRIPT_NAME} [-1][-b][-c][-d][-h][-i][-j N][-p][-r][-s][-t][-u][-l][-L]" echo "Usage: ./${SCRIPT_NAME} [-1][-b][-c][-d][-D][-e][-h][-i][-j N][-p][-r][-s][-t][-u][-l][-L]"
echo " -1: limit builds to one core (where possible)" echo " -1: limit builds to one core (where possible)"
echo " -j N: limit builds to N cores (where possible)" echo " -j N: limit builds to N cores (where possible)"
echo " -b: build in Debug mode" echo " -b: build in Debug mode"
@@ -21,7 +21,7 @@ function usage() {
echo " -p: boost ccache hit rate by disabling precompiled headers (default: ON)" echo " -p: boost ccache hit rate by disabling precompiled headers (default: ON)"
echo " -r: skip RAM and disk checks (low RAM compiling)" echo " -r: skip RAM and disk checks (low RAM compiling)"
echo " -s: build the Orca Slicer (optional)" echo " -s: build the Orca Slicer (optional)"
echo " -t: build tests (optional)" echo " -t: build tests (optional), requires -s flag"
echo " -u: install system dependencies (asks for sudo password; build prerequisite)" echo " -u: install system dependencies (asks for sudo password; build prerequisite)"
echo " -l: use Clang instead of GCC (default: GCC)" echo " -l: use Clang instead of GCC (default: GCC)"
echo " -L: use ld.lld as linker (if available)" echo " -L: use ld.lld as linker (if available)"
@@ -102,6 +102,11 @@ if [ ${OPTIND} -eq 1 ] ; then
exit 1 exit 1
fi fi
if [[ -n "${BUILD_TESTS}" ]] && [[ -z "${BUILD_ORCA}" ]] ; then
echo "-t flag requires -s flag in the same invocation"
exit 1
fi
function check_available_memory_and_disk() { function check_available_memory_and_disk() {
FREE_MEM_GB=$(free --gibi --total | grep 'Mem' | rev | cut --delimiter=" " --fields=1 | rev) FREE_MEM_GB=$(free --gibi --total | grep 'Mem' | rev | cut --delimiter=" " --fields=1 | rev)
MIN_MEM_GB=10 MIN_MEM_GB=10
@@ -243,19 +248,22 @@ if [[ -n "${BUILD_ORCA}" ]] ; then
echo "Building OrcaSlicer_profile_validator .." echo "Building OrcaSlicer_profile_validator .."
print_and_run cmake --build $BUILD_DIR --config "${BUILD_CONFIG}" --target OrcaSlicer_profile_validator print_and_run cmake --build $BUILD_DIR --config "${BUILD_CONFIG}" --target OrcaSlicer_profile_validator
./scripts/run_gettext.sh ./scripts/run_gettext.sh
if [[ -n "${BUILD_TESTS}" ]] ; then
echo "Building tests ..."
print_and_run cmake --build ${BUILD_DIR} --config "${BUILD_CONFIG}" --target tests/all
fi
echo "done" echo "done"
fi fi
if [[ -n "${BUILD_IMAGE}" || -n "${BUILD_ORCA}" ]] ; then if [[ -n "${BUILD_IMAGE}" || -n "${BUILD_ORCA}" ]] ; then
pushd $BUILD_DIR > /dev/null pushd $BUILD_DIR > /dev/null
echo "[9/9] Generating Linux app..."
build_linux_image="./src/build_linux_image.sh" build_linux_image="./src/build_linux_image.sh"
if [[ -e ${build_linux_image} ]] ; then if [[ -e ${build_linux_image} ]] ; then
extra_script_args="" extra_script_args=""
if [[ -n "${BUILD_IMAGE}" ]] ; then if [[ -n "${BUILD_IMAGE}" ]] ; then
extra_script_args="-i" extra_script_args="-i"
fi fi
print_and_run ${build_linux_image} ${extra_script_args} print_and_run ${build_linux_image} ${extra_script_args} -R "${BUILD_CONFIG}"
echo "done" echo "done"
fi fi

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. ![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 build OrcaSlicer](How-to-build)
- [How to run tests](How-to-test)
- [Localization and translation guide](Localization_guide) - [Localization and translation guide](Localization_guide)
- [How to create profiles](How-to-create-profiles) - [How to create profiles](How-to-create-profiles)
- [How to contribute to the wiki](How-to-wiki) - [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 ./build_linux.sh -d
``` ```
3. **Build OrcaSlicer:** 3. **Build OrcaSlicer with tests:**
```shell ```shell
./build_linux.sh -s ./build_linux.sh -st
``` ```
4. **Build AppImage (optional):** 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):** 5. **All-in-one build (recommended):**
```shell ```shell
./build_linux.sh -dsi ./build_linux.sh -dsti
``` ```
**Additional build options:** **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`: Force a clean build
- `-C`: Enable ANSI-colored compile output (GNU/Clang only) - `-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) - `-j N`: Limit builds to N cores (useful for low-memory systems)
- `-1`: Limit builds to one core - `-1`: Limit builds to one core
- `-l`: Use Clang instead of GCC - `-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. > The build script automatically detects your Linux distribution and uses the appropriate package manager (apt, pacman) to install dependencies.
> [!TIP] > [!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] > [!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
```

View File

@@ -7,6 +7,7 @@ REQUIRED_DEV_PACKAGES=(
eglexternalplatform-dev eglexternalplatform-dev
extra-cmake-modules extra-cmake-modules
file file
g++
gettext gettext
git git
libcurl4-openssl-dev libcurl4-openssl-dev
@@ -34,7 +35,7 @@ then
if dpkg --compare-versions "${VERSION_ID}" ge 22 && dpkg --compare-versions "${VERSION_ID}" lt 24 ; if dpkg --compare-versions "${VERSION_ID}" ge 22 && dpkg --compare-versions "${VERSION_ID}" lt 24 ;
then then
# Some extra packages needed on Ubuntu 22.x and 23.x: # Some extra packages needed on Ubuntu 22.x and 23.x:
REQUIRED_DEV_PACKAGES+=(curl libfuse-dev libssl-dev libcurl4-openssl-dev m4) REQUIRED_DEV_PACKAGES+=(curl libfuse-dev m4)
fi fi
fi fi

13
scripts/run_unit_tests.sh Executable file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
# This file is made to support the unit tests workflow.
# It should only require the directories build/tests and scripts/ to function,
# and cmake (with ctest) installed.
# (otherwise, update the workflow too, but try to avoid to keep things self-contained)
ROOT_DIR="$(dirname "$0")/.."
cd "${ROOT_DIR}" || exit 1
# TODO: github.com/SoftFever/OrcaSlicer/issues/10309 - Run all tests
ctest --test-dir build/tests/slic3rutils --output-junit "$(pwd)/ctest_results.xml" --output-on-failure

View File

@@ -1,16 +1,24 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Despite the script name, this doesn't necessarily create an "image";
# it sets up a compatibility script wrapper for the binary and arranges some resources.
export ROOT=$(echo $ROOT | grep . || pwd) export ROOT=$(echo $ROOT | grep . || pwd)
export NCORES=`nproc --all` export NCORES=`nproc --all`
CONFIG=Release
while getopts ":ih" opt; do while getopts ":ihR:" opt; do
case ${opt} in case ${opt} in
i ) i )
export BUILD_IMAGE="1" export BUILD_IMAGE="1"
;; ;;
h ) echo "Usage: ./build_linux_image.sh [-i]" h ) echo "Usage: ./build_linux_image.sh [-i][-R config]"
echo " -i: Generate Appimage (optional)" echo " -i: Generate Appimage (optional)"
exit 0 echo " -R: Specify from which config to obtain the binary: Release, RelWithDebInfo, or Debug"
exit 1
;;
R )
CONFIG=$OPTARG
;; ;;
esac esac
done done
@@ -18,30 +26,26 @@ done
echo -n "[9/9] Generating Linux app..." echo -n "[9/9] Generating Linux app..."
#{ #{
# create directory and copy into it # create directory and copy into it
if [ -d "package" ] if [ -d "package" ]; then
then rm -rf package
rm -rf package/*
rm -rf package/.* 2&>/dev/null
else
mkdir package
fi fi
mkdir package/bin mkdir -p package/bin
# copy Resources # Copy Resources
cp -Rf ../resources package/resources cp -Rf ../resources package/resources
# Find and copy the @SLIC3R_APP_CMD@ binary from Multi-Config build # Find and hard link the @SLIC3R_APP_CMD@ binary from Multi-Config build
if [ -f "src/Release/@SLIC3R_APP_CMD@" ]; then ORIGINAL_BINARY_LOCATION=""
cp -f src/Release/@SLIC3R_APP_CMD@ package/bin/@SLIC3R_APP_CMD@ if [ -f "src/${CONFIG}/@SLIC3R_APP_CMD@" ]; then
ORIGINAL_BINARY_LOCATION="$(realpath "src/${CONFIG}/@SLIC3R_APP_CMD@")"
elif [ -f "src/@SLIC3R_APP_CMD@" ]; then elif [ -f "src/@SLIC3R_APP_CMD@" ]; then
# Fallback for single-config builds # Fallback for single-config builds
cp -f src/@SLIC3R_APP_CMD@ package/bin/@SLIC3R_APP_CMD@ ORIGINAL_BINARY_LOCATION="$(realpath "src/@SLIC3R_APP_CMD@")"
else else
echo "Error: @SLIC3R_APP_CMD@ binary not found in any configuration directory" echo "Error: @SLIC3R_APP_CMD@ binary not found in any configuration directory"
exit 1 exit 1
fi fi
# remove unneeded po from resources cp -fl "${ORIGINAL_BINARY_LOCATION}" package/bin/@SLIC3R_APP_CMD@
## find package/resources/localization -name "*.po" -type f -delete ## FIXME: DD - do we need this?
# create bin # create bin
cat << EOF >@SLIC3R_APP_CMD@ cat << EOF >@SLIC3R_APP_CMD@
@@ -76,10 +80,13 @@ exec "\$DIR/bin/@SLIC3R_APP_CMD@" "\$@"
EOF EOF
chmod ug+x @SLIC3R_APP_CMD@ chmod ug+x @SLIC3R_APP_CMD@
cp -f @SLIC3R_APP_CMD@ package/@SLIC3R_APP_CMD@ cp -fl @SLIC3R_APP_CMD@ package/@SLIC3R_APP_CMD@
pushd package > /dev/null # Nothing uses this tar? Remove if nobody has complained and it's been a while since this comment added.
tar -cvf ../@SLIC3R_APP_KEY@.tar . &>/dev/null # Original commit was https://github.com/SoftFever/OrcaSlicer/commit/f5a4862da52fc68f77b5201ddf330a9800d83228
popd > /dev/null # and it doesn't appear to have been used there either.
#pushd package > /dev/null
#tar -cvf ../@SLIC3R_APP_KEY@.tar . &>/dev/null
#popd > /dev/null
#} &> $ROOT/Build.log # Capture all command output #} &> $ROOT/Build.log # Capture all command output
echo "done" echo "done"
@@ -87,11 +94,20 @@ if [[ -n "$BUILD_IMAGE" ]]
then then
echo -n "Creating Appimage for distribution..." echo -n "Creating Appimage for distribution..."
#{ #{
pushd package > /dev/null # AppImage script modifies files in place, so make a copy and clean up after.
rm -rf package_appimage
cp -Rf package package_appimage
pushd package_appimage > /dev/null
chmod +x ../build_appimage.sh chmod +x ../build_appimage.sh
../build_appimage.sh if ../build_appimage.sh; then
popd > /dev/null # Clean up on success.
mv package/"@SLIC3R_APP_KEY@_Linux_V@SoftFever_VERSION@.AppImage" "@SLIC3R_APP_KEY@_Linux_V@SoftFever_VERSION@.AppImage" popd > /dev/null
mv package_appimage/"@SLIC3R_APP_KEY@_Linux_V@SoftFever_VERSION@.AppImage" "@SLIC3R_APP_KEY@_Linux_V@SoftFever_VERSION@.AppImage"
rm -fR package_appimage
else
# Leave files on failure so you can debug.
popd > /dev/null
fi
#} &> $ROOT/Build.log # Capture all command output #} &> $ROOT/Build.log # Capture all command output
echo "done" echo "done"
fi fi

View File

@@ -21,7 +21,7 @@ TEST_CASE("Check SSL certificates paths", "[Http][NotWorking]") {
} }
TEST_CASE("Http digest authentication", "[Http][NotWorking]") { TEST_CASE("Http digest authentication", "[Http][NotWorking]") {
Slic3r::Http g = Slic3r::Http::get("https://jigsaw.w3.org/HTTP/Digest/"); Slic3r::Http g = Slic3r::Http::get("https://httpbin.org/digest-auth/guest/guest");
g.auth_digest("guest", "guest"); g.auth_digest("guest", "guest");
@@ -40,7 +40,7 @@ TEST_CASE("Http digest authentication", "[Http][NotWorking]") {
} }
TEST_CASE("Http basic authentication", "[Http][NotWorking]") { TEST_CASE("Http basic authentication", "[Http][NotWorking]") {
Slic3r::Http g = Slic3r::Http::get("https://jigsaw.w3.org/HTTP/Basic/"); Slic3r::Http g = Slic3r::Http::get("https://httpbin.org/basic-auth/guest/guest");
g.auth_basic("guest", "guest"); g.auth_basic("guest", "guest");