Skip to content

Commit 7f1c094

Browse files
committed
refactor: remove sandbox, add Blacksmith 32vcpu CI with mold linker
- Remove sandbox.rs, disk quota, and libc dependency - Replace all shell wrappers with direct tokio::process::Command calls - Add .cargo/config.toml for mold linker on Linux - Add CI: Blacksmith 32vcpu runners, nightly Rust, mold, actions/cache@v4 - Add Docker build+push to GHCR on main
1 parent e701317 commit 7f1c094

File tree

9 files changed

+253
-331
lines changed

9 files changed

+253
-331
lines changed

.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[target.x86_64-unknown-linux-gnu]
2+
linker = "clang"
3+
rustflags = ["-C", "link-arg=-fuse-ld=mold"]

.github/workflows/ci.yml

Lines changed: 95 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,66 +6,131 @@ on:
66
pull_request:
77
branches: [main]
88

9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
913
env:
1014
CARGO_TERM_COLOR: always
11-
REGISTRY: ghcr.io
12-
IMAGE_NAME: ${{ github.repository }}
15+
CARGO_INCREMENTAL: 0
16+
CARGO_NET_RETRY: 10
17+
RUST_BACKTRACE: short
1318

1419
jobs:
1520
lint:
16-
runs-on: ubuntu-latest
21+
name: Lint & Format
22+
runs-on: blacksmith-4vcpu-ubuntu-2404
1723
steps:
1824
- uses: actions/checkout@v4
19-
- uses: dtolnay/rust-toolchain@nightly
25+
26+
- name: Install mold linker
27+
run: sudo apt-get update -qq && sudo apt-get install -y -qq mold clang
28+
29+
- name: Install Rust nightly
30+
uses: dtolnay/rust-toolchain@nightly
2031
with:
21-
components: rustfmt, clippy
22-
- uses: actions/cache@v4
32+
components: clippy, rustfmt
33+
34+
- name: Cache cargo registry + target
35+
uses: actions/cache@v4
36+
with:
37+
path: |
38+
~/.cargo/registry
39+
~/.cargo/git
40+
target
41+
key: lint-${{ runner.os }}-nightly-${{ hashFiles('**/Cargo.lock') }}
42+
restore-keys: |
43+
lint-${{ runner.os }}-nightly-
44+
45+
- name: Check formatting
46+
run: cargo +nightly fmt --all -- --check
47+
48+
- name: Clippy
49+
run: cargo +nightly clippy --all-targets -- -D warnings
50+
51+
build:
52+
name: Build (nightly, release, 32 threads)
53+
runs-on: blacksmith-32vcpu-ubuntu-2404
54+
steps:
55+
- uses: actions/checkout@v4
56+
57+
- name: Install mold linker
58+
run: sudo apt-get update -qq && sudo apt-get install -y -qq mold clang
59+
60+
- name: Install Rust nightly
61+
uses: dtolnay/rust-toolchain@nightly
62+
63+
- name: Cache cargo registry + target
64+
uses: actions/cache@v4
2365
with:
2466
path: |
2567
~/.cargo/registry
2668
~/.cargo/git
2769
target
28-
key: ${{ runner.os }}-lint-${{ hashFiles('**/Cargo.lock') }}
29-
- run: cargo +nightly fmt --check
30-
- run: cargo +nightly clippy -- -D warnings
70+
key: build-${{ runner.os }}-nightly-${{ hashFiles('**/Cargo.lock') }}
71+
restore-keys: |
72+
build-${{ runner.os }}-nightly-
73+
74+
- name: Build release
75+
run: cargo +nightly build --release -j $(nproc)
76+
env:
77+
RUSTFLAGS: "-C debuginfo=0 -C target-cpu=native -C link-arg=-fuse-ld=mold -D warnings"
78+
79+
- name: Upload binary
80+
uses: actions/upload-artifact@v4
81+
with:
82+
name: term-executor-linux-x86_64
83+
path: target/release/term-executor
84+
retention-days: 7
3185

32-
build-and-test:
33-
runs-on: ubuntu-latest
86+
test:
87+
name: Tests (nightly, 32 threads)
88+
runs-on: blacksmith-32vcpu-ubuntu-2404
3489
steps:
3590
- uses: actions/checkout@v4
36-
- uses: dtolnay/rust-toolchain@stable
37-
- uses: actions/cache@v4
91+
92+
- name: Install mold linker
93+
run: sudo apt-get update -qq && sudo apt-get install -y -qq mold clang
94+
95+
- name: Install Rust nightly
96+
uses: dtolnay/rust-toolchain@nightly
97+
98+
- name: Cache cargo registry + target
99+
uses: actions/cache@v4
38100
with:
39101
path: |
40102
~/.cargo/registry
41103
~/.cargo/git
42104
target
43-
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
44-
- name: Build
45-
run: cargo build --release
46-
- name: Test
47-
run: cargo test
105+
key: test-${{ runner.os }}-nightly-${{ hashFiles('**/Cargo.lock') }}
106+
restore-keys: |
107+
test-${{ runner.os }}-nightly-
108+
109+
- name: Run tests
110+
run: cargo +nightly test --release -j $(nproc) -- --test-threads=$(nproc)
111+
env:
112+
RUST_LOG: warn
48113

49114
docker:
50-
needs: [lint, build-and-test]
51-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
52-
runs-on: ubuntu-latest
53-
permissions:
54-
contents: read
55-
packages: write
115+
name: Docker build
116+
runs-on: blacksmith-32vcpu-ubuntu-2404
117+
needs: [lint, build, test]
118+
if: github.ref == 'refs/heads/main'
56119
steps:
57120
- uses: actions/checkout@v4
58-
- name: Log in to GHCR
121+
122+
- name: Login to GHCR
59123
uses: docker/login-action@v3
60124
with:
61-
registry: ${{ env.REGISTRY }}
125+
registry: ghcr.io
62126
username: ${{ github.actor }}
63127
password: ${{ secrets.GITHUB_TOKEN }}
64-
- name: Build and push
65-
uses: docker/build-push-action@v5
128+
129+
- name: Build and push Docker image
130+
uses: docker/build-push-action@v6
66131
with:
67132
context: .
68133
push: true
69134
tags: |
70-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
71-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
135+
ghcr.io/${{ github.repository }}:latest
136+
ghcr.io/${{ github.repository }}:${{ github.sha }}

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ tempfile = "3"
5555
parking_lot = "0.12"
5656
dashmap = "6"
5757

58-
# Process / system
59-
libc = "0.2"
58+
6059

6160
[dev-dependencies]
6261
tokio-test = "0.4"

src/cleanup.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ pub async fn remove_work_dir(path: &Path) {
1313

1414
/// Kill all processes in a process group (best-effort).
1515
#[allow(dead_code)]
16-
pub fn kill_process_group(pgid: u32) {
17-
unsafe {
18-
libc::kill(-(pgid as i32), libc::SIGKILL);
19-
}
16+
pub async fn kill_process_group(pgid: u32) {
17+
let _ = tokio::process::Command::new("kill")
18+
.args(["-9", &format!("-{}", pgid)])
19+
.output()
20+
.await;
2021
}
2122

2223
/// Scan workspace base for stale session directories older than max_age_secs.

src/config.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use std::path::PathBuf;
33
const DEFAULT_PORT: u16 = 8080;
44
const DEFAULT_SESSION_TTL: u64 = 1800;
55
const DEFAULT_MAX_CONCURRENT: usize = 4;
6-
const DEFAULT_DISK_QUOTA_MB: u64 = 2048;
76
const DEFAULT_CLONE_TIMEOUT: u64 = 120;
87
const DEFAULT_AGENT_TIMEOUT: u64 = 600;
98
const DEFAULT_TEST_TIMEOUT: u64 = 300;
@@ -17,7 +16,6 @@ pub struct Config {
1716
pub auth_token: Option<String>,
1817
pub session_ttl_secs: u64,
1918
pub max_concurrent_evals: usize,
20-
pub disk_quota_mb: u64,
2119
pub clone_timeout_secs: u64,
2220
pub agent_timeout_secs: u64,
2321
pub test_timeout_secs: u64,
@@ -34,7 +32,6 @@ impl Config {
3432
auth_token: std::env::var("AUTH_TOKEN").ok(),
3533
session_ttl_secs: env_parse("SESSION_TTL_SECS", DEFAULT_SESSION_TTL),
3634
max_concurrent_evals: env_parse("MAX_CONCURRENT_EVALS", DEFAULT_MAX_CONCURRENT),
37-
disk_quota_mb: env_parse("DISK_QUOTA_MB", DEFAULT_DISK_QUOTA_MB),
3835
clone_timeout_secs: env_parse("CLONE_TIMEOUT_SECS", DEFAULT_CLONE_TIMEOUT),
3936
agent_timeout_secs: env_parse("AGENT_TIMEOUT_SECS", DEFAULT_AGENT_TIMEOUT),
4037
test_timeout_secs: env_parse("TEST_TIMEOUT_SECS", DEFAULT_TEST_TIMEOUT),
@@ -54,7 +51,6 @@ impl Config {
5451
tracing::info!("║ Auth: {:<28}║", if self.auth_token.is_some() { "enabled" } else { "disabled" });
5552
tracing::info!("║ Max concurrent: {:<28}║", self.max_concurrent_evals);
5653
tracing::info!("║ Session TTL: {:<25}s ║", self.session_ttl_secs);
57-
tracing::info!("║ Disk quota: {:<24}MB ║", self.disk_quota_mb);
5854
tracing::info!("║ Clone timeout: {:<25}s ║", self.clone_timeout_secs);
5955
tracing::info!("║ Agent timeout: {:<25}s ║", self.agent_timeout_secs);
6056
tracing::info!("║ Test timeout: {:<25}s ║", self.test_timeout_secs);
@@ -79,7 +75,6 @@ mod tests {
7975
let cfg = Config::from_env();
8076
assert_eq!(cfg.port, DEFAULT_PORT);
8177
assert_eq!(cfg.max_concurrent_evals, DEFAULT_MAX_CONCURRENT);
82-
assert_eq!(cfg.disk_quota_mb, DEFAULT_DISK_QUOTA_MB);
8378
}
8479

8580
#[test]

0 commit comments

Comments
 (0)