diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f8db6b3..6c9050a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -316,34 +316,40 @@ jobs: path: dist/release/* if-no-files-found: error - # FreeBSD has no hosted runners: freebsd.yml builds in a FreeBSD VM and, with package: true, - # uploads the release-freebsd artifact (gridcraft--freebsd-x86_64.tar.gz). It needs no - # secrets, so the called workflow runs without the release environment (and in dry runs). linux-riscv64: name: Linux riscv64 needs: version - runs-on: ubuntu-26.04 + # 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: GRIDCRAFT_VERSION: ${{ needs.version.outputs.version }} GRIDCRAFT_BUILD_DATE: ${{ needs.version.outputs.date }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Check out craft-fonts - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: storytold/craft-fonts ref: abb83316d96aa59c1cf64784289e378fe9fa5695 path: craft-fonts - uses: dtolnay/rust-toolchain@686976e191b89faba57d3206551f0f330d8cb249 # stable with: - toolchain: stable targets: riscv64gc-unknown-linux-gnu + - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + with: + key: release-linux-riscv64 - name: Apply version override if: inputs.version != '' - run: cargo xtask version set "$GRIDCRAFT_VERSION" + run: cargo run -q -p xtask --no-default-features -- version set "$GRIDCRAFT_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 @@ -351,43 +357,37 @@ jobs: 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 - cat << 'EOF' | sudo tee /etc/apt/sources.list.d/riscv64.list - deb [arch=riscv64] http://ports.ubuntu.com/ubuntu-ports resolute main universe restricted multiverse - deb [arch=riscv64] http://ports.ubuntu.com/ubuntu-ports resolute-updates main universe restricted multiverse - deb [arch=riscv64] http://ports.ubuntu.com/ubuntu-ports resolute-security main universe restricted multiverse - EOF + 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 --allow-downgrades --no-install-recommends \ + 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 \ - libasound2-dev:riscv64 libxkbcommon-dev:riscv64 \ - libwayland-dev:riscv64 libx11-dev:riscv64 libxrandr-dev:riscv64 libxi-dev:riscv64 libgl1-mesa-dev:riscv64 - if command -v qemu-riscv64 >/dev/null 2>&1 && ! command -v qemu-riscv64-static >/dev/null 2>&1; then - sudo ln -s "$(command -v qemu-riscv64)" /usr/local/bin/qemu-riscv64-static - fi - - name: Build and package + 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 - CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_RUSTFLAGS: "-C link-arg=-L/usr/riscv64-linux-gnu/lib -C link-arg=-L/usr/lib/riscv64-linux-gnu" 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-static - run: | - export CRAFT_FONTS_DIR="$PWD/craft-fonts" CRAFT_FONTS_REQUIRED=1 - packaging/linux/package.sh --formats "tar" - - name: Smoke test CLI under QEMU - run: | - tar -xzf dist/release/*.tar.gz - qemu-riscv64-static -L /usr/riscv64-linux-gnu gridcraft-*/bin/gridcraft-cli --version - - uses: actions/upload-artifact@v4 + EMULATOR: qemu-riscv64 + QEMU_LD_PREFIX: /usr/riscv64-linux-gnu + run: packaging/linux/package.sh --formats tar + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: release-linux-riscv64 path: dist/release/*.tar.gz if-no-files-found: error + # FreeBSD has no hosted runners: freebsd.yml builds in a FreeBSD VM and, with package: true, + # uploads the release-freebsd artifact (gridcraft--freebsd-x86_64.tar.gz). It needs no + # secrets, so the called workflow runs without the release environment (and in dry runs). freebsd: name: FreeBSD needs: version @@ -399,7 +399,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] # Belt and braces for branch dry runs: only the release branch drafts a release (the # environment's branch rule refuses this job and the signing jobs anywhere else, too). if: github.ref == 'refs/heads/release' diff --git a/docs/releasing.md b/docs/releasing.md index de94b21..0e0abfa 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -82,7 +82,7 @@ and upload their artifacts, the environment refuses macOS and Windows, and no re | Windows 11 ARM64 | `gridcraft--windows-arm64.msi`, `…-portable.zip` (cross-compiled, signed like x64) | `windows-latest`; installed and run on `windows-11-arm` by `windows-arm64.yml` | | Linux x86_64 | `gridcraft--linux-x86_64.{AppImage,AppImage.zsync,deb,rpm,tar.gz}` | `ubuntu-22.04` | | Linux aarch64 | `gridcraft--linux-aarch64.{AppImage,AppImage.zsync,deb,rpm,tar.gz}` | `ubuntu-22.04-arm` | -| Linux riscv64 | `gridcraft--linux-riscv64.tar.gz` | cross-compiled on `ubuntu-26.04` | +| Linux riscv64 | `gridcraft--linux-riscv64.tar.gz` (cross-compiled, glibc >= 2.39; CLI smoke-tested under QEMU) | `ubuntu-24.04` | | Flatpak x86_64, aarch64 | `gridcraft--linux-.flatpak` (repackages the Linux tarball) | `ubuntu-24.04`, `ubuntu-24.04-arm` | | FreeBSD 14 x86_64 | `gridcraft--freebsd-x86_64.tar.gz` | FreeBSD 14.3 VM (`freebsd.yml`, called by `release.yml`) | | Web | `gridcraft-web-.zip` (static site; see [`packaging/web/README.md`](../packaging/web/README.md)) | `ubuntu-latest` | diff --git a/packaging/linux/package.sh b/packaging/linux/package.sh index e712303..9fde2c5 100755 --- a/packaging/linux/package.sh +++ b/packaging/linux/package.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Build and package GridCraft for Linux ( is x86_64 or aarch64): +# Build and package GridCraft for Linux ( is x86_64 or aarch64, or riscv64 when cross-compiling): # # $DIST/gridcraft--linux-.AppImage any distro with glibc >= the build host's # $DIST/gridcraft--linux-.AppImage.zsync delta updates (needs zsyncmake) @@ -143,7 +143,7 @@ fi if [ -z "${CROSS_TARGET:-}" ]; then "$STAGE/usr/bin/gridcraft-cli" --version elif [ -n "${EMULATOR:-}" ]; then - $EMULATOR "$STAGE/usr/bin/gridcraft-cli" --version + "$EMULATOR" "$STAGE/usr/bin/gridcraft-cli" --version fi echo "==> done" ls -lh "$DIST"