Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .cargo/vendor-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 폐쇄형(Air-Gapped) 빌드용 cargo source-replacement 템플릿.
#
# scripts/vendor.sh 가 이 파일을 .cargo/config.toml 로 복사하여 활성화합니다.
# 일반 (온라인) 빌드는 이 파일을 무시하므로 영향이 없습니다.
#
# 활성화 후:
# - cargo build --offline --workspace
# - cargo test --offline --workspace
# - cargo clippy --offline --workspace --all-targets -- -D warnings
# - cargo fmt --all -- --check
#
# vendor/ 디렉토리는 .gitignore 에 등록되어 있고, scripts/vendor.sh 의
# `cargo vendor` 실행 산출물입니다 (~500MB–1GB).

[source.crates-io]
replace-with = "vendored-sources"

[source.vendored-sources]
directory = "vendor"

# 결정론적 빌드를 위해 net.offline 강제. 활성화 후 외부 fetch 시도가 있으면
# 빌드가 즉시 실패하여 폐쇄망 정책 위반을 컴파일 시점에 차단합니다.
[net]
offline = true
59 changes: 59 additions & 0 deletions .github/actions/checkout-deps/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# 워크스페이스 `Cargo.toml`의 path dependency (`../elib-k0-nt/*`)가 가리키는
# 시블링 디렉토리를 CI 환경에 재현합니다. `actions/checkout`는 `path` 입력에
# 워크스페이스 외부(`..`)를 허용하지 않으므로 `git clone`으로 직접 시블링
# 위치에 배치합니다.
#
# 핀: 의존성 그래프(특히 zeroize 엣지)가 `Cargo.lock`과 일치해야 `--locked`
# 빌드가 통과합니다. elib-k0-nt 태그 `1.0.0`은 zeroize 엣지가 없는 옛
# 스냅샷이므로 사용 불가. 현재 lock은 master HEAD에서 생성되었기에
# 동일 커밋 SHA에 고정합니다. lock을 갱신할 때 본 SHA도 함께
# 갱신해야 CI가 재현 가능 상태로 유지됩니다.

name: checkout-deps
description: Lumen 워크스페이스의 시블링 path dependency(elib-k0-nt) 체크아웃

inputs:
ref:
description: elib-k0-nt에서 체크아웃할 git ref(태그/브랜치/커밋 SHA)
required: false
# `Cargo.lock` 과 정합하는 master HEAD; 변경 시 lock 도 함께 재생성
default: "618ac0dc8200ce740cbd698d0e93adb98ddc75e7"
token:
description: 비공개 elib-k0-nt 접근용 토큰; 비워두면 익명 HTTPS clone 시도
required: false
default: ""

runs:
using: composite
steps:
- name: clone elib-k0-nt as sibling
shell: bash
run: |
set -euo pipefail
TARGET="$(dirname "$GITHUB_WORKSPACE")/elib-k0-nt"
REF="${{ inputs.ref }}"
TOKEN="${{ inputs.token }}"

if [ -n "$TOKEN" ]; then
URL="https://x-access-token:${TOKEN}@github.com/Quant-Off/elib-k0-nt.git"
else
URL="https://github.com/Quant-Off/elib-k0-nt.git"
fi

# init + fetch 패턴: `git clone --branch`는 SHA를 받지 못하므로
# 임의 ref(태그/브랜치/커밋)를 모두 처리하기 위해 빈 저장소에서
# 시작해 단일 ref를 얕게(depth=1) 가져옵니다.
if [ ! -d "$TARGET/.git" ]; then
echo "elib-k0-nt 를 '$TARGET' 에 초기화합니다."
mkdir -p "$TARGET"
git -C "$TARGET" init -q
git -C "$TARGET" remote add origin "$URL"
else
echo "elib-k0-nt 이미 존재: origin URL 갱신 후 재페치합니다."
git -C "$TARGET" remote set-url origin "$URL"
fi

git -C "$TARGET" fetch --depth=1 origin "$REF"
git -C "$TARGET" checkout --detach FETCH_HEAD

echo "elib-k0-nt HEAD: $(git -C "$TARGET" rev-parse HEAD)"
10 changes: 6 additions & 4 deletions .github/docker/Dockerfile.ci
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Lumen CI 베이스 이미지.
#
# 모든 GitHub Actions 잡(`build-test`, `features`, `lint`, `docs`, `deny`,
# 모든 GitHub Actions 잡(`build-test`, `air-gapped`, `lint`, `docs`, `deny`,
# `audit`)이 이 컨테이너 안에서 실행되어 toolchain·시스템 의존성·사전 설치된
# cargo 도구를 동일하게 사용합니다. 이 파일·`rust-toolchain.toml`이 변경되면
# `.github/workflows/ci.yml` 의 `image` 잡이 자동으로 새 태그를 빌드/푸시합니다.
Expand All @@ -12,18 +12,20 @@
FROM rust:1.93-bookworm

# 워크스페이스 빌드에 필요한 시스템 패키지.
# - protobuf-compiler : `lumen-inference` 의 candle / candle-onnx 빌드 의존성
# - cmake / build-essential / pkg-config / libssl-dev :
# 일부 native crate (wasmtime / cranelift / 향후 dep) 의 보편적 빌드 요구
# 일부 native crate (wasmtime / cranelift / 향후 llama.cpp 등) 의
# 보편적 빌드 요구
# - git : cargo-deny advisory DB fetch 및 일부 build script 가 사용
#
# 참고: 과거에는 `protobuf-compiler` 도 설치했으나 candle / candle-onnx
# 제거(v0.4)로 더 이상 필요하지 않습니다.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
build-essential \
cmake \
pkg-config \
libssl-dev \
protobuf-compiler \
git \
&& rm -rf /var/lib/apt/lists/*

Expand Down
47 changes: 36 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ permissions:

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
# Q. T. Felix NOTE: 과거에는 `RUSTFLAGS: -D warnings` 를 워크플로우 전역으로
# 걸었으나, 이 환경변수는 워크스페이스 외부 path dep
# (`../elib-k0-nt/*`) 컴파일에도 그대로 적용되어 외부
# 레포의 사소한 dead_code 경고가 lumen CI 를 깨뜨리는
# 문제가 있었습니다. 동등한 게이트는 이제 워크스페이스
# `[workspace.lints.rust]` 의 `warnings = "deny"` 로
# lumen 멤버에만 한정해 적용됩니다. clippy 게이트는
# 여전히 `cargo clippy ... -- -D warnings` 로 수행하며,
# 이 인자는 primary package (lumen 멤버) 에만 적용됩니다.

jobs:
# ---------------------------------------------------------------------------
Expand Down Expand Up @@ -77,6 +85,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/checkout-deps
- uses: Swatinem/rust-cache@v2
- name: cargo build
run: cargo build --workspace --all-targets --locked
Expand All @@ -98,6 +107,7 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/checkout-deps
- name: install protoc
run: brew install protobuf
- uses: Swatinem/rust-cache@v2
Expand All @@ -112,10 +122,18 @@ jobs:
run: cargo build --release --target wasm32-unknown-unknown --locked

# ---------------------------------------------------------------------------
# 무거운 optional features (halo2, candle).
# ---------------------------------------------------------------------------
features:
name: optional features (halo2, candle)
# 폐쇄 환경(Air-Gapped) 호환성: `--offline` 빌드로 네트워크 fetch 없이도
# 워크스페이스가 빌드되는지 검증합니다. 의존성은 사전에 한 번만 받아오고,
# 그 이후의 `--offline` 단계가 통과해야 진짜 폐쇄망 배포 가능 상태입니다.
#
# 참고:
# - `lumen-zkml` 의 `halo2` feature 는 v0.4 에서 제거되었습니다.
# - `lumen-inference` 의 `candle` feature 도 v0.4 에서 제거되었습니다
# (`tokenizers` / `rand_core` 등 외부 의존 트리 정리). 도구 라우팅용
# 토크나이저는 자체 구현 `lumen_inference::BpeTokenizer` 를 사용합니다.
# ---------------------------------------------------------------------------
air-gapped:
name: air-gapped (--offline)
needs: image
runs-on: ubuntu-latest
container:
Expand All @@ -125,13 +143,16 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/checkout-deps
- uses: Swatinem/rust-cache@v2
- name: cargo build --features halo2
run: cargo build -p lumen-zkml --features halo2 --locked
- name: cargo test --features halo2
run: cargo test -p lumen-zkml --features halo2 --locked
- name: cargo build --features candle
run: cargo build -p lumen-inference --features candle --locked
- name: cargo fetch (online, one-shot)
run: cargo fetch --locked
- name: cargo build --offline (default features)
run: cargo build --workspace --all-targets --locked --offline
- name: cargo build --offline (no default features)
run: cargo build --workspace --no-default-features --locked --offline
- name: cargo test --offline
run: cargo test --workspace --locked --offline

# ---------------------------------------------------------------------------
# Lint: clippy + rustfmt.
Expand All @@ -147,6 +168,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/checkout-deps
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
- run: cargo clippy --workspace --all-targets -- -D warnings
Expand All @@ -167,6 +189,7 @@ jobs:
RUSTDOCFLAGS: -D warnings
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/checkout-deps
- uses: Swatinem/rust-cache@v2
- run: cargo doc --workspace --no-deps --document-private-items

Expand All @@ -184,6 +207,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/checkout-deps
- run: cargo deny check

# ---------------------------------------------------------------------------
Expand All @@ -200,4 +224,5 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/checkout-deps
- run: cargo audit
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
target/
.idea/
*.swp
.DS_Store
.DS_Store
/vendor/
/.cargo/config.toml
/.cargo/config.toml.backup-*
Loading
Loading