# Steps run in file order, in one container, sharing /ci/build. image = "docker.io/rust:1.90-bookworm" work_dir = "/ci/build" clone_project_to = "/ci/build/project" # The rust image ships bash. /bin/sh is dash and has no `pipefail`. shell = ["/bin/bash", "-c"] # CARGO_TARGET_DIR must stay outside clone_project_to: the cache volume is # mounted before the clone runs, and git refuses to clone into a non-empty # directory. shell_setup = """ set -euo pipefail export CARGO_TARGET_DIR=/ci/cache/target """ timeout = 5400 memory_limit = "6g" cache = [ "/usr/local/cargo/registry", "/ci/cache/target", "/root/.bun/install/cache", ] [on] push = ["master"] tag = true [variables] [variables.TRUNK_VERSION] default = "0.21.14" description = "Trunk release that builds the wasm frontend. Matches the Containerfile." [variables.BUN_VERSION] default = "1.4.0" description = "Bun release that bundles web/cm6.js. Matches the Containerfile." # ── toolchain ──────────────────────────────────────────────────────────────── # binaryen supplies wasm-opt, so trunk does not download its own. [setup] timeout = 900 run_sh = """ apt-get update -qq apt-get install -y --no-install-recommends binaryen unzip # The official rust images use rustup's minimal profile, so rustfmt and # clippy are absent. `just lint` needs both. rustup component add rustfmt clippy rustup target add wasm32-unknown-unknown curl -fsSL https://just.systems/install.sh | bash -s -- --to /usr/local/bin # BUN_INSTALL controls the prefix, so the binary lands in /usr/local/bin. curl -fsSL https://bun.sh/install | BUN_INSTALL=/usr/local bash -s "bun-v${BUN_VERSION}" # The gnu build, not the musl one: the image is Debian. url="https://github.com/trunk-rs/trunk/releases/download/v${TRUNK_VERSION}/trunk-x86_64-unknown-linux-gnu.tar.gz" curl -fsSL -o /tmp/trunk.tar.gz "$url" curl -fsSL "$url.sha256" | awk '{print $1 " /tmp/trunk.tar.gz"}' | sha256sum -c - tar xzf /tmp/trunk.tar.gz -C /usr/local/bin rm -f /tmp/trunk.tar.gz just --version && bun --version && trunk --version cargo fmt --version && cargo clippy --version """ # ── checks ─────────────────────────────────────────────────────────────────── [lint] run_sh = "cd project && just lint" # `just test` covers server and api-types only, hence the extra web run. [test] run_sh = "cd project && just test && cargo test -p web" # ── build ──────────────────────────────────────────────────────────────────── [build] timeout = 2400 run_sh = "cd project && just build" publish_file = ["/ci/cache/target/release/filebrowser-ng"] # `just e2e` would rebuild the frontend. The build step already staged # server/dist, so run the embedded suite against it directly. [e2e] run_sh = "cd project && cargo test -p server --features embedded" # ── release ────────────────────────────────────────────────────────────────── [release] run_if = 'test -n "${CI_COMMIT_TAG}"' run_sh = """ cd project install -Dm755 "${CARGO_TARGET_DIR}/release/filebrowser-ng" \ "dist/filebrowser-ng-${CI_COMMIT_TAG}-x86_64-linux-gnu" """ publish_gzip = ["/ci/build/project/dist/"]