From 315751e3ec98e708bcc831dd7f80ca0433a2e3d0 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Sat, 10 Oct 2026 19:15:06 -0400 Subject: [PATCH] Release prep: 0.5.0 and Linux riscv64 release build (#423) - release.yml: new `linux-riscv64` job (ported from GridCraft): cross-compiles on ubuntu-24.04 against ports.ubuntu.com riscv64 libraries, packages a tar.gz, smoke-tests the CLI under QEMU. The draft-release job now needs it, so SHA256SUMS covers the tarball. - packaging/linux/package.sh: CROSS_ARCH / CROSS_TARGET / CROSS_COMPILE / EMULATOR support. - README Downloads and docs/releasing.md list the riscv64 tarball. - Version 0.4.0 -> 0.5.0 (cargo xtask version set), Cargo.lock refreshed. Co-authored-by: Claude Opus 5.5 --- .github/workflows/release.yml | 63 ++++++++++++++++++++++++++++++++++- Cargo.lock | 32 +++++++++--------- Cargo.toml | 2 +- README.md | 2 ++ docs/releasing.md | 4 +-- packaging/linux/package.sh | 25 ++++++++++---- 6 files changed, 101 insertions(+), 27 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0ae1962d..52cec013 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -213,6 +213,67 @@ jobs: path: dist/release/* if-no-files-found: error + linux-riscv64: + name: Linux riscv64 + needs: version + # Cross-compiled on x86_64 (no hosted RISC-V runners) against the runner's own Ubuntu release + # from ports.ubuntu.com, so the binaries need that release's glibc (24.04: 2.39). 22.04's + # riscv64 ports lag its amd64 updates, which breaks the multiarch install. tar.gz only; the + # CLI is smoke-tested under QEMU. + runs-on: ubuntu-24.04 + # No `environment: release`: this job signs nothing, so it gets no release secrets. + env: + CADCRAFT_VERSION: ${{ needs.version.outputs.version }} + CADCRAFT_BUILD_DATE: ${{ needs.version.outputs.date }} + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + targets: riscv64gc-unknown-linux-gnu + - uses: Swatinem/rust-cache@v2 + with: + key: release-linux-riscv64 + - name: Apply version override + if: inputs.version != '' + run: cargo xtask version set "$CADCRAFT_VERSION" + - name: Install cross-compilation dependencies + run: | + . /etc/os-release + sudo dpkg --add-architecture riscv64 + # Pin the existing (archive.ubuntu.com) sources to amd64; riscv64 comes from ports. + if [ -f /etc/apt/sources.list.d/ubuntu.sources ]; then + sudo sed -i '/^Types: deb/a Architectures: amd64' /etc/apt/sources.list.d/ubuntu.sources + fi + if [ -f /etc/apt/sources.list ]; then + sudo sed -i 's/^deb /deb [arch=amd64] /g' /etc/apt/sources.list + sudo sed -i 's/^deb-src /deb-src [arch=amd64] /g' /etc/apt/sources.list + fi + for suite in "$VERSION_CODENAME" "$VERSION_CODENAME-updates" "$VERSION_CODENAME-security"; do + echo "deb [arch=riscv64] http://ports.ubuntu.com/ubuntu-ports $suite main universe restricted multiverse" + done | sudo tee /etc/apt/sources.list.d/riscv64.list + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + gcc-riscv64-linux-gnu binutils-riscv64-linux-gnu libc6-dev-riscv64-cross libc6-dev:riscv64 qemu-user \ + libxkbcommon-dev:riscv64 libwayland-dev:riscv64 libx11-dev:riscv64 libxrandr-dev:riscv64 \ + libxi-dev:riscv64 libgl1-mesa-dev:riscv64 + - name: Build and package (tar.gz) + env: + CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER: riscv64-linux-gnu-gcc + PKG_CONFIG_SYSROOT_DIR: / + PKG_CONFIG_PATH: /usr/lib/riscv64-linux-gnu/pkgconfig:/usr/share/pkgconfig + PKG_CONFIG_ALLOW_CROSS: "1" + CROSS_ARCH: riscv64 + CROSS_TARGET: riscv64gc-unknown-linux-gnu + CROSS_COMPILE: riscv64-linux-gnu- + EMULATOR: qemu-riscv64 + QEMU_LD_PREFIX: /usr/riscv64-linux-gnu + run: packaging/linux/package.sh --formats tar + - uses: actions/upload-artifact@v4 + with: + name: release-linux-riscv64 + path: dist/release/*.tar.gz + if-no-files-found: error + flatpak: name: Flatpak ${{ matrix.arch }} needs: [version, linux] @@ -330,7 +391,7 @@ jobs: release: name: Draft GitHub Release - needs: [version, macos, windows, linux, flatpak, web, freebsd] + needs: [version, macos, windows, linux, linux-riscv64, flatpak, web, freebsd] # Only the `release` branch publishes; a dry run on another branch stops before this job. if: github.ref == 'refs/heads/release' runs-on: ubuntu-latest diff --git a/Cargo.lock b/Cargo.lock index b945ae3d..32bc4049 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -540,7 +540,7 @@ checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" [[package]] name = "cadcraft" -version = "0.4.0" +version = "0.5.0" dependencies = [ "cadcraft-engine", "cadcraft-io", @@ -558,7 +558,7 @@ dependencies = [ [[package]] name = "cadcraft-cli" -version = "0.4.0" +version = "0.5.0" dependencies = [ "cadcraft-engine", "cadcraft-io", @@ -569,14 +569,14 @@ dependencies = [ [[package]] name = "cadcraft-color" -version = "0.4.0" +version = "0.5.0" dependencies = [ "serde", ] [[package]] name = "cadcraft-constraints" -version = "0.4.0" +version = "0.5.0" dependencies = [ "cadcraft-doc", "cadcraft-geom", @@ -586,7 +586,7 @@ dependencies = [ [[package]] name = "cadcraft-doc" -version = "0.4.0" +version = "0.5.0" dependencies = [ "cadcraft-color", "cadcraft-geom", @@ -597,21 +597,21 @@ dependencies = [ [[package]] name = "cadcraft-dwg" -version = "0.4.0" +version = "0.5.0" dependencies = [ "acadrust", ] [[package]] name = "cadcraft-dxf" -version = "0.4.0" +version = "0.5.0" dependencies = [ "thiserror 2.0.21", ] [[package]] name = "cadcraft-engine" -version = "0.4.0" +version = "0.5.0" dependencies = [ "cadcraft-color", "cadcraft-constraints", @@ -628,7 +628,7 @@ dependencies = [ [[package]] name = "cadcraft-fonts" -version = "0.4.0" +version = "0.5.0" dependencies = [ "cadcraft-geom", "skrifa 0.47.0", @@ -636,14 +636,14 @@ dependencies = [ [[package]] name = "cadcraft-geom" -version = "0.4.0" +version = "0.5.0" dependencies = [ "serde", ] [[package]] name = "cadcraft-io" -version = "0.4.0" +version = "0.5.0" dependencies = [ "cadcraft-color", "cadcraft-doc", @@ -659,7 +659,7 @@ dependencies = [ [[package]] name = "cadcraft-mcp" -version = "0.4.0" +version = "0.5.0" dependencies = [ "cadcraft-engine", "cadcraft-io", @@ -670,7 +670,7 @@ dependencies = [ [[package]] name = "cadcraft-render" -version = "0.4.0" +version = "0.5.0" dependencies = [ "cadcraft-color", "cadcraft-doc", @@ -682,7 +682,7 @@ dependencies = [ [[package]] name = "cadcraft-ui-egui" -version = "0.4.0" +version = "0.5.0" dependencies = [ "cadcraft-color", "cadcraft-doc", @@ -701,7 +701,7 @@ dependencies = [ [[package]] name = "cadcraft-web" -version = "0.4.0" +version = "0.5.0" dependencies = [ "cadcraft-engine", "cadcraft-io", @@ -4574,7 +4574,7 @@ checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" [[package]] name = "xtask" -version = "0.4.0" +version = "0.5.0" dependencies = [ "serde_json", ] diff --git a/Cargo.toml b/Cargo.toml index a9bc8a7a..d7247ca1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ members = ["crates/*", "apps/*", "xtask"] # default-members [workspace.package] -version = "0.4.0" +version = "0.5.0" edition = "2024" license = "MIT OR Apache-2.0" rust-version = "1.90" diff --git a/README.md b/README.md index e7ca2e5c..899a5481 100644 --- a/README.md +++ b/README.md @@ -269,6 +269,8 @@ and web backend defaults are unchanged. | Fedora/RHEL/openSUSE | `cadcraft--linux-x86_64.rpm` | `cadcraft--linux-aarch64.rpm` | | | Tarball | `cadcraft--linux-x86_64.tar.gz` | `cadcraft--linux-aarch64.tar.gz` | Unpack anywhere | +RISC-V (riscv64): `cadcraft--linux-riscv64.tar.gz`, cross-compiled; needs glibc 2.39 or newer (Ubuntu 24.04+, Debian 13+). + ### FreeBSD | Build | File | diff --git a/docs/releasing.md b/docs/releasing.md index 29ecdff0..85c7c7cb 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -3,8 +3,8 @@ The canonical recipe is craftrules' [`release/playbook.md`](https://github.com/storytold/craftrules/blob/main/release/playbook.md); this file covers only what's CADCraft-specific. - **Version:** `[workspace.package] version` in the root `Cargo.toml` is the single source. `cargo xtask version` prints it; `cargo xtask version set X.Y.Z[-pre]` changes it. The app shows it in About, `cadcraft --version` and `cadcraft-cli --version`; release builds also embed the commit (`CADCRAFT_BUILD_SHA`). -- **Cut a release:** bump the version on `main`, then push `main` to `release` (`git push origin main:release`). Every push to `release` runs `.github/workflows/release.yml` and creates or updates the draft GitHub Release `CADCraft v`. A `workflow_dispatch` run with `version: X.Y.Z-rc.N` makes a test build. A dispatch on any other branch is a dry run: the unsigned jobs (version, Linux, Flatpak, FreeBSD, web) build, the `release` environment refuses the signing jobs (macOS, Windows), and no release is drafted. -- **Artifacts:** macOS universal `.dmg` (Developer ID signed, notarized, stapled) and CLI `.zip`; Windows x64, x86 and arm64 `.msi` + portable `.zip` (Azure Trusted Signing); Linux x86_64 and aarch64 `.AppImage` (+ `.AppImage.zsync` for AppImageUpdate delta updates), `.flatpak` bundle (repackages the tarball, `packaging/linux/flatpak-bundle.sh`), `.deb`, `.rpm`, `.tar.gz` (+ the from-source Flathub manifest in `packaging/linux/flatpak/`); FreeBSD x86_64 `.tar.gz` (built in a FreeBSD VM); web `.zip` (wasm + `index.html`, see `packaging/web/README.md`); `SHA256SUMS.txt`. +- **Cut a release:** bump the version on `main`, then push `main` to `release` (`git push origin main:release`). Every push to `release` runs `.github/workflows/release.yml` and creates or updates the draft GitHub Release `CADCraft v`. A `workflow_dispatch` run with `version: X.Y.Z-rc.N` makes a test build. A dispatch on any other branch is a dry run: the unsigned jobs (version, Linux, Linux riscv64, Flatpak, FreeBSD, web) build, the `release` environment refuses the signing jobs (macOS, Windows), and no release is drafted. +- **Artifacts:** macOS universal `.dmg` (Developer ID signed, notarized, stapled) and CLI `.zip`; Windows x64, x86 and arm64 `.msi` + portable `.zip` (Azure Trusted Signing); Linux x86_64 and aarch64 `.AppImage` (+ `.AppImage.zsync` for AppImageUpdate delta updates), `.flatpak` bundle (repackages the tarball, `packaging/linux/flatpak-bundle.sh`), `.deb`, `.rpm`, `.tar.gz` (+ the from-source Flathub manifest in `packaging/linux/flatpak/`); Linux riscv64 `.tar.gz` (cross-compiled on Ubuntu 24.04 against ports.ubuntu.com riscv64 libraries, CLI smoke-tested under QEMU); FreeBSD x86_64 `.tar.gz` (built in a FreeBSD VM); web `.zip` (wasm + `index.html`, see `packaging/web/README.md`); `SHA256SUMS.txt`. - **Secrets:** the twelve signing secrets live in the `release` environment (deployable only from the `release` branch, which only org admins and release-managers can push). All are optional: a missing one produces unsigned artifacts with a warning. - **Windows installer:** `packaging/windows/cadcraft.wxs` (WiX v5 + `WixToolset.UI.wixext`). Its wizard has a Shortcuts page: the Start Menu shortcut is always created, the desktop shortcut is opt-in (`DESKTOPSHORTCUT=1` for silent installs, `DESKTOPSHORTCUT=0` drops it on an upgrade; otherwise upgrades keep the previous choice). - **File types:** `.dxf` and `.dwg` (macOS document types, Windows "Open with", Linux MIME types). diff --git a/packaging/linux/package.sh b/packaging/linux/package.sh index 008c5230..c11fd3b3 100755 --- a/packaging/linux/package.sh +++ b/packaging/linux/package.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Build and package CADCraft for Linux ( is x86_64 or aarch64): +# Build and package CADCraft for Linux ( is x86_64 or aarch64, or riscv64 when cross-compiling): # # $DIST/cadcraft--linux-.AppImage any distro with glibc >= the build host's # $DIST/cadcraft--linux-.AppImage.zsync delta updates (needs zsyncmake) @@ -25,13 +25,16 @@ while [ $# -gt 0 ]; do case "$1" in --skip-build) SKIP_BUILD=1; shift ;; --formats) FORMATS="$2"; shift 2 ;; - -h | --help) sed -n '2,15p' "$0"; exit 0 ;; + -h | --help) sed -n '2,17p' "$0"; exit 0 ;; *) echo "unknown argument: $1" >&2; exit 2 ;; esac done -ARCH="$(uname -m)" +# Cross builds (CI's riscv64 job) set CROSS_ARCH, CROSS_TARGET (the Rust target), CROSS_COMPILE +# (the binutils prefix, for strip) and optionally EMULATOR (e.g. qemu-riscv64, for the smoke test). +ARCH="${CROSS_ARCH:-$(uname -m)}" case "$ARCH" in + riscv64) DEB_ARCH=riscv64 ;; x86_64) DEB_ARCH=amd64 ;; aarch64 | arm64) ARCH=aarch64; DEB_ARCH=arm64 ;; *) echo "unsupported architecture $ARCH" >&2; exit 2 ;; @@ -42,9 +45,13 @@ BASENAME="cadcraft-$VERSION-linux-$ARCH" echo "==> CADCraft $VERSION for Linux $ARCH ($FORMATS)" if [ "$SKIP_BUILD" = 0 ]; then - (cd "$ROOT" && cargo build --release --locked -p cadcraft -p cadcraft-cli) + if [ -n "${CROSS_TARGET:-}" ]; then + (cd "$ROOT" && cargo build --release --locked -p cadcraft -p cadcraft-cli --target "$CROSS_TARGET") + else + (cd "$ROOT" && cargo build --release --locked -p cadcraft -p cadcraft-cli) + fi fi -BIN="$CARGO_TARGET_DIR/release" +BIN="$CARGO_TARGET_DIR/${CROSS_TARGET:+$CROSS_TARGET/}release" WORK="$CARGO_TARGET_DIR/linux-package" STAGE="$WORK/root" rm -rf "$WORK" @@ -52,7 +59,7 @@ rm -rf "$WORK" # ---- stage an FHS tree (shared by every format) ------------------------------------------------- install -Dm755 "$BIN/cadcraft" "$STAGE/usr/bin/cadcraft" install -Dm755 "$BIN/cadcraft-cli" "$STAGE/usr/bin/cadcraft-cli" -strip "$STAGE/usr/bin/cadcraft" "$STAGE/usr/bin/cadcraft-cli" 2>/dev/null || true +"${CROSS_COMPILE:-}strip" "$STAGE/usr/bin/cadcraft" "$STAGE/usr/bin/cadcraft-cli" 2>/dev/null || true install -Dm644 "$HERE/$APP_ID.desktop" "$STAGE/usr/share/applications/$APP_ID.desktop" install -Dm644 "$HERE/$APP_ID.mime.xml" "$STAGE/usr/share/mime/packages/$APP_ID.xml" mkdir -p "$STAGE/usr/share/metainfo" @@ -135,6 +142,10 @@ if has appimage; then fi fi -"$STAGE/usr/bin/cadcraft-cli" --version +if [ -z "${CROSS_TARGET:-}" ]; then + "$STAGE/usr/bin/cadcraft-cli" --version +elif [ -n "${EMULATOR:-}" ]; then + "$EMULATOR" "$STAGE/usr/bin/cadcraft-cli" --version +fi echo "==> done" ls -lh "$DIST"