forge
Explore
Log in

Don't you dare go Hollow

Forge workflow: tests, release build, tagged releases with SHA256SUMS

Browse files at this commit

9215377936f95739d5597ec83e347c220351c741Ahmet Kaan GümüşParent: 1246dc3
All checks have passed
Show checks
  • ci
    • forge workflow: tests, release build, tagged releases with SHA256SUMS
Show full message
👷 ci: forge workflow: tests, release build, tagged releases with SHA256SUMS
.forge/ci.tomladded+49 -0
@@ -0,0 +1,49 @@
1+# CI for in. Format: forge's docs/ci.md.
2+#
3+# The workflow has no branch condition, so the job also runs for pull requests.
4+# One job does everything, so its steps run one at a time. A tag push matching "v*" publishes a
5+# release with the binary and SHA256SUMS, only when the job succeeded.
6+
7+name = "build"
8+
9+[on]
10+push = ["main"]
11+pull_request = true
12+manual = true
13+tags = ["v*"]
14+
15+[jobs.build]
16+image = "docker.io/library/rust:1"
17+# Build parallelism comes from the runner (CARGO_BUILD_JOBS follows its CPU limit). Drops debuginfo.
18+# CARGO_HOME in the workspace puts the downloaded crates in the cache, so a run downloads only new ones.
19+# That places turso_core's source inside this repo, and its build.rs then watches our .git/HEAD, which
20+# is new in every job, so it would rebuild on every run. With SOURCE_DATE_EPOCH set it skips git.
21+env = { CARGO_PROFILE_DEV_DEBUG = "0", CARGO_PROFILE_TEST_DEBUG = "0", CARGO_HOME = "/workspace/.cargo-home", SOURCE_DATE_EPOCH = "0" }
22+# Tests run first, so a failure shows before the slow LTO release build.
23+# The groups are the job's steps on the run page, and `exec 2>&1` keeps a marker in order with cargo's
24+# stderr, which the runner reads from a separate pipe.
25+# IN_BUILD_SHA is what /healthz reports. safe.directory is needed because the checkout may be owned
26+# by another uid inside the sandbox; without git it falls back to "dev".
27+run = """
28+exec 2>&1
29+echo "::group::Tests"
30+cargo test --workspace
31+echo "::endgroup::"
32+echo "::group::Release build"
33+IN_BUILD_SHA=$(git -c safe.directory=/workspace rev-parse --short=12 HEAD 2>/dev/null || echo dev)
34+export IN_BUILD_SHA
35+echo "IN_BUILD_SHA=$IN_BUILD_SHA"
36+cargo build --release -p in-web
37+echo "::endgroup::"
38+echo "::group::Package"
39+ARCH=$(uname -m)
40+cp target/release/in in-$ARCH-linux
41+sha256sum in-$ARCH-linux > SHA256SUMS
42+echo "::endgroup::"
43+"""
44+artifacts = ["in-*-linux", "SHA256SUMS"]
45+cache = ["target", ".cargo-home"]
46+timeout_minutes = 120
47+
48+[release]
49+assets = ["build:in-*-linux", "build:SHA256SUMS"]