diff --git a/.github/actionlint.yaml b/.github/actionlint.yaml new file mode 100644 index 00000000..a7b0f0ad --- /dev/null +++ b/.github/actionlint.yaml @@ -0,0 +1,4 @@ +# Custom runner labels actionlint can't know about. +self-hosted-runner: + labels: + - github-ubuntu-16core # org 16-core larger runner, used by release.yml's FreeBSD VM job diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 196a7ed9..e0ac819e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -389,9 +389,78 @@ 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 reads no secrets, so a branch dry run can run it. + env: + FIGCRAFT_VERSION: ${{ needs.version.outputs.version }} + FIGCRAFT_BUILD_DATE: ${{ needs.version.outputs.date }} + steps: + - uses: actions/checkout@v4 + - name: Check out craft-fonts (embedded fonts) + uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 + with: + repository: storytold/craft-fonts + ref: ${{ env.CRAFT_FONTS_REF }} + path: craft-fonts + - 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 run --locked -q -p xtask -- version set "$FIGCRAFT_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: + CRAFT_FONTS_DIR: ${{ github.workspace }}/craft-fonts + CRAFT_FONTS_REQUIRED: "1" + 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 + release: name: Draft GitHub Release - needs: [version, macos, windows, linux, flatpak, freebsd, web] + needs: [version, macos, windows, linux, linux-riscv64, flatpak, freebsd, web] runs-on: ubuntu-latest environment: release permissions: diff --git a/Cargo.lock b/Cargo.lock index 8f7056c6..5abec32e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1396,7 +1396,7 @@ checksum = "b97b65636e5b9ef369943878ac74335ba1c55c1cb6adbf1e2c293c624248d693" [[package]] name = "figcraft" -version = "0.2.0" +version = "0.3.0" dependencies = [ "arboard", "eframe", @@ -1417,7 +1417,7 @@ dependencies = [ [[package]] name = "figcraft-cli" -version = "0.2.0" +version = "0.3.0" dependencies = [ "figcraft-doc", "figcraft-engine", @@ -1431,7 +1431,7 @@ dependencies = [ [[package]] name = "figcraft-collab" -version = "0.2.0" +version = "0.3.0" dependencies = [ "base64 0.22.1", "figcraft-color", @@ -1446,7 +1446,7 @@ dependencies = [ [[package]] name = "figcraft-collab-net" -version = "0.2.0" +version = "0.3.0" dependencies = [ "base64 0.22.1", "figcraft-collab", @@ -1461,7 +1461,7 @@ dependencies = [ [[package]] name = "figcraft-color" -version = "0.2.0" +version = "0.3.0" dependencies = [ "kurbo", "serde", @@ -1470,7 +1470,7 @@ dependencies = [ [[package]] name = "figcraft-doc" -version = "0.2.0" +version = "0.3.0" dependencies = [ "figcraft-color", "figcraft-geom", @@ -1482,7 +1482,7 @@ dependencies = [ [[package]] name = "figcraft-engine" -version = "0.2.0" +version = "0.3.0" dependencies = [ "base64 0.22.1", "figcraft-collab", @@ -1507,7 +1507,7 @@ dependencies = [ [[package]] name = "figcraft-format" -version = "0.2.0" +version = "0.3.0" dependencies = [ "figcraft-doc", "image", @@ -1519,7 +1519,7 @@ dependencies = [ [[package]] name = "figcraft-geom" -version = "0.2.0" +version = "0.3.0" dependencies = [ "kurbo", "serde", @@ -1527,7 +1527,7 @@ dependencies = [ [[package]] name = "figcraft-layout" -version = "0.2.0" +version = "0.3.0" dependencies = [ "figcraft-doc", "figcraft-geom", @@ -1535,7 +1535,7 @@ dependencies = [ [[package]] name = "figcraft-mcp" -version = "0.2.0" +version = "0.3.0" dependencies = [ "base64 0.22.1", "figcraft-collab-net", @@ -1551,7 +1551,7 @@ dependencies = [ [[package]] name = "figcraft-pathops" -version = "0.2.0" +version = "0.3.0" dependencies = [ "figcraft-doc", "figcraft-geom", @@ -1560,7 +1560,7 @@ dependencies = [ [[package]] name = "figcraft-pdf" -version = "0.2.0" +version = "0.3.0" dependencies = [ "figcraft-color", "figcraft-doc", @@ -1577,7 +1577,7 @@ dependencies = [ [[package]] name = "figcraft-plugin" -version = "0.2.0" +version = "0.3.0" dependencies = [ "serde", "serde_json", @@ -1588,7 +1588,7 @@ dependencies = [ [[package]] name = "figcraft-render" -version = "0.2.0" +version = "0.3.0" dependencies = [ "crc32fast", "figcraft-color", @@ -1604,7 +1604,7 @@ dependencies = [ [[package]] name = "figcraft-svg" -version = "0.2.0" +version = "0.3.0" dependencies = [ "base64 0.22.1", "figcraft-color", @@ -1618,7 +1618,7 @@ dependencies = [ [[package]] name = "figcraft-text" -version = "0.2.0" +version = "0.3.0" dependencies = [ "figcraft-doc", "figcraft-geom", @@ -1630,7 +1630,7 @@ dependencies = [ [[package]] name = "figcraft-ui-egui" -version = "0.2.0" +version = "0.3.0" dependencies = [ "base64 0.22.1", "egui", @@ -1651,7 +1651,7 @@ dependencies = [ [[package]] name = "figcraft-web" -version = "0.2.0" +version = "0.3.0" dependencies = [ "eframe", "egui", @@ -5631,7 +5631,7 @@ checksum = "9440ea3e5aeabb0ac63af70daf835274065238cdd0cec83418f417eae38bacee" [[package]] name = "xtask" -version = "0.2.0" +version = "0.3.0" dependencies = [ "figcraft-color", "figcraft-doc", diff --git a/Cargo.toml b/Cargo.toml index 1b3d7f55..612d6262 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ exclude = ["plugins"] # default-members = ["crates/*", "apps/figcraft", "apps/figcraft-cli", "xtask"] [workspace.package] -version = "0.2.0" +version = "0.3.0" edition = "2024" license = "MIT OR Apache-2.0" rust-version = "1.95" diff --git a/docs/hardware-parity.md b/docs/hardware-parity.md index c99ef137..67985f7f 100644 --- a/docs/hardware-parity.md +++ b/docs/hardware-parity.md @@ -41,7 +41,7 @@ Nothing has been timed against Figma on the same document (needs `.fig` import). |---|---|---|---| | macOS | desktop app (Intel and Apple silicon) | universal `.dmg`, signed and notarized (v0.2.0) | where nearly all QA happens | | Windows x64 / arm64 | desktop app | `.msi` and portable zip for x64, x86 and arm64 | built in CI; little hands-on QA | -| Linux | none (browser only) | AppImage, `.deb`, `.rpm`, Flatpak, tarball, x86_64 and aarch64 | CI tests run here | +| Linux | none (browser only) | AppImage, `.deb`, `.rpm`, Flatpak, tarball, x86_64 and aarch64; riscv64 tarball | CI tests run here | | FreeBSD | none | tarball | | | Web | primary (figma.com) | `figcraft-web` (WASM, WebGPU/WebGL2), web zip | no accessibility tree; file access through the browser | | iOS / Android | apps: view, comment, mirror prototypes | none (the web build is not touch-first) | 20–40 h for a viewer | diff --git a/docs/releasing.md b/docs/releasing.md index 896236a0..7c334894 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -59,6 +59,7 @@ refuses them (0 steps) and no release is created. The `version` input is applied | macOS 11+ (universal) | `figcraft--macos-universal.dmg`, `figcraft-cli--macos-universal.zip` | `macos-15-xlarge` | | Windows 10+ x64 / x86 / arm64 | `figcraft--windows-.msi`, `figcraft--windows--portable.zip` | `windows-latest` (arm64 cross-compiled) | | Linux x86_64 / aarch64 | `figcraft--linux-.{AppImage,AppImage.zsync,deb,rpm,tar.gz,flatpak}` | `ubuntu-22.04` / `ubuntu-22.04-arm` (Flatpak: 24.04) | +| Linux riscv64 | `figcraft--linux-riscv64.tar.gz` (CLI smoke-tested under QEMU; needs glibc ≥ 2.39) | cross-compiled on `ubuntu-24.04` against ports.ubuntu.com riscv64 libraries | | FreeBSD 14 x86_64 | `figcraft--freebsd-x86_64.tar.gz` | FreeBSD 14.3 VM on `ubuntu-latest` | | Web | `figcraft-web-.zip` (static site; [`packaging/web/README.md`](../packaging/web/README.md)) | `ubuntu-latest` | @@ -128,6 +129,8 @@ libraries as dependencies); and an `.AppImage` with update information and a `.z is the from-source manifest for a Flathub submission (not built in CI; vendor crates with `flatpak-cargo-generator.py` first). Both manifests keep the same runtime and `finish-args` (packaging-lint checks). Binaries are built on Ubuntu 22.04 and need glibc ≥ 2.35. +The `linux-riscv64` job cross-compiles with `CROSS_ARCH`/`CROSS_TARGET`/`CROSS_COMPILE` and +`EMULATOR=qemu-riscv64` and packages only the tarball (`--formats tar`). ### FreeBSD diff --git a/packaging/linux/package.sh b/packaging/linux/package.sh index bfbb1323..20da2f76 100755 --- a/packaging/linux/package.sh +++ b/packaging/linux/package.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Build and package FigCraft for Linux ( is x86_64 or aarch64): +# Build and package FigCraft for Linux ( is x86_64 or aarch64, or riscv64 when cross-compiling): # # $DIST/figcraft--linux-.AppImage any distro with glibc >= the build host's # $DIST/figcraft--linux-.AppImage.zsync delta updates (needs zsyncmake) @@ -15,6 +15,10 @@ # (downloaded into $CARGO_TARGET_DIR if missing). Build on an old distro (CI: Ubuntu 22.04, # glibc 2.35) so the binaries run on newer ones. Optional: desktop-file-validate, appstreamcli, # zsyncmake (the zsync package) for the AppImage's .zsync. +# +# Cross-compiling (CI's linux-riscv64 job; tar only): CROSS_ARCH (e.g. riscv64), CROSS_TARGET +# (the Rust target), CROSS_COMPILE (binutils prefix for strip) and optionally EMULATOR (e.g. +# qemu-riscv64) to run the --version smoke test. set -euo pipefail # shellcheck source=../env.sh . "$(dirname "${BASH_SOURCE[0]}")/../env.sh" @@ -32,8 +36,9 @@ while [ $# -gt 0 ]; do esac done -ARCH="$(uname -m)" +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 ;; @@ -44,9 +49,9 @@ BASENAME="figcraft-$VERSION-linux-$ARCH" echo "==> FigCraft $VERSION for Linux $ARCH ($FORMATS; ${BINS[*]})" if [ "$SKIP_BUILD" = 0 ]; then - (cd "$ROOT" && cargo build --release --locked "${CARGO_PKGS[@]}") + (cd "$ROOT" && cargo build --release --locked "${CARGO_PKGS[@]}" ${CROSS_TARGET:+--target "$CROSS_TARGET"}) 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" @@ -54,7 +59,7 @@ rm -rf "$WORK" # ---- stage an FHS tree (shared by every format) ------------------------------------------------- for bin in "${BINS[@]}"; do install -Dm755 "$BIN/$bin" "$STAGE/usr/bin/$bin" - strip "$STAGE/usr/bin/$bin" 2>/dev/null || true + "${CROSS_COMPILE:-}strip" "$STAGE/usr/bin/$bin" 2>/dev/null || true done 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" @@ -145,6 +150,10 @@ if has appimage; then fi fi -"$STAGE/usr/bin/$(smoke_bin)" --version +if [ -z "${CROSS_TARGET:-}" ]; then + "$STAGE/usr/bin/$(smoke_bin)" --version +elif [ -n "${EMULATOR:-}" ]; then + "$EMULATOR" "$STAGE/usr/bin/$(smoke_bin)" --version +fi echo "==> done" ls -lh "$DIST"