.hearthforge-ci.toml
⎇
Raw
1# Steps run in file order, in one container, sharing /ci/build.
2
3image = "docker.io/rust:1.90-bookworm"
4work_dir = "/ci/build"
5clone_project_to = "/ci/build/project"
6
7# The rust image ships bash. /bin/sh is dash and has no `pipefail`.
8shell = ["/bin/bash", "-c"]
9
10# CARGO_TARGET_DIR must stay outside clone_project_to: the cache volume is
11# mounted before the clone runs, and git refuses to clone into a non-empty
12# directory.
13shell_setup = """
14set -euo pipefail
15export CARGO_TARGET_DIR=/ci/cache/target
16"""
17
18timeout = 5400
19memory_limit = "6g"
20
21cache = [
22 "/usr/local/cargo/registry",
23 "/ci/cache/target",
24 "/root/.bun/install/cache",
25]
26
27[on]
28push = ["master"]
29tag = true
30
31[variables]
32
33 [variables.TRUNK_VERSION]
34 default = "0.21.14"
35 description = "Trunk release that builds the wasm frontend. Matches the Containerfile."
36
37 [variables.BUN_VERSION]
38 default = "1.4.0"
39 description = "Bun release that bundles web/cm6.js. Matches the Containerfile."
40
41# ── toolchain ────────────────────────────────────────────────────────────────
42# binaryen supplies wasm-opt, so trunk does not download its own.
43[setup]
44timeout = 900
45run_sh = """
46apt-get update -qq
47apt-get install -y --no-install-recommends binaryen unzip
48
49# The official rust images use rustup's minimal profile, so rustfmt and
50# clippy are absent. `just lint` needs both.
51rustup component add rustfmt clippy
52rustup target add wasm32-unknown-unknown
53
54curl -fsSL https://just.systems/install.sh | bash -s -- --to /usr/local/bin
55
56# BUN_INSTALL controls the prefix, so the binary lands in /usr/local/bin.
57curl -fsSL https://bun.sh/install | BUN_INSTALL=/usr/local bash -s "bun-v${BUN_VERSION}"
58
59# The gnu build, not the musl one: the image is Debian.
60url="https://github.com/trunk-rs/trunk/releases/download/v${TRUNK_VERSION}/trunk-x86_64-unknown-linux-gnu.tar.gz"
61curl -fsSL -o /tmp/trunk.tar.gz "$url"
62curl -fsSL "$url.sha256" | awk '{print $1 " /tmp/trunk.tar.gz"}' | sha256sum -c -
63tar xzf /tmp/trunk.tar.gz -C /usr/local/bin
64rm -f /tmp/trunk.tar.gz
65
66just --version && bun --version && trunk --version
67cargo fmt --version && cargo clippy --version
68"""
69
70# ── checks ───────────────────────────────────────────────────────────────────
71[lint]
72run_sh = "cd project && just lint"
73
74# `just test` covers server and api-types only, hence the extra web run.
75[test]
76run_sh = "cd project && just test && cargo test -p web"
77
78# ── build ────────────────────────────────────────────────────────────────────
79[build]
80timeout = 2400
81run_sh = "cd project && just build"
82publish_file = ["/ci/cache/target/release/filebrowser-ng"]
83
84# `just e2e` would rebuild the frontend. The build step already staged
85# server/dist, so run the embedded suite against it directly.
86[e2e]
87run_sh = "cd project && cargo test -p server --features embedded"
88
89# ── release ──────────────────────────────────────────────────────────────────
90[release]
91run_if = 'test -n "${CI_COMMIT_TAG}"'
92run_sh = """
93cd project
94install -Dm755 "${CARGO_TARGET_DIR}/release/filebrowser-ng" \
95 "dist/filebrowser-ng-${CI_COMMIT_TAG}-x86_64-linux-gnu"
96"""
97publish_gzip = ["/ci/build/project/dist/"]
98