.hearthforge-ci.toml
| 1 | # Steps run in file order, in one container, sharing /ci/build. |
| 2 | |
| 3 | image = "docker.io/rust:1.90-bookworm" |
| 4 | work_dir = "/ci/build" |
| 5 | clone_project_to = "/ci/build/project" |
| 6 | |
| 7 | # The rust image ships bash. /bin/sh is dash and has no `pipefail`. |
| 8 | shell = ["/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. |
| 13 | shell_setup = """ |
| 14 | set -euo pipefail |
| 15 | export CARGO_TARGET_DIR=/ci/cache/target |
| 16 | """ |
| 17 | |
| 18 | timeout = 5400 |
| 19 | memory_limit = "6g" |
| 20 | |
| 21 | cache = [ |
| 22 | "/usr/local/cargo/registry", |
| 23 | "/ci/cache/target", |
| 24 | "/root/.bun/install/cache", |
| 25 | ] |
| 26 | |
| 27 | [on] |
| 28 | push = ["master"] |
| 29 | tag = 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] |
| 44 | timeout = 900 |
| 45 | run_sh = """ |
| 46 | apt-get update -qq |
| 47 | apt-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. |
| 51 | rustup component add rustfmt clippy |
| 52 | rustup target add wasm32-unknown-unknown |
| 53 | |
| 54 | curl -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. |
| 57 | curl -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. |
| 60 | url="https://github.com/trunk-rs/trunk/releases/download/v${TRUNK_VERSION}/trunk-x86_64-unknown-linux-gnu.tar.gz" |
| 61 | curl -fsSL -o /tmp/trunk.tar.gz "$url" |
| 62 | curl -fsSL "$url.sha256" | awk '{print $1 " /tmp/trunk.tar.gz"}' | sha256sum -c - |
| 63 | tar xzf /tmp/trunk.tar.gz -C /usr/local/bin |
| 64 | rm -f /tmp/trunk.tar.gz |
| 65 | |
| 66 | just --version && bun --version && trunk --version |
| 67 | cargo fmt --version && cargo clippy --version |
| 68 | """ |
| 69 | |
| 70 | # ── checks ─────────────────────────────────────────────────────────────────── |
| 71 | [lint] |
| 72 | run_sh = "cd project && just lint" |
| 73 | |
| 74 | # `just test` covers server and api-types only, hence the extra web run. |
| 75 | [test] |
| 76 | run_sh = "cd project && just test && cargo test -p web" |
| 77 | |
| 78 | # ── build ──────────────────────────────────────────────────────────────────── |
| 79 | [build] |
| 80 | timeout = 2400 |
| 81 | run_sh = "cd project && just build" |
| 82 | publish_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] |
| 87 | run_sh = "cd project && cargo test -p server --features embedded" |
| 88 | |
| 89 | # ── release ────────────────────────────────────────────────────────────────── |
| 90 | [release] |
| 91 | run_if = 'test -n "${CI_COMMIT_TAG}"' |
| 92 | run_sh = """ |
| 93 | cd project |
| 94 | install -Dm755 "${CARGO_TARGET_DIR}/release/filebrowser-ng" \ |
| 95 | "dist/filebrowser-ng-${CI_COMMIT_TAG}-x86_64-linux-gnu" |
| 96 | """ |
| 97 | publish_gzip = ["/ci/build/project/dist/"] |
| 98 |