feat: Add Docker, uv, rust-toolchain for reproducible builds #22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| branches: [main, dev] | |
| push: | |
| branches: [main, dev] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| build-and-test: | |
| name: Build & Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # Use rust-toolchain.toml for version (pinned in repo) | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: nightly-2024-12-01 | |
| components: rustfmt, clippy | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| zkml/target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('zkml/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Check formatting | |
| working-directory: zkml | |
| run: cargo fmt --check || echo "::warning::Code formatting issues found (non-blocking)" | |
| continue-on-error: true | |
| - name: Build zkml library | |
| working-directory: zkml | |
| run: cargo build --lib | |
| - name: Run zkml/testing tests | |
| working-directory: zkml | |
| run: | | |
| echo "Running Merkle root public values test..." | |
| cargo test --test test_merkle_root_public -- --nocapture | |
| echo "Running Merkle tree tests..." | |
| cargo test --test merkle_tree_test -- --nocapture | |
| echo "Running chunk execution tests..." | |
| cargo test --test chunk_execution_test -- --nocapture | |
| echo "Running chunk proof generation test (release mode for speed)..." | |
| cargo test --test chunk_proof_test --release -- --nocapture | |
| - name: Run clippy (warnings only) | |
| working-directory: zkml | |
| run: cargo clippy --lib -- -W clippy::all || echo "::warning::Clippy warnings found (non-blocking)" | |
| continue-on-error: true | |
| # Docker build test - ensures Dockerfile works | |
| docker-build: | |
| name: Docker Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build dev image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| target: dev | |
| push: false | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| tags: distributed-zkml:dev | |
| # Python dependency check | |
| python-deps: | |
| name: Python Dependencies | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| version: "latest" | |
| - name: Set up Python | |
| run: uv python install 3.11 | |
| - name: Install dependencies | |
| run: uv sync | |
| - name: Check Python imports work | |
| run: | | |
| uv run python -c "import ray; print(f'Ray version: {ray.__version__}')" | |
| uv run python -c "from python.rust_prover import prove_chunk; print('rust_prover imports OK')" | |
| # Note: AWS/GPU tests are intentionally excluded from CI to save costs. | |
| # Run them manually on GPU instances. |