# CI for im. Format: forge's docs/ci.md. # # The workflow has no branch condition, so the job also runs for pull requests. # One job does everything, so its steps run one at a time. A tag push matching "v*" publishes a # release with the binary and SHA256SUMS, only when the job succeeded. name = "build" [on] push = ["main"] pull_request = true manual = true tags = ["v*"] [jobs.build] image = "docker.io/library/rust:1" # Build parallelism comes from the runner (CARGO_BUILD_JOBS follows its CPU limit). Drops debuginfo. # CARGO_HOME in the workspace puts the downloaded crates in the cache, so a run downloads only new ones. # That places turso_core's source inside this repo, and its build.rs then watches our .git/HEAD, which # is new in every job, so it would rebuild on every run. With SOURCE_DATE_EPOCH set it skips git. env = { CARGO_PROFILE_DEV_DEBUG = "0", CARGO_PROFILE_TEST_DEBUG = "0", CARGO_HOME = "/workspace/.cargo-home", SOURCE_DATE_EPOCH = "0" } # Tests run first, so a failure shows before the slow LTO release build. # The groups are the job's steps on the run page, and `exec 2>&1` keeps a marker in order with cargo's # stderr, which the runner reads from a separate pipe. # IM_BUILD_SHA is what /healthz reports. safe.directory is needed because the checkout may be owned # by another uid inside the sandbox; without git it falls back to "dev". run = """ exec 2>&1 echo "::group::Tests" cargo test --workspace echo "::endgroup::" echo "::group::Release build" IM_BUILD_SHA=$(git -c safe.directory=/workspace rev-parse --short=12 HEAD 2>/dev/null || echo dev) export IM_BUILD_SHA echo "IM_BUILD_SHA=$IM_BUILD_SHA" cargo build --release -p im-web echo "::endgroup::" echo "::group::Package" ARCH=$(uname -m) cp target/release/im im-$ARCH-linux sha256sum im-$ARCH-linux > SHA256SUMS echo "::endgroup::" """ artifacts = ["im-*-linux", "SHA256SUMS"] cache = ["target", ".cargo-home"] timeout_minutes = 120 [release] assets = ["build:im-*-linux", "build:SHA256SUMS"]