Skip to content
Merged
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
48 changes: 39 additions & 9 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,66 @@ name: Build and Push to GHCR
on:
push:
branches: [ "main" ]
paths-ignore: [ "**/*.md" ]
pull_request:
branches: [ "main" ]
paths-ignore: [ "**/*.md" ]

jobs:
test:
fmt:
runs-on: ubuntu-latest
container: rust:slim
steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Install rustfmt
run: rustup component add rustfmt

- name: Check formatting
run: cargo fmt --all -- --check

clippy:
runs-on: ubuntu-latest
container: rust:slim
steps:
- uses: actions/checkout@v4

- name: Install build deps
run: apt-get update && apt-get install -y --no-install-recommends build-essential pkg-config

- name: Install clippy
run: rustup component add clippy

- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: clippy

- name: Clippy
run: cargo clippy --workspace --all-targets -- -D warnings

test:
runs-on: ubuntu-latest
container: rust:slim
steps:
- uses: actions/checkout@v4

- name: Install build deps
run: apt-get update && apt-get install -y --no-install-recommends build-essential pkg-config

- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
shared-key: test

- name: Test
run: cargo test --workspace

build:
if: github.event_name == 'push'
needs: test
needs: [fmt, clippy, test]
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64]
runs-on: ubuntu-latest
Expand Down
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,17 @@ RUN cargo chef prepare --bin uc-server --recipe-path recipe.json

FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json
# Own target/ cache id (separate Cargo.lock from aispecs/operator); registry cache id is shared globally.
# Own target/ cache id (separate Cargo.lock from aispecs/operator); registry cache id is
# shared globally. The "-alpine" suffix ties this cache to the builder base image: compiled
# .rlib/.so artifacts are toolchain/ABI-specific, so reusing a cache built under a different
# base (e.g. glibc rust:latest) causes relocation failures like a missing __ubsan_handle_*
# symbol. Bump this suffix again if the builder base image changes.
RUN --mount=type=cache,target=/usr/local/cargo/registry,id=cargo-registry \
--mount=type=cache,target=/app/target,id=cargo-target-uc \
--mount=type=cache,target=/app/target,id=cargo-target-uc-alpine \
cargo chef cook --zigbuild --profile docker --bin uc-server --target "$(cat /rust_target.txt)" --recipe-path recipe.json
COPY . .
RUN --mount=type=cache,target=/usr/local/cargo/registry,id=cargo-registry \
--mount=type=cache,target=/app/target,id=cargo-target-uc \
--mount=type=cache,target=/app/target,id=cargo-target-uc-alpine \
cargo zigbuild --profile docker --target "$(cat /rust_target.txt)" -p uc-server && \
cp "/app/target/$(cat /rust_target.txt)/docker/uc-server" /uc-server-bin

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ unitycatalog-rs/
| Database | `sqlx 0.7` (SQLite default, Postgres via feature flag) |
| Auth | `jsonwebtoken 9` (RS512 JWT) + `casbin` (RBAC) |
| Serialization | `serde` + `serde_json` |
| Cloud credentials | `aws-sdk-sts` (feature-gated) |
| Cloud credentials | `aws-sdk-sts` (always compiled in; vending toggled at runtime via `--enable-aws-credentials`, default on) |

## Quick Start

Expand Down Expand Up @@ -144,7 +144,7 @@ Migrations run automatically on startup from `migrations/sqlite/` or `migrations

```bash
cargo check # fast type check
cargo test --lib # 16 unit tests (JWT, serde, error mapping)
cargo test --lib # unit tests across the workspace (JWT, serde, error mapping, ...)
cargo build # full build
```

Expand Down
Loading