mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-14 00:52:04 +00:00
The env var check was gated inside the .git directory check, so Flatpak builds (which exclude .git from the sandbox) always fell back to "0000000". Lift the env var check to top level and inject the commit hash into the Flatpak manifest via build-options.env.
227 lines
8.4 KiB
YAML
227 lines
8.4 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/**'
|
|
- 'deps_src/**'
|
|
- 'src/**'
|
|
- '**/CMakeLists.txt'
|
|
- 'version.inc'
|
|
- ".github/workflows/build_*.yml"
|
|
- 'build_linux.sh'
|
|
- 'build_release_vs2022.bat'
|
|
- 'build_release_macos.sh'
|
|
- 'scripts/flatpak/**'
|
|
|
|
|
|
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_linux:
|
|
strategy:
|
|
fail-fast: false
|
|
# 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: ubuntu-24.04
|
|
build-deps-only: ${{ inputs.build-deps-only || false }}
|
|
secrets: inherit
|
|
build_windows:
|
|
# 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: windows-latest
|
|
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
|
|
unit_tests:
|
|
name: Unit Tests
|
|
runs-on: ubuntu-24.04
|
|
needs: build_linux
|
|
if: ${{ !cancelled() && success() }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
sparse-checkout: |
|
|
.github
|
|
scripts
|
|
tests
|
|
- name: Apt-Install Dependencies
|
|
uses: ./.github/actions/apt-install-deps
|
|
- name: Restore Test Artifact
|
|
uses: actions/download-artifact@v7
|
|
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@v6
|
|
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:
|
|
name: "Flatpak"
|
|
container:
|
|
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-48
|
|
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:
|
|
if: ${{ !cancelled() && (github.event_name != 'schedule' || github.repository == 'OrcaSlicer/OrcaSlicer') }}
|
|
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/*" /opt/hostedtoolcache1/*
|
|
- uses: actions/checkout@v6
|
|
- 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@v4
|
|
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@v4
|
|
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 '0,/^finish-args:/s//build-options:\n no-debuginfo: true\n strip: true\nfinish-args:/' \
|
|
scripts/flatpak/io.github.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/io.github.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/io.github.orcaslicer.OrcaSlicer.yml
|
|
cache: false
|
|
arch: ${{ matrix.variant.arch }}
|
|
upload-artifact: false
|
|
- name: Upload artifacts Flatpak
|
|
uses: actions/upload-artifact@v6
|
|
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'
|
|
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_${{ 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
|