Skip to content

Commit 5797025

Browse files
committed
feat: production-ready implementation with Basilica integration
- config.rs: typed env-var configuration with startup banner - sandbox.rs: resource-limited process execution (ulimit, nice, timeouts, output truncation) - metrics.rs: Prometheus-compatible /metrics endpoint - cleanup.rs: session directory reaping, process group kill - basilica.rs: auto-enroll public metadata on startup - session.rs: eval steps tracking, session stats, TTL reaper - task.rs: workspace.yaml + checks.txt parsing, archive validation - executor.rs: full eval pipeline (download → clone → install → agent → tests) - handlers.rs: /health, /status, /metrics, /evaluate, /evaluations endpoints - main.rs: graceful shutdown, concurrency limiter, background reapers - Dockerfile: multi-stage with Python, Node, Go, Rust toolchains - CI: lint (fmt+clippy) + build + test + Docker push - README: Mermaid diagrams, API reference, deployment guide 28 tests, 0 warnings, 0 clippy issues.
1 parent 18f4f67 commit 5797025

File tree

16 files changed

+1707
-600
lines changed

16 files changed

+1707
-600
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,46 +12,55 @@ env:
1212
IMAGE_NAME: ${{ github.repository }}
1313

1414
jobs:
15-
build-and-test:
15+
lint:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v4
19+
- uses: dtolnay/rust-toolchain@nightly
20+
with:
21+
components: rustfmt, clippy
22+
- uses: actions/cache@v4
23+
with:
24+
path: |
25+
~/.cargo/registry
26+
~/.cargo/git
27+
target
28+
key: ${{ runner.os }}-lint-${{ hashFiles('**/Cargo.lock') }}
29+
- run: cargo +nightly fmt --check
30+
- run: cargo +nightly clippy -- -D warnings
1931

20-
- name: Install Rust
21-
uses: dtolnay/rust-toolchain@stable
22-
23-
- name: Cache cargo
24-
uses: actions/cache@v4
32+
build-and-test:
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: dtolnay/rust-toolchain@stable
37+
- uses: actions/cache@v4
2538
with:
2639
path: |
2740
~/.cargo/registry
2841
~/.cargo/git
2942
target
3043
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
31-
3244
- name: Build
3345
run: cargo build --release
34-
3546
- name: Test
3647
run: cargo test
3748

3849
docker:
39-
needs: build-and-test
50+
needs: [lint, build-and-test]
4051
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
4152
runs-on: ubuntu-latest
4253
permissions:
4354
contents: read
4455
packages: write
4556
steps:
4657
- uses: actions/checkout@v4
47-
4858
- name: Log in to GHCR
4959
uses: docker/login-action@v3
5060
with:
5161
registry: ${{ env.REGISTRY }}
5262
username: ${{ github.actor }}
5363
password: ${{ secrets.GITHUB_TOKEN }}
54-
5564
- name: Build and push
5665
uses: docker/build-push-action@v5
5766
with:

Cargo.lock

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

Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,11 @@ tempfile = "3"
5555
parking_lot = "0.12"
5656
dashmap = "6"
5757

58+
# Process / system
59+
libc = "0.2"
60+
61+
# URL encoding
62+
urlencoding = "2"
63+
5864
[dev-dependencies]
5965
tokio-test = "0.4"

Dockerfile

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,36 @@
1-
# Build stage
21
FROM rust:1.83-bookworm AS builder
32
WORKDIR /build
4-
COPY Cargo.toml Cargo.lock* ./
5-
COPY src/ src/
3+
COPY Cargo.toml Cargo.lock ./
4+
COPY src ./src
65
RUN cargo build --release
76

8-
# Runtime stage
97
FROM debian:bookworm-slim
108

119
RUN apt-get update && apt-get install -y --no-install-recommends \
12-
ca-certificates git curl wget \
10+
ca-certificates git curl wget procps \
1311
python3 python3-pip python3-venv \
1412
nodejs npm \
1513
build-essential pkg-config libssl-dev \
1614
&& rm -rf /var/lib/apt/lists/*
1715

18-
# Install common test tools
19-
RUN python3 -m pip install --break-system-packages pytest pytest-cov \
20-
&& npm install -g tsx jest vitest
16+
RUN python3 -m pip install --break-system-packages \
17+
pytest pytest-cov pytest-xdist unittest2 nose2 tox
18+
19+
RUN npm install -g tsx jest vitest mocha
2120

22-
# Install Go
2321
RUN curl -fsSL https://go.dev/dl/go1.22.5.linux-amd64.tar.gz | tar -C /usr/local -xz
24-
ENV PATH="/usr/local/go/bin:${PATH}"
2522

26-
COPY --from=builder /build/target/release/term-executor /usr/local/bin/term-executor
23+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
2724

28-
RUN mkdir -p /tmp/sessions
25+
ENV PATH="/usr/local/go/bin:/root/.cargo/bin:${PATH}"
2926

30-
ENV PORT=8080
31-
ENV RUST_LOG=info,term_executor=debug
27+
COPY --from=builder /build/target/release/term-executor /usr/local/bin/
28+
29+
RUN mkdir -p /tmp/sessions
3230

3331
EXPOSE 8080
3432

33+
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
34+
CMD curl -f http://localhost:8080/health || exit 1
35+
3536
CMD ["term-executor"]

0 commit comments

Comments
 (0)