Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
name: Release
on:
# Manually runnable so a packaging change can be proven before a tag is
# cut. The release and publish jobs are all tag-only, so a dispatch run
# builds Windows, Linux and the sdist/wheel, and publishes nothing.
workflow_dispatch:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build-windows:
# Both architectures. ARM64 needs two things x86_64 does not, both
# below; briefcase itself has supported ARM64 Windows all along.
strategy:
fail-fast: false
matrix:
include:
- runs-on: windows-latest
arch: x86_64
- runs-on: windows-11-arm
arch: arm64
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v7
with:
enable-cache: true
python-version: "3.12"
- run: uv sync --frozen --python 3.12
# briefcase installs the app's requirements into the EMBEDDED python
# as wheels only -- it never compiles -- so a dependency with no
# published win_arm64 wheel comes back as
# Could not find a version that satisfies the requirement moderngl
# (from versions: none)
# even though the runner just built it fine for the venv. moderngl,
# glcontext and setproctitle are the three; all compile with MSVC
# ARM64 in seconds. Build them here and hand pip a local wheelhouse.
#
# Drop a package from this list if it starts publishing ARM64 wheels;
# an extra name here is harmless, a missing one fails the build loudly.
# If this starts failing on or after 2026-09-21, suspect the runner
# image: windows-11-arm migrates to Visual Studio 2026 by default that
# day (actions/runner-images#14602). These three are the only things
# we compile, so a toolset change lands here first. The MSVC ABI has
# been stable for CPython extensions since VS2015, so a rebuild on a
# newer toolset should just work -- but this is where to look.
- name: Build the wheels that are not published for ARM64
if: matrix.arch == 'arm64'
run: |
uv run --python 3.12 python -m pip wheel --no-deps -w wheelhouse moderngl glcontext setproctitle
- name: Build Windows installer
env:
# Empty on x86_64, where every dependency has a wheel already.
PIP_FIND_LINKS: ${{ matrix.arch == 'arm64' && format('{0}\wheelhouse', github.workspace) || '' }}
run: |
uv run --python 3.12 briefcase create windows app
uv run --python 3.12 briefcase build windows app
uv run --python 3.12 briefcase package windows app
# briefcase names the msi without the architecture, so both legs
# produce BelfrySCAD-<version>.msi. The release job downloads every
# artifact with merge-multiple, where identical names collide and one
# silently overwrites the other -- v1.35.0 shipped with the ARM64
# installer lost that way, and nothing failed. The flatpaks were
# unaffected only because briefcase puts the arch in their filenames.
- name: Name the installer for its architecture
shell: bash
run: |
set -euo pipefail
MSI="$(ls dist/*.msi)"
test -n "$MSI" || { echo "no msi produced"; exit 1; }
mv "$MSI" "${MSI%.msi}-${{ matrix.arch }}.msi"
ls dist/
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: windows-${{ matrix.arch }}
path: dist/*.msi
probe-windows-vs2026:
# PROBE, dispatch-only, outside release.needs.
#
# windows-11-arm migrates to Visual Studio 2026 by default over the week
# beginning 2026-09-21 (actions/runner-images#14602). The three wheels we
# build from sdist are the only things this project compiles, so a
# toolset change surfaces there first and nowhere else.
#
# windows-11-vs2026-arm is the label that image is already available
# under, so the migration can be tested before it happens rather than
# discovered by a red release.
if: github.event_name == 'workflow_dispatch'
runs-on: windows-11-vs2026-arm
steps:
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v7
with:
enable-cache: true
python-version: "3.12"
- name: Show the toolchain
run: |
python -c "import platform; print('machine:', platform.machine()); print('compiler:', platform.python_compiler())"
if (Test-Path "C:\Program Files\Microsoft Visual Studio") { Get-ChildItem "C:\Program Files\Microsoft Visual Studio" -Name }
- run: uv sync --frozen --python 3.12
- name: Build the wheels that are not published for ARM64
run: |
uv run --python 3.12 python -m pip wheel --no-deps -w wheelhouse moderngl glcontext setproctitle
- name: Build Windows installer
env:
PIP_FIND_LINKS: ${{ github.workspace }}\wheelhouse
run: |
uv run --python 3.12 briefcase create windows app
uv run --python 3.12 briefcase build windows app
uv run --python 3.12 briefcase package windows app
- name: Name the installer for its architecture
shell: bash
run: |
set -euo pipefail
MSI="$(ls dist/*.msi)"
mv "$MSI" "${MSI%.msi}-arm64-vs2026.msi"
ls dist/
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: windows-arm64-vs2026
path: dist/*.msi
build-linux:
# x86_64 only. An aarch64 AppImage was tried and does not work:
#
# * PySide6's only Linux ARM wheel is manylinux_2_39_aarch64, so the
# container has to be manylinux_2_39 -- the 2.28 image this project
# otherwise uses contains no installable PySide6 at all.
# * moderngl and glcontext publish no aarch64 wheels whatsoever, so
# that container then has to compile them, and it has no clang++.
# * briefcase's AppImage template has no system_requires step, no env
# hook and no package step, so there is no supported way to put a
# compiler in it.
#
# Linux ARM is therefore a source install needing a C++ toolchain, not
# a packaging target. Revisit if moderngl ships aarch64 wheels.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install build dependencies
run: sudo apt-get update && sudo apt-get install -y libx11-dev libegl1-mesa-dev
- uses: astral-sh/setup-uv@v7
with:
enable-cache: true
python-version: "3.12"
- run: uv sync --frozen --python 3.12
# briefcase 0.4.5 cannot build an AppImage at all right now: its
# template's v0.4.5 branch reads cookiecutter.host_arch without
# declaring it in cookiecutter.json (upstream 9cfe6a7, 2026-09-08), and
# cookiecutter silently drops an undeclared key, so `create` dies with
# "'OrderedDict object' has no attribute 'host_arch'". Pointing at the
# older v0.4.4 branch is not a way out either -- its support package
# leaves the build container with no pip -- and briefcase takes a branch
# name, not the commit before the break.
#
# The Windows job needs 0.4.5 (its template is the first with
# MajorUpgrade, so the MSI upgrades in place instead of stacking up);
# this job does not. So install the last briefcase that builds an
# AppImage, here only. Delete this step once upstream declares the key.
- name: Pin briefcase for the AppImage build
run: uv pip install "briefcase==0.4.2"
# --no-sync, or `uv run` re-syncs from the lock file on every call and
# puts 0.4.5 straight back -- which is exactly what happened the first
# time this step was written without it.
- name: Build Linux AppImage
run: |
uv run --no-sync --python 3.12 briefcase create linux appimage
uv run --no-sync --python 3.12 briefcase build linux appimage
# briefcase hands linuxdeploy every folder in the AppDir containing a
# .so, PySide6's among them, so all of Qt is copied into usr/lib beside
# the copy the wheel already shipped -- 129 libraries twice, most of the
# download. `build` has populated the AppDir and packed it by now; this
# deduplicates the tree and repacks, so `package` picks up the smaller
# image. It also drops libxkbcommon, whose -x11 half is not bundled and
# which segfaulted Qt at startup on newer distros (#430). See
# scripts/fix_appimage_libs.py.
- name: Drop the duplicate Qt and repack
run: |
set -euo pipefail
# Found, not hardcoded: `briefcase package` copies from exactly the
# path `build` wrote, and the bundle layout is briefcase's to
# change. Repacking to any other name would ship the fat image.
IMAGE="$(find build -name '*.AppImage' -type f | head -1)"
APPDIR="$(find build -name '*.AppDir' -type d | head -1)"
test -n "$IMAGE" -a -n "$APPDIR" || { echo "AppImage/AppDir not found"; exit 1; }
BEFORE=$(stat -c%s "$IMAGE")
python3 scripts/fix_appimage_libs.py "$APPDIR"
# Fetched rather than reused: linuxdeploy carries appimagetool
# inside its own AppImage and extracts it to a temp directory
# INSIDE the build container, so nothing lands on the runner. The
# continuous build is what linuxdeploy itself runs, which keeps the
# runtime -- and so the libfuse requirement -- the same as before.
TOOL=/tmp/appimagetool
curl -fsSL --retry 3 -o "$TOOL" \
https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
chmod +x "$TOOL"
rm -f "$IMAGE"
ARCH=x86_64 APPIMAGE_EXTRACT_AND_RUN=1 "$TOOL" "$APPDIR" "$IMAGE"
AFTER=$(stat -c%s "$IMAGE")
echo "AppImage: $((BEFORE / 1048576))MB -> $((AFTER / 1048576))MB"
# A repack that saved nothing means the dedupe silently missed.
test "$AFTER" -lt "$BEFORE" || { echo "no size reduction"; exit 1; }
# The AppImage is the one artifact that cannot be smoke-tested by
# building it, so run it. --version exits without needing a display.
#
# And then start Qt for real. --version never loads the platform plugin,
# which is why #430 -- a segfault in QApplication() on every distro
# newer than the build container -- shipped in four releases with this
# job green throughout.
- name: Check the repacked AppImage runs
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y xvfb libxkbcommon-x11-0 libxkbcommon0 \
libegl1 libgl1 libxcb-cursor0 libxcb-icccm4 libxcb-keysyms1 \
libxcb-shape0 libxcb-xinerama0
IMAGE="$(find build -name '*.AppImage' -type f | head -1)"
chmod +x "$IMAGE"
APPIMAGE_EXTRACT_AND_RUN=1 "$IMAGE" --version
"$IMAGE" --appimage-extract > /dev/null
cd squashfs-root
xvfb-run -a env PYTHONPATH=usr/app:usr/app_packages \
usr/python/bin/python3 -u -s -X utf8 \
-c "import PySide6.QtWidgets as w, sys; a=w.QApplication(sys.argv); print('qt ok')"
- name: Package Linux AppImage
run: uv run --no-sync --python 3.12 briefcase package linux appimage
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: linux-x86_64
path: dist/*.AppImage
build-flatpak:
# Both architectures. Unlike the AppImage, ARM works here: the Flatpak
# SDK has a compiler, so the two dependencies with no aarch64 wheels --
# moderngl and glcontext -- build from sdist in about a minute.
strategy:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-latest
arch: x86_64
- runs-on: ubuntu-24.04-arm
arch: aarch64
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v5
- name: Install flatpak
run: |
sudo apt-get update
sudo apt-get install -y flatpak flatpak-builder
flatpak remote-add --if-not-exists --user flathub \
https://flathub.org/repo/flathub.flatpakrepo
# Cached because the runtime and SDK together are well over a
# gigabyte, and they change only when the pinned version does.
- name: Cache the Flatpak runtime
uses: actions/cache@v6
with:
path: ~/.local/share/flatpak
key: flatpak-24.08-${{ matrix.arch }}
- name: Install the runtime and SDK
run: |
flatpak install --user --noninteractive flathub \
org.freedesktop.Platform//24.08 org.freedesktop.Sdk//24.08
# glcontext has no aarch64 wheel, so uv builds it from sdist here on
# the host to give briefcase its dependencies. Its x11 backend needs
# X11/Xlib.h and its headless backend EGL/egl.h; moderngl links
# nothing. Harmless on x86_64, where a wheel means nothing compiles.
- name: Install headers for the from-source builds
run: |
sudo apt-get install -y libx11-dev libegl1-mesa-dev libgl1-mesa-dev
- uses: astral-sh/setup-uv@v7
with:
enable-cache: true
python-version: "3.12"
- run: uv sync --frozen --python 3.12
- name: Build the Flatpak
run: |
set -euo pipefail
uv run --no-sync --python 3.12 briefcase create linux flatpak
# briefcase's Flatpak template overrides CC to gcc -- clang is not
# in the SDK, and python-standalone is configured with it -- but
# not CXX, so a C++ extension still reaches for clang++ and dies.
# Nothing compiles on x86_64 (every dependency has a wheel), which
# is why this has gone unnoticed upstream; on aarch64 moderngl and
# glcontext build from sdist and hit it immediately.
#
# Fix submitted as beeware/briefcase-linux-flatpak-template#85.
# Drop this once it lands and the pinned template carries it.
MANIFEST="$(find build -name manifest.yml | head -1)"
test -n "$MANIFEST" || { echo "manifest not found"; exit 1; }
sed -i 's|CC="gcc -pthread" /app/bin/python3|CC="gcc -pthread" CXX="g++ -pthread" /app/bin/python3|' "$MANIFEST"
grep -q 'CXX=' "$MANIFEST" || { echo "CXX patch did not apply"; exit 1; }
uv run --no-sync --python 3.12 briefcase build linux flatpak
# The same lesson the AppImage job learned the hard way in #430: a
# build that succeeds proves nothing about a binary that starts. Run
# it, and then start Qt for real -- --version never loads a platform
# plugin, which is how a QApplication() segfault shipped four times
# with that job green.
#
# offscreen rather than xvfb: the point is to load Qt's plugin stack
# inside the sandbox, and offscreen does that without the Flatpak
# needing an X server handed in.
- name: Check the Flatpak runs
run: |
set -euo pipefail
flatpak run --user com.belfrydw.belfryscad --version
# --command, because the Flatpak's own command is the app: without
# it the -c would be handed to BelfrySCAD as an argument instead of
# to Python. Paths are the ones the briefcase template installs to.
flatpak run --user \
--command=/app/bin/python3 \
--env=QT_QPA_PLATFORM=offscreen \
--env=PYTHONPATH=/app/briefcase/app:/app/briefcase/app_packages \
com.belfrydw.belfryscad \
-c "import PySide6.QtWidgets as w, sys; a=w.QApplication(sys.argv); print('qt ok')"
- name: Package the Flatpak
run: uv run --no-sync --python 3.12 briefcase package linux flatpak
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: linux-flatpak-${{ matrix.arch }}
path: dist/*.flatpak
build-pypi:
# Pure Python -- one sdist and one py3-none-any wheel, so no matrix.
# Runs on workflow_dispatch as well, to prove the sdist/wheel still
# build; the publish jobs below are the tag-only part.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v7
with:
enable-cache: true
python-version: "3.12"
- run: uv build
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: pypi-dist
path: dist/*
publish-testpypi:
needs: [build-pypi]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
# The pypi environment, not a separate testpypi one: one environment to
# create, and one environment name to enter on both indexes' trusted
# publisher forms. The name is part of the OIDC subject PyPI matches
# against, so it is load-bearing even with no protection rules on it.
environment: pypi
# OIDC trusted publishing: no API token is stored anywhere. id-token
# write is what mints the short-lived OIDC credential, and job-level
# permissions replace the workflow-level block wholesale rather than
# adding to it, so contents has to be restated.
#
# openscad_cpp_evaluator uses token auth instead, because PyPI's
# trusted-publisher matcher does not yet recognise GitHub's immutable
# subject claims, emitted with no opt-out by repos created after
# 2026-07-15. That repo was created 2026-07-24; this one 2026-06-24, so
# it predates the change and matches the way PyPI still expects.
permissions:
id-token: write
contents: read
steps:
- uses: actions/download-artifact@v8
with:
name: pypi-dist
path: dist
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: dist
# TestPyPI is a dry run we may re-upload to under one version while
# fixing a packaging problem. Never set this on publish-pypi -- a
# real PyPI filename collision must fail loudly, not skip silently.
skip-existing: true
publish-pypi:
needs: [publish-testpypi]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
# The environment carries no protection rules today, so a tag runs
# straight through to PyPI with nothing to stop it -- and a PyPI upload
# cannot be undone or replaced at the same version. Adding a required
# reviewer to the environment reinstates that brake; GitHub permits
# approving your own deployment unless "Prevent self-review" is ticked.
environment: pypi
# OIDC trusted publishing -- see the comment on publish-testpypi above.
permissions:
id-token: write
contents: read
steps:
- uses: actions/download-artifact@v8
with:
name: pypi-dist
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist
release:
needs: [build-windows, build-linux, build-flatpak, build-pypi]
# Only a tag publishes. A workflow_dispatch run exists to prove the
# builds still work, and must not create a release.
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v8
with:
path: artifacts
merge-multiple: true
- name: Create the draft release
uses: softprops/action-gh-release@v3
with:
generate_release_notes: true
draft: true
# Uploaded here, one at a time, rather than by the action's `files:`.
# The action fires every upload concurrently, and v1.36.0's two
# largest -- a 299MB AppImage and a 223MB flatpak -- died on undici's
# header timeout twice: once as a bare "Error saving asset", once as
# "Headers Timeout Error" after 12 minutes. Both installers had built
# fine; only the concurrency was wrong. A release that has to be
# finished by hand is worse than one that takes a few minutes longer.
- name: Upload the installers, one at a time
env:
GH_TOKEN: ${{ github.token }}
# This job never checks the repository out -- it only downloads
# artifacts -- so `gh` has no git remote to infer the repo from
# and every upload died with "fatal: not a git repository".
GH_REPO: ${{ github.repository }}
run: |
set -euo pipefail
for f in artifacts/*; do
for attempt in 1 2 3; do
if gh release upload "$GITHUB_REF_NAME" "$f" --clobber; then
break
fi
if [ "$attempt" -eq 3 ]; then
echo "::error::upload failed three times: $f"
exit 1
fi
echo "retrying $f (attempt $((attempt + 1)))"
sleep 15
done
done
62c9a9e10This file is pinned to the selected release. Download the original to open it in your design tool.