forge
Explore
Log in

Don't you dare go Hollow

Forge release workflow: a v* tag (or a manual run) builds the 5 targets as a matrix on ubuntu:24.04 (ci/build.sh: packages, toolchain, build, package steps

Browse files at this commit

3ac1c56c1e1d094fe57f8576c8cc9290d8fcb8b3Ahmet Kaan GümüşParent: e6d4742
  • ci
    • forge release workflow: a v* tag (or a manual run) builds the 5 targets as a matrix on ubuntu:24.04 (ci/build.sh: packages, toolchain, build, package steps
    • cargo-xwin for Windows
    • rustup, cargo and target cached per target) and publishes them with a .sha256 each as the tag's release
Show full message
👷 ci: forge release workflow: a v* tag (or a manual run) builds the 5 targets as a matrix on ubuntu:24.04 (ci/build.sh: packages, toolchain, build, package steps; cargo-xwin for Windows; rustup, cargo and target cached per target) and publishes them with a .sha256 each as the tag's release
.forge/ci.tomladded+17 -0
@@ -0,0 +1,17 @@
1+name = "release"
2+
3+[on]
4+tags = ["v*"]
5+manual = true
6+
7+[jobs.build]
8+image = "docker.io/library/ubuntu:24.04"
9+run = "bash ci/build.sh \"$MATRIX_TARGET\""
10+matrix = { target = ["server-x86_64-linux", "x86_64_v1-linux", "x86_64_v3-linux", "x86_64_v1-windows", "x86_64_v3-windows"] }
11+artifacts = ["server-x86_64-linux*", "x86_64_*"]
12+cache = [".cargo-home", ".rustup", "target"]
13+timeout_minutes = 180
14+
15+[release]
16+assets = ["build:server-x86_64-linux*", "build:x86_64_*"]
17+notes = "commits"
ci/build.shadded+61 -0
@@ -0,0 +1,61 @@
1+#!/usr/bin/env bash
2+set -euo pipefail
3+exec 2>&1
4+
5+target="$1"
6+windows=x86_64-pc-windows-msvc
7+packages="ca-certificates curl git build-essential pkg-config clang lld llvm cmake nasm libpipewire-0.3-dev libspa-0.2-dev libva-dev libdrm-dev libgbm-dev libxkbcommon-x11-dev libxkbcommon-dev libxcb1-dev libwayland-dev libvulkan-dev libfontconfig-dev libfreetype-dev libasound2-dev"
8+
9+export DEBIAN_FRONTEND=noninteractive
10+export CARGO_HOME="$PWD/.cargo-home" RUSTUP_HOME="$PWD/.rustup"
11+export PATH="$CARGO_HOME/bin:$PATH"
12+export CARGO_TERM_COLOR=never CARGO_TERM_PROGRESS_WHEN=always CARGO_TERM_PROGRESS_WIDTH=200
13+
14+case "$target" in
15+ server-x86_64-linux) package=server level=v1 os=linux ;;
16+ x86_64_v1-linux) package=client level=v1 os=linux ;;
17+ x86_64_v3-linux) package=client level=v3 os=linux ;;
18+ x86_64_v1-windows) package=client level=v1 os=windows ;;
19+ x86_64_v3-windows) package=client level=v3 os=windows ;;
20+ *) echo "unknown target $target"; exit 1 ;;
21+esac
22+case "$level" in
23+ v1) cpu=x86-64 ;;
24+ v3) cpu=x86-64-v3 ;;
25+esac
26+
27+echo "::group::Packages"
28+apt-get update
29+apt-get install -y --no-install-recommends $packages
30+git config --global --add safe.directory "$PWD"
31+echo "::endgroup::"
32+
33+echo "::group::Toolchain"
34+[ -x "$CARGO_HOME/bin/rustup" ] || curl -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --default-toolchain none
35+rustup toolchain install stable --profile minimal
36+rustup default stable
37+if [ "$os" = windows ]; then
38+ rustup target add "$windows"
39+ command -v cargo-xwin >/dev/null || cargo install cargo-xwin --locked
40+fi
41+echo "::endgroup::"
42+
43+echo "::group::Build"
44+if [ "$os" = windows ]; then
45+ sha256sum -c --quiet crates/client/src/release/shaders.sha256
46+ export XWIN_ACCEPT_LICENSE=1 XWIN_CACHE_DIR="$CARGO_HOME/xwin" GPUI_SHADERS_BYTES="$PWD/crates/client/src/release/shaders_bytes.rs"
47+ export CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUSTFLAGS="-C target-cpu=$cpu"
48+ cargo xwin build --release -p client --target "$windows" --target-dir "target/$level"
49+ built="target/$level/$windows/release/client.exe"
50+else
51+ export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS="-C target-cpu=$cpu"
52+ cargo build --release -p "$package" --target-dir "target/$level"
53+ built="target/$level/release/$package"
54+fi
55+echo "::endgroup::"
56+
57+echo "::group::Package"
58+cp "$built" "$target"
59+sha256sum "$target" > "$target.sha256"
60+cat "$target.sha256"
61+echo "::endgroup::"