mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-02 14:56:56 +00:00
* build: add build_win.bat, a Windows build script for deps, slicer and toolchain setup build_release_vs.bat takes no options: what it builds is decided by editing it. This adds build_win.bat alongside it, with short and long options, a grouped help message, a dry-run mode that prints every command instead of running it, and one option per thing a developer actually varies - the configuration, the architecture, the compiler, the generator, the Visual Studio release, how much gets rebuilt, and where the dependency tree lives. It works from any directory, needs no developer command prompt in either generator mode, and keeps CMake ahead of Strawberry Perl on PATH so a build does not depend on how the user ordered their environment. scripts/test_build_win.ps1 covers it with table-driven cases that run the script under --dry-run and assert on the commands it prints, so nothing is configured or built. The Windows build jobs wait on that suite. Based on the script from OrcaSlicer#11097. Co-authored-by: Ocraftyone <24759591+Ocraftyone@users.noreply.github.com> * build: report what build_win.bat produced and what to do next Every successful run now ends with a block naming what it built and the commands to carry on with. Those commands repeat the flags that reproduce the run, so a rebuild after a clang-cl Ninja build is not silently an MSVC one. A failure gets a framed block naming the command that failed and a retry scoped to the stage that failed, so a slicer error does not suggest discarding an untouched dependency tree. Installing is now opt-in behind -i. The install tree is a second full copy of the build that exists mainly so the release can be zipped from it, while the build tree is already runnable, with the DLLs beside the binary and resources symlinked rather than copied. Configuring against a dependency tree that was never built now names it instead of failing several hundred lines into CMake's package resolution. scripts/test_build_win.ps1 covers all of it, and gains -Name so one case can be run without the full pass. * build: let the test options stand alone, and say which build things apply to --run-tests named two things to do and then did neither without -s, so `build_win.bat -lx --run-tests` answered "Nothing to do". Both test options now imply the slicer build they cannot happen without, unless another action was already named, so -d --tests is still a dependency build. --install-vs has turned on --install-deps the same way all along. That makes them actions, so they move to the group that says so. -i goes the other way, to the step toggles beside --no-configure and --no-gettext, since it does not stand alone and adds a step rather than describing what kind of build to make. An example shows the tests run with toolchain flags, because flags pick which build gets tested and a bare --run-tests would build and test a default tree the developer never asked for. Two help lines named defaults that were not the defaults. --build-dir said "instead of build/" and --deps-dir said "instead of deps/", but trees are named for the configuration, compiler and architecture, so build/ is only the default for a release x64 MSVC build, and deps/ is the source directory rather than a tree anything is built in. The hint for a missing dependency tree now carries the flags that reproduce the run. It said "Build them with -d", which after a clang build points at the MSVC tree, so following it left you no better off. Every other suggestion the script makes already repeats them. -k counted on the developer to read taskkill invocations as progress. It now names each image and how many processes it is about to stop, which is what explains the pause, and skips the ones that are not running instead of printing taskkill's "not found" as though something had gone wrong. No image can stop the rest. The environment example set SLIC3R_ASAN, which -a already does, teaching the long way round to a flag the script owns. It now sets options that have no flag. The note under it said "Use these for a value containing spaces. Ampersands are not supported", which named neither what "these" were an alternative to nor where ampersands were a problem. The test harness gains a NotExists field, because output cannot show what a run did not create, and two cases needed to prove exactly that. --------- Co-authored-by: Ocraftyone <24759591+Ocraftyone@users.noreply.github.com> Co-authored-by: Rodrigo Faselli <162915171+RF47@users.noreply.github.com>
329 lines
13 KiB
YAML
329 lines
13 KiB
YAML
name: Build all
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- release/*
|
|
- belt-printer
|
|
paths:
|
|
- 'deps/**'
|
|
- 'src/**'
|
|
- '**/CMakeLists.txt'
|
|
- 'version.inc'
|
|
- 'localization/**'
|
|
- 'resources/**'
|
|
- ".github/workflows/build_*.yml"
|
|
- 'scripts/build_preset_cache.*'
|
|
- 'scripts/flatpak/**'
|
|
- 'scripts/msix/**'
|
|
- 'tests/**'
|
|
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- release/*
|
|
paths:
|
|
- 'deps/**'
|
|
- 'deps_src/**'
|
|
- 'src/**'
|
|
- '**/CMakeLists.txt'
|
|
- 'version.inc'
|
|
- ".github/workflows/build_*.yml"
|
|
- 'build_linux.sh'
|
|
- 'build_release_vs.bat'
|
|
- 'build_release_vs2022.bat'
|
|
- 'build_win.bat'
|
|
- 'scripts/test_build_win.ps1'
|
|
- 'build_release_macos.sh'
|
|
- 'scripts/build_preset_cache.*'
|
|
- 'scripts/flatpak/**'
|
|
- 'scripts/msix/**'
|
|
- 'tests/**'
|
|
|
|
|
|
schedule:
|
|
- cron: '0 17 * * *' # run once a day at 1 AM Singapore time (UTC+8)
|
|
|
|
workflow_dispatch: # allows for manual dispatch
|
|
inputs:
|
|
build-deps-only:
|
|
description: 'Only build dependencies (bypasses caching)'
|
|
type: boolean
|
|
default: false
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
|
|
jobs:
|
|
# build_win.bat ships a test suite. Run it before the Windows builds.
|
|
check_build_script:
|
|
name: Windows build script tests
|
|
runs-on: windows-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
lfs: 'false'
|
|
|
|
# Windows PowerShell rather than pwsh: the suite drives build_win.bat
|
|
# through cmd, and the two differ in how they quote native arguments.
|
|
- name: Run the build script test suite
|
|
shell: powershell
|
|
run: .\scripts\test_build_win.ps1
|
|
|
|
build_linux:
|
|
strategy:
|
|
fail-fast: false
|
|
# SELF_HOSTED skips arm64 (no arm self-hosted server). amd64's empty arch
|
|
# is load-bearing: it keeps the historical 'linux-clang' deps cache key and
|
|
# the unsuffixed asset names.
|
|
matrix:
|
|
include: ${{ fromJSON(vars.SELF_HOSTED
|
|
&& '[{"arch":"","os":"orca-lnx-server"}]'
|
|
|| '[{"arch":"","os":"ubuntu-24.04"},{"arch":"aarch64","os":"ubuntu-24.04-arm"}]') }}
|
|
# Don't run scheduled builds on forks:
|
|
if: ${{ !cancelled() && (github.event_name != 'schedule' || github.repository == 'OrcaSlicer/OrcaSlicer') }}
|
|
uses: ./.github/workflows/build_check_cache.yml
|
|
with:
|
|
os: ${{ matrix.os }}
|
|
arch: ${{ matrix.arch }}
|
|
build-deps-only: ${{ inputs.build-deps-only || false }}
|
|
secrets: inherit
|
|
build_windows:
|
|
name: Build Windows ${{ matrix.arch }}
|
|
strategy:
|
|
fail-fast: false
|
|
# SELF_HOSTED skips arm64 (the self-hosted Windows server is x64-only).
|
|
matrix:
|
|
include: ${{ fromJSON(vars.SELF_HOSTED
|
|
&& '[{"arch":"x64","os":"orca-win-server","compiler":"clang"}]'
|
|
|| '[{"arch":"x64","os":"windows-latest","compiler":"clang"},{"arch":"arm64","os":"windows-11-arm","compiler":"clang"}]') }}
|
|
needs: check_build_script
|
|
# Don't run scheduled builds on forks:
|
|
if: ${{ !cancelled() && needs.check_build_script.result == 'success' && (github.event_name != 'schedule' || github.repository == 'OrcaSlicer/OrcaSlicer') }}
|
|
uses: ./.github/workflows/build_check_cache.yml
|
|
with:
|
|
os: ${{ matrix.os }}
|
|
arch: ${{ matrix.arch }}
|
|
compiler: ${{ matrix.compiler }}
|
|
build-deps-only: ${{ inputs.build-deps-only || false }}
|
|
force-build: ${{ github.event_name == 'schedule' }}
|
|
secrets: inherit
|
|
build_macos_arch:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
arch:
|
|
- arm64
|
|
- x86_64
|
|
# Don't run scheduled builds on forks:
|
|
if: ${{ !cancelled() && (github.event_name != 'schedule' || github.repository == 'OrcaSlicer/OrcaSlicer') }}
|
|
uses: ./.github/workflows/build_check_cache.yml
|
|
with:
|
|
os: ${{ vars.SELF_HOSTED && 'orca-macos-arm64' || 'macos-14' }}
|
|
arch: ${{ matrix.arch }}
|
|
build-deps-only: ${{ inputs.build-deps-only || false }}
|
|
force-build: ${{ github.event_name == 'schedule' }}
|
|
secrets: inherit
|
|
build_macos_universal:
|
|
name: Build macOS Universal
|
|
needs: build_macos_arch
|
|
if: ${{ !cancelled() && needs.build_macos_arch.result == 'success' && !inputs.build-deps-only && (github.event_name != 'schedule' || github.repository == 'OrcaSlicer/OrcaSlicer') }}
|
|
uses: ./.github/workflows/build_orca.yml
|
|
with:
|
|
os: ${{ vars.SELF_HOSTED && 'orca-macos-arm64' || 'macos-14' }}
|
|
arch: universal
|
|
macos-combine-only: true
|
|
secrets: inherit
|
|
# One test job per built arch, on the runner that built it.
|
|
unit_tests_linux_x86_64:
|
|
name: Linux x86_64
|
|
needs: build_linux
|
|
if: ${{ !cancelled() && success() }}
|
|
uses: ./.github/workflows/unit_tests.yml
|
|
with:
|
|
os: ${{ vars.SELF_HOSTED && 'orca-lnx-server' || 'ubuntu-24.04' }}
|
|
artifact: ${{ github.sha }}-tests-linux-x86_64
|
|
unit_tests_linux_aarch64:
|
|
name: Linux aarch64
|
|
needs: build_linux
|
|
if: ${{ !cancelled() && success() && !vars.SELF_HOSTED }}
|
|
uses: ./.github/workflows/unit_tests.yml
|
|
with:
|
|
os: ubuntu-24.04-arm
|
|
artifact: ${{ github.sha }}-tests-linux-aarch64
|
|
unit_tests_windows_x64:
|
|
name: Windows x64
|
|
needs: build_windows
|
|
if: ${{ !cancelled() && success() }}
|
|
uses: ./.github/workflows/unit_tests.yml
|
|
with:
|
|
os: ${{ vars.SELF_HOSTED && 'orca-win-server' || 'windows-latest' }}
|
|
artifact: ${{ github.sha }}-tests-windows-x64
|
|
unit_tests_windows_arm64:
|
|
name: Windows arm64
|
|
needs: build_windows
|
|
if: ${{ !cancelled() && success() && !vars.SELF_HOSTED }}
|
|
uses: ./.github/workflows/unit_tests.yml
|
|
with:
|
|
os: windows-11-arm
|
|
artifact: ${{ github.sha }}-tests-windows-arm64
|
|
test-dir: build-arm64/tests
|
|
unit_tests_macos_arm64:
|
|
name: macOS arm64
|
|
needs: build_macos_arch
|
|
if: ${{ !cancelled() && success() }}
|
|
uses: ./.github/workflows/unit_tests.yml
|
|
with:
|
|
os: ${{ vars.SELF_HOSTED && 'orca-macos-arm64' || 'macos-14' }}
|
|
artifact: ${{ github.sha }}-tests-macos-arm64
|
|
test-dir: build/arm64/tests
|
|
# Slice a two-colour cube through every shipped printer so all custom g-code
|
|
# (change_filament_gcode, machine start/end, etc.) is expanded - catches
|
|
# slicing regressions the static profile checks and unit tests can't see.
|
|
# Profile-only PRs are covered by check_profiles.yml's nightly binary; this
|
|
# covers src/engine PRs with the PR-built binary.
|
|
slice_check_linux:
|
|
name: Slice check (Linux ${{ vars.SELF_HOSTED && 'x86_64' || 'aarch64' }})
|
|
needs: build_linux
|
|
if: ${{ !cancelled() && success() }}
|
|
# Follows whichever Linux leg built the validator.
|
|
runs-on: ${{ vars.SELF_HOSTED && 'orca-lnx-server' || 'ubuntu-24.04-arm' }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v7
|
|
- name: Download profile validator
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
name: ${{ github.sha }}-profile-validator-linux-${{ vars.SELF_HOSTED && 'x86_64' || 'aarch64' }}
|
|
path: validator-bin
|
|
- name: Validate slice (expand custom g-code)
|
|
timeout-minutes: 60
|
|
run: |
|
|
chmod +x validator-bin/OrcaSlicer_profile_validator
|
|
./validator-bin/OrcaSlicer_profile_validator -p "${{ github.workspace }}/resources/profiles" -s -l 2
|
|
publish_test_results:
|
|
name: Publish Test Results
|
|
needs: [unit_tests_linux_x86_64, unit_tests_linux_aarch64, unit_tests_windows_x64, unit_tests_windows_arm64, unit_tests_macos_arm64]
|
|
if: ${{ !cancelled() }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download Test Results
|
|
uses: actions/download-artifact@v8
|
|
with:
|
|
pattern: test-results-*
|
|
path: test-results
|
|
# Best-effort: a read-only token (e.g. fork PRs) can't write the check, so
|
|
# don't let a publish failure fail the run. The test jobs gate correctness.
|
|
- name: Publish Test Results
|
|
continue-on-error: true
|
|
uses: EnricoMi/publish-unit-test-result-action@v2
|
|
with:
|
|
files: "test-results/**/*.xml"
|
|
- name: Delete Test Results
|
|
if: success()
|
|
uses: geekyeggo/delete-artifact@v6
|
|
with:
|
|
name: test-results-*
|
|
failOnError: false
|
|
flatpak:
|
|
name: "Flatpak"
|
|
container:
|
|
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-50
|
|
options: --privileged
|
|
volumes:
|
|
- /usr/local/lib/android:/usr/local/lib/android
|
|
- /usr/share/dotnet:/usr/share/dotnet
|
|
- /opt/ghc:/opt/ghc1
|
|
- /usr/local/share/boost:/usr/local/share/boost1
|
|
- /opt/hostedtoolcache:/opt/hostedtoolcache1
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
variant:
|
|
- arch: x86_64
|
|
runner: ubuntu-24.04
|
|
- arch: aarch64
|
|
runner: ubuntu-24.04-arm
|
|
# Don't run scheduled builds on forks; skip entirely on self-hosted runners
|
|
if: ${{ !cancelled() && !vars.SELF_HOSTED && (github.event_name != 'schedule' || github.repository == 'OrcaSlicer/OrcaSlicer') }}
|
|
|
|
runs-on: ${{ matrix.variant.runner }}
|
|
env:
|
|
date:
|
|
ver:
|
|
ver_pure:
|
|
# Belt-printer nightlies share the main nightly release but carry a `_belt`
|
|
# suffix so they never overwrite the main assets.
|
|
nightly_suffix: ${{ github.ref == 'refs/heads/belt-printer' && '_belt' || '' }}
|
|
steps:
|
|
- name: "Remove unneeded stuff to free disk space"
|
|
run:
|
|
rm -rf /usr/local/lib/android/* /usr/share/dotnet/* /opt/ghc1/* "/usr/local/share/boost1/*" /opt/hostedtoolcache1/*
|
|
- uses: actions/checkout@v7
|
|
- name: Get the version and date
|
|
run: |
|
|
ver_pure=$(grep 'set(SoftFever_VERSION' version.inc | cut -d '"' -f2)
|
|
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
|
ver="PR-${{ github.event.number }}"
|
|
git_commit_hash="${{ github.event.pull_request.head.sha }}"
|
|
else
|
|
ver=V$ver_pure
|
|
git_commit_hash="${{ github.sha }}"
|
|
fi
|
|
echo "ver=$ver" >> $GITHUB_ENV
|
|
echo "ver_pure=$ver_pure" >> $GITHUB_ENV
|
|
echo "date=$(date +'%Y%m%d')" >> $GITHUB_ENV
|
|
echo "git_commit_hash=$git_commit_hash" >> $GITHUB_ENV
|
|
shell: bash
|
|
# Manage flatpak-builder cache externally so PRs restore but never upload
|
|
- name: Restore flatpak-builder cache
|
|
if: github.event_name == 'pull_request'
|
|
uses: actions/cache/restore@v6
|
|
with:
|
|
path: .flatpak-builder
|
|
key: flatpak-builder-${{ matrix.variant.arch }}-${{ github.event.pull_request.base.sha }}
|
|
restore-keys: flatpak-builder-${{ matrix.variant.arch }}-
|
|
- name: Save/restore flatpak-builder cache
|
|
if: github.event_name != 'pull_request'
|
|
uses: actions/cache@v6
|
|
with:
|
|
path: .flatpak-builder
|
|
key: flatpak-builder-${{ matrix.variant.arch }}-${{ github.sha }}
|
|
restore-keys: flatpak-builder-${{ matrix.variant.arch }}-
|
|
- name: Disable debug info for faster CI builds
|
|
run: |
|
|
sed -i '/^build-options:/a\ no-debuginfo: true\n strip: true' \
|
|
scripts/flatpak/com.orcaslicer.OrcaSlicer.yml
|
|
shell: bash
|
|
- name: Inject git commit hash into Flatpak manifest
|
|
run: |
|
|
sed -i "/name: OrcaSlicer/{n;s|buildsystem: simple|buildsystem: simple\n build-options:\n env:\n git_commit_hash: \"$git_commit_hash\"|}" \
|
|
scripts/flatpak/com.orcaslicer.OrcaSlicer.yml
|
|
shell: bash
|
|
- uses: flatpak/flatpak-github-actions/flatpak-builder@master
|
|
with:
|
|
bundle: OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak
|
|
manifest-path: scripts/flatpak/com.orcaslicer.OrcaSlicer.yml
|
|
cache: false
|
|
arch: ${{ matrix.variant.arch }}
|
|
upload-artifact: false
|
|
- name: Upload artifacts Flatpak
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: 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
|
|
if: github.repository == 'OrcaSlicer/OrcaSlicer' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/belt-printer')
|
|
uses: WebFreak001/deploy-nightly@v3.2.0
|
|
with:
|
|
upload_url: https://uploads.github.com/repos/OrcaSlicer/OrcaSlicer/releases/137995723/assets{?name,label}
|
|
release_id: 137995723
|
|
asset_path: /__w/OrcaSlicer/OrcaSlicer/OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak
|
|
asset_name: OrcaSlicer-Linux-flatpak_nightly${{ env.nightly_suffix }}_${{ matrix.variant.arch }}.flatpak
|
|
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
|