OrcaSlicer/.github/workflows/build_all.yml
Ocraftyone 026499c5b7
Better CMake Defaults (#10294)
* Auto generate CMAKE_PREFIX_PATH/DESTDIR

* Auto set CMAKE_INSTALL_PREFIX

* Always default SLIC3R_STATIC to on

* Only allow one value for CMAKE_OSX_ARCHITECTURES

* Set arch for OpenSSL from CMAKE_OSX_ARCHITECTURES

* Set CMAKE_INSTALL_RPATH from CMAKE_PREFIX_PATH

* Default CMAKE_MACOSX_RPATH and CMAKE_MACOSX_BUNDLE to on

* Auto set BBL_RELEASE_TO_PUBLIC based on build config

* Default to GTK 3

* Fix linux debug build

Update find modules to also look for the debug variant of the libraries

* Set DEP_DEBUG and ORCA_INCLUDE_DEBUG_INFO based on CMAKE_BUILD_TYPE

* Add a fallback value for Windows SDK if the env variables are not set

* Reflect CMake changes in the build scripts

* Add missing line

* Fix auto setting DEP_DEBUG and ORCA_INCLUDE_DEBUG_INFO

* Update dep folder name for linux in GH actions

* Invert dep-folder-name conditions

`''` is considered a falsy value, which was causing the value to always be set to 'OrcaSlicer_dep'

* Properly handle finding the debug version of libnoise

* Convert FindNLopt.cmake to a config mode wrapper

* Use separate build directory for debug builds on Linux

* Move find_package for libnoise

* Cleanup and improve linux build script

- Add dry run
- Add build in RelWithDebInfo
- Add function to print and run commands

* Remove linux destdir deprecation and cleanup

* Fix flatpak build

* Disable fail fast for flatpak builds

* Flatpak improvements

- Build wxWidgets using deps cmake
- Improve handling of space freeing commands while building deps
- Allow cmake to directly download deps
- Set needed flags within cmake instead of the build manifest

* Print clean build commands

* Implement shellcheck recommendations

* Cleanup

* Fix CMakeLists.txt syntax by replacing empty elseif with else statement

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
2025-10-25 22:05:09 +08:00

132 lines
4.3 KiB
YAML

name: Build all
on:
push:
branches:
- main
- release/*
paths:
- 'deps/**'
- 'src/**'
- '**/CMakeLists.txt'
- 'version.inc'
- 'localization/**'
- 'resources/**'
- ".github/workflows/build_*.yml"
- 'scripts/flatpak/**'
pull_request:
branches:
- main
- release/*
paths:
- 'deps/**'
- 'src/**'
- '**/CMakeLists.txt'
- 'version.inc'
- ".github/workflows/build_*.yml"
- 'build_linux.sh'
- 'build_release_vs2022.bat'
- 'build_release_macos.sh'
- 'scripts/flatpak/**'
schedule:
- cron: '35 7 * * *' # run once a day near midnight US Pacific time
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.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build_all:
name: Build All
strategy:
fail-fast: false
matrix:
include:
# Deprecate 20.04appimage
# - os: ubuntu-20.04
- os: ubuntu-24.04
- os: windows-latest
- os: macos-14
arch: arm64
uses: ./.github/workflows/build_check_cache.yml
with:
os: ${{ matrix.os }}
arch: ${{ matrix.arch }}
build-deps-only: ${{ inputs.build-deps-only || false }}
force-build: ${{ github.event_name == 'schedule' }}
secrets: inherit
flatpak:
name: "Flatpak"
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-47
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
strategy:
fail-fast: false
matrix:
variant:
- arch: x86_64
runner: ubuntu-24.04
- arch: aarch64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.variant.runner }}
env:
date:
ver:
ver_pure:
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/*"
- uses: actions/checkout@v5
- 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=""
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
- uses: flathub-infra/flatpak-github-actions/flatpak-builder@master
with:
bundle: OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak
manifest-path: scripts/flatpak/io.github.softfever.OrcaSlicer.yml
cache: true
arch: ${{ matrix.variant.arch }}
upload-artifact: false
- name: Upload artifacts Flatpak
uses: actions/upload-artifact@v4
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.ref == 'refs/heads/main'}}
uses: WebFreak001/deploy-nightly@v3.2.0
with:
upload_url: https://uploads.github.com/repos/SoftFever/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_${{ 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