Update Github workflow to use sccache for linux builds

This commit is contained in:
sentientstardust
2026-05-16 08:41:18 +01:00
parent 53164d063b
commit a0b522628a
3 changed files with 36 additions and 11 deletions

View File

@ -9,10 +9,14 @@ on:
description: 'Only build dependencies (bypasses caching)' description: 'Only build dependencies (bypasses caching)'
type: boolean type: boolean
default: false default: false
build_linux: build_linux:
description: 'Build Linux and Flatpak artifacts' description: 'Build Linux AppImage artifacts'
type: boolean type: boolean
default: false default: false
build_flatpak:
description: 'Build Linux Flatpak artifacts'
type: boolean
default: false
build_windows: build_windows:
description: 'Build Windows artifacts' description: 'Build Windows artifacts'
type: boolean type: boolean
@ -31,7 +35,7 @@ on:
required: false required: false
default: '' default: ''
publish_release: publish_release:
description: 'Publish Windows and macOS artifacts to a GitHub release' description: 'Publish selected Windows, macOS, and Linux artifacts to a GitHub release'
type: boolean type: boolean
default: true default: true
@ -92,10 +96,12 @@ jobs:
name: Publish Release name: Publish Release
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
needs: needs:
- build_linux
- build_windows - build_windows
- build_macos_arch - build_macos_arch
- build_macos_universal - build_macos_universal
if: ${{ always() && github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' && (inputs.publish_release || false) && !inputs.build-deps-only && (inputs.build_windows || inputs.build_macos) && (inputs.build_windows == false || needs.build_windows.result == 'success') && (inputs.build_macos == false || needs.build_macos_arch.result == 'success') && (inputs.build_macos == false || needs.build_macos_universal.result == 'success' || needs.build_macos_universal.result == 'skipped') }} - flatpak
if: ${{ always() && github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' && (inputs.publish_release || false) && !inputs.build-deps-only && (inputs.build_windows || inputs.build_macos || inputs.build_linux || inputs.build_flatpak || vars.BUILD_LINUX == 'true' || vars.BUILD_FLATPAK == 'true') && (inputs.build_windows == false || needs.build_windows.result == 'success') && (inputs.build_macos == false || needs.build_macos_arch.result == 'success') && (inputs.build_macos == false || needs.build_macos_universal.result == 'success' || needs.build_macos_universal.result == 'skipped') && (((inputs.build_linux || false) || vars.BUILD_LINUX == 'true') == false || needs.build_linux.result == 'success') && (((inputs.build_flatpak || false) || vars.BUILD_FLATPAK == 'true') == false || needs.flatpak.result == 'success') }}
env: env:
GH_TOKEN: ${{ github.token }} GH_TOKEN: ${{ github.token }}
steps: steps:
@ -128,7 +134,9 @@ jobs:
mapfile -t assets < <(find release-artifacts -type f \( \ mapfile -t assets < <(find release-artifacts -type f \( \
-name "OrcaSlicer-ImageMap_Mac_*_V$version.dmg" -o \ -name "OrcaSlicer-ImageMap_Mac_*_V$version.dmg" -o \
-name "OrcaSlicer-ImageMap_Windows_V${version}_portable.zip" -o \ -name "OrcaSlicer-ImageMap_Windows_V${version}_portable.zip" -o \
-name "OrcaSlicer-ImageMap_Windows_Installer_V${version}.exe" \ -name "OrcaSlicer-ImageMap_Windows_Installer_V${version}.exe" -o \
-name "OrcaSlicer_Linux_AppImage*_V${version}.AppImage" -o \
-name "OrcaSlicer-Linux-flatpak_V${version}_*.flatpak" \
\) ! -name '*profile_validator*' | sort) \) ! -name '*profile_validator*' | sort)
if [ "${#assets[@]}" -eq 0 ]; then if [ "${#assets[@]}" -eq 0 ]; then
@ -211,7 +219,7 @@ jobs:
runner: ubuntu-24.04 runner: ubuntu-24.04
- arch: aarch64 - arch: aarch64
runner: ubuntu-24.04-arm runner: ubuntu-24.04-arm
if: ${{ !cancelled() && (github.event_name != 'create' || (github.event.ref_type == 'branch' && startsWith(github.event.ref, 'release/'))) && !vars.SELF_HOSTED && ((inputs.build_linux || false) || vars.BUILD_LINUX == 'true') }} if: ${{ !cancelled() && (github.event_name != 'create' || (github.event.ref_type == 'branch' && startsWith(github.event.ref, 'release/'))) && !vars.SELF_HOSTED && !inputs.build-deps-only && ((inputs.build_flatpak || false) || vars.BUILD_FLATPAK == 'true') }}
runs-on: ${{ matrix.variant.runner }} runs-on: ${{ matrix.variant.runner }}
env: env:

View File

@ -34,7 +34,7 @@ jobs:
ubuntu-ver-str: '_Ubuntu2404' ubuntu-ver-str: '_Ubuntu2404'
ORCA_UPDATER_SIG_KEY: ${{ secrets.ORCA_UPDATER_SIG_KEY }} ORCA_UPDATER_SIG_KEY: ${{ secrets.ORCA_UPDATER_SIG_KEY }}
SCCACHE_DIR: ${{ github.workspace }}/.sccache SCCACHE_DIR: ${{ github.workspace }}/.sccache
SCCACHE_CACHE_SIZE: 5G SCCACHE_CACHE_SIZE: 2G
steps: steps:
- name: Checkout - name: Checkout
@ -57,7 +57,7 @@ jobs:
useCloudCache: true useCloudCache: true
- name: Restore sccache cache - name: Restore sccache cache
if: ${{ !vars.SELF_HOSTED && (runner.os == 'Windows' || (runner.os == 'macOS' && !inputs.macos-combine-only)) }} if: ${{ !vars.SELF_HOSTED && (runner.os == 'Windows' || runner.os == 'Linux' || (runner.os == 'macOS' && !inputs.macos-combine-only)) }}
uses: actions/cache@v5 uses: actions/cache@v5
with: with:
path: ${{ env.SCCACHE_DIR }} path: ${{ env.SCCACHE_DIR }}
@ -444,6 +444,15 @@ jobs:
if: runner.os == 'Linux' && !vars.SELF_HOSTED if: runner.os == 'Linux' && !vars.SELF_HOSTED
uses: ./.github/actions/apt-install-deps uses: ./.github/actions/apt-install-deps
- name: Install sccache Linux
if: runner.os == 'Linux' && !vars.SELF_HOSTED
shell: bash
run: |
sudo apt install -y sccache
echo "CMAKE_C_COMPILER_LAUNCHER=sccache" >> "$GITHUB_ENV"
echo "CMAKE_CXX_COMPILER_LAUNCHER=sccache" >> "$GITHUB_ENV"
sccache --zero-stats
# Tests must built at the same time as the slicer; # Tests must built at the same time as the slicer;
# if you untangle them feel free to separate them here too # if you untangle them feel free to separate them here too
- name: Build slicer and tests - name: Build slicer and tests
@ -456,6 +465,14 @@ jobs:
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 tar -cvpf build_tests.tar build/tests
- name: Show sccache stats Linux
if: ${{ always() && runner.os == 'Linux' && !vars.SELF_HOSTED }}
shell: bash
run: |
if command -v sccache >/dev/null 2>&1; then
sccache --show-stats
fi
# Use tar because upload-artifacts won't always preserve directory structure # Use tar because upload-artifacts won't always preserve directory structure
# and doesn't preserve file permissions # and doesn't preserve file permissions
- name: Upload Test Artifact - name: Upload Test Artifact

View File

@ -1 +1 @@
1.0.11 1.0.12