Skip to content

orca-slicer

orca-slicer #41

Workflow file for this run

---
name: orca-slicer
# orca-slicer-git compresses to ~164 MB, over GitHub's 100 MB push limit, so it
# cannot go through build-pacman-repo into the Pages repo -- that push is
# refused outright and takes every other package's update down with it. This
# job builds it separately and serves it as its own pacman repository hosted in
# a GitHub Release.
#
# This is a real from-source build of OrcaSlicer and its whole bundled
# dependency stack: budget ~2h45m.
on:
schedule:
- cron: "10 3 * * *"
workflow_dispatch:
inputs:
force:
description: "Rebuild and re-upload even if this revision is already published"
type: boolean
default: false
permissions:
contents: write
concurrency:
group: "${{ github.workflow }}"
cancel-in-progress: false
env:
PKGDIR: release-pkgbuilds/orca-slicer-git
REPO_NAME: orca
RELEASE_TAG: orca-repo
UPSTREAM: https://github.com/SoftFever/OrcaSlicer.git
GH_REPO: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 330
steps:
- name: Checkout
uses: actions/checkout@v7
with:
submodules: recursive
- name: Free Disk Space (Ubuntu)
uses: BRAINSia/free-disk-space@v2
with:
tool-cache: false
mandb: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
# Never reclaim the swapfile here. This build was being OOM-killed,
# not running out of disk, and those 4 GB are the headroom it needs.
swap-storage: false
- name: Work out the upstream revision
id: ver
run: |
set -euo pipefail
# Mirrors the PKGBUILD's pkgver() exactly. A blobless clone gives the
# full commit graph that rev-list --count needs without paying for
# OrcaSlicer's resource tree, and `git show` lazily fetches the single
# blob we actually read.
git clone --filter=blob:none --no-checkout "$UPSTREAM" orca-src
cd orca-src
commit="$(git rev-parse --short=7 HEAD)"
revision="$(git rev-list --count HEAD)"
version="$(git show HEAD:version.inc \
| sed -n 's/set(SoftFever_VERSION "\([^"]*\)-.*".*/\1/p')"
if [ -z "$version" ] || [ -z "$revision" ]; then
echo "::error::could not derive pkgver from $UPSTREAM"
exit 1
fi
pkgver="${version}.r${revision}.${commit}"
echo "upstream pkgver: $pkgver"
echo "pkgver=$pkgver" >> "$GITHUB_OUTPUT"
cd .. && rm -rf orca-src
- name: Decide whether to build
id: gate
env:
GH_TOKEN: ${{ github.token }}
PKGVER: ${{ steps.ver.outputs.pkgver }}
run: |
set -euo pipefail
# The published release is the state. Nothing is committed per build,
# so there is no checked-in version to drift out of sync.
build=false
if [ "${{ inputs.force }}" = "true" ]; then
build=true
echo "Forced rebuild requested."
else
assets="$(gh release view "$RELEASE_TAG" --json assets --jq '.assets[].name' 2>/dev/null || true)"
if ! grep -q "^orca-slicer-git-${PKGVER}-" <<<"$assets"; then
build=true
echo "orca-slicer-git ${PKGVER} is not published yet."
else
echo "orca-slicer-git ${PKGVER} is already published."
fi
fi
echo "build=$build" >> "$GITHUB_OUTPUT"
- name: Build the packages and their pacman database
if: steps.gate.outputs.build == 'true'
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
set -euo pipefail
docker run --rm \
-v "${{ github.workspace }}:/work" \
-e REPO_NAME="$REPO_NAME" \
-e GPG_SIGNING_KEY \
-e GPG_PASSPHRASE \
-w /work \
archlinux:base-devel \
bash .github/scripts/build-orca-slicer.sh
- name: Upload the resource samples
# Always, and separate from the build step, so a build that fails still
# leaves the memory/disk trace behind. The log tail is unreliable here:
# cmake's install chatter floods it faster than the API will serve it.
if: always()
uses: actions/upload-artifact@v7
with:
name: orca-build-resources
path: resources.log
if-no-files-found: warn
- name: Publish to the pacman repo release
if: steps.gate.outputs.build == 'true'
env:
GH_TOKEN: ${{ github.token }}
PKGVER: ${{ steps.ver.outputs.pkgver }}
run: |
set -euo pipefail
ls -lh orca-out/
# Notes live in .github/release-notes/ so the same text is used at
# creation and whenever sign-backfill refreshes it.
if ! gh release view "$RELEASE_TAG" >/dev/null 2>&1; then
gh release create "$RELEASE_TAG" \
--title "orca-slicer pacman repo" --notes-file .github/release-notes/orca.md
else
gh release edit "$RELEASE_TAG" --notes-file .github/release-notes/orca.md
fi
# Build the upload list from files that actually exist. gh treats every
# argument as a pattern and fails the whole call on one that matches
# nothing, so naming the signing artifacts unconditionally threw away a
# finished 2.5 hour build the first time this ran without the signing
# secrets configured. nullglob covers *.sig but not a literal path.
uploads=(
orca-out/orca-slicer-git-*.pkg.tar.zst
"orca-out/${REPO_NAME}.db" "orca-out/${REPO_NAME}.files"
"orca-out/${REPO_NAME}.db.tar.gz" "orca-out/${REPO_NAME}.files.tar.gz"
)
shopt -s nullglob
uploads+=( orca-out/*.sig )
shopt -u nullglob
[ -f orca-out/xerootg.asc ] && uploads+=( orca-out/xerootg.asc )
# Signatures go up in the same call as what they sign, so there is no
# window where pacman can fetch a package it cannot verify.
printf 'uploading: %s\n' "${uploads[@]}"
gh release upload "$RELEASE_TAG" "${uploads[@]}" --clobber
# Drop superseded packages, but only once the new ones are up. Both
# greps come up empty in the steady state, and an empty grep exits 1,
# which under pipefail would fail a run that already published fine.
# Same trap: with no signatures on disk the .sig glob matches nothing,
# and `ls` on a missing path exits non-zero, which under set -e would
# fail a run that has already published successfully.
keep="$(cd orca-out && shopt -s nullglob && \
printf '%s\n' orca-slicer-git-*.pkg.tar.zst orca-slicer-git-*.pkg.tar.zst.sig \
| tr '\n' '|')"
gh release view "$RELEASE_TAG" --json assets --jq '.assets[].name' \
| { grep -E '^orca-slicer-git.*\.pkg\.tar\.zst(\.sig)?$' || true; } \
| { grep -vE "^(${keep%|})$" || true; } \
| while read -r old; do
echo "Removing superseded asset $old"
gh release delete-asset "$RELEASE_TAG" "$old" --yes
done
{
echo "### Published orca-slicer-git ${PKGVER}"
echo
echo '```'
( cd orca-out && ls -lh ./*.pkg.tar.zst )
echo '```'
} >> "$GITHUB_STEP_SUMMARY"