Skip to content

Commit 3049744

Browse files
Add release pipeline, CI workflows, and project scaffolding
- CI: cross-compile matrix (aarch64-linux, x86_64/aarch64-darwin) - Release: crates.io publish, multi-arch Docker, GitHub Release, docs dispatch - Release dry-run: manual workflow to validate before irreversible publish - Main image: pushes ghcr.io contextdb-server:main on every merge - Cargo.toml: version fields on path deps, keywords, categories, cargo-release config - README: badges, crates.io deps, install section, contextdb.tech links - docker-compose: uses published ghcr.io image with build fallback - New files: SECURITY.md, CONTRIBUTING.md, book.toml, docs/SUMMARY.md - Dockerfile, .dockerignore, nats.conf for server container - Acceptance: convert assert!(false) placeholders to #[ignore]
1 parent c60b548 commit 3049744

27 files changed

Lines changed: 567 additions & 104 deletions

File tree

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
target/
2+
.git/
3+
.claude/
4+
docs/
5+
benches/
6+
tests/
7+
*.md
8+
LICENSE

.github/workflows/ci.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,32 @@ jobs:
3737
- uses: dtolnay/rust-toolchain@stable
3838
- uses: Swatinem/rust-cache@v2
3939
- run: cargo test --workspace
40+
- run: cargo build --release
4041

41-
build:
42+
cross-compile:
4243
needs: lint
43-
runs-on: ubuntu-latest
44+
strategy:
45+
matrix:
46+
include:
47+
- target: aarch64-unknown-linux-gnu
48+
os: ubuntu-latest
49+
- target: x86_64-apple-darwin
50+
os: macos-latest
51+
- target: aarch64-apple-darwin
52+
os: macos-latest
53+
runs-on: ${{ matrix.os }}
4454
steps:
4555
- uses: actions/checkout@v4
4656
- uses: dtolnay/rust-toolchain@stable
57+
with:
58+
targets: ${{ matrix.target }}
4759
- uses: Swatinem/rust-cache@v2
48-
- run: cargo build --release -p contextdb-cli
49-
- uses: actions/upload-artifact@v4
5060
with:
51-
name: contextdb-linux-x86_64
52-
path: target/release/contextdb-cli
53-
retention-days: 7
61+
key: ${{ matrix.target }}
62+
- name: Install cross-compilation tools
63+
if: matrix.target == 'aarch64-unknown-linux-gnu'
64+
run: |
65+
sudo apt-get update
66+
sudo apt-get install -y gcc-aarch64-linux-gnu
67+
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
68+
- run: cargo build --release --target ${{ matrix.target }} -p contextdb-cli -p contextdb-server

.github/workflows/main-image.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Main Image
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
packages: write
9+
10+
env:
11+
IMAGE: ghcr.io/context-graph-ai/contextdb-server
12+
13+
jobs:
14+
build:
15+
strategy:
16+
matrix:
17+
include:
18+
- platform: linux/amd64
19+
runner: ubuntu-latest
20+
- platform: linux/arm64
21+
runner: ubuntu-24.04-arm
22+
runs-on: ${{ matrix.runner }}
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: docker/setup-buildx-action@v3
26+
- uses: docker/login-action@v3
27+
with:
28+
registry: ghcr.io
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
- name: Build and push digest
32+
id: build
33+
uses: docker/build-push-action@v6
34+
with:
35+
context: .
36+
platforms: ${{ matrix.platform }}
37+
push: true
38+
tags: ${{ env.IMAGE }}
39+
cache-from: type=gha,scope=${{ matrix.platform }}
40+
cache-to: type=gha,scope=${{ matrix.platform }},mode=max
41+
outputs: type=image,push-by-digest=true,name-canonical=true
42+
- name: Export digest
43+
run: |
44+
mkdir -p /tmp/digests
45+
digest="${{ steps.build.outputs.digest }}"
46+
touch "/tmp/digests/${digest#sha256:}"
47+
- uses: actions/upload-artifact@v4
48+
with:
49+
name: digest-${{ strategy.job-index }}
50+
path: /tmp/digests/*
51+
52+
merge:
53+
needs: build
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: docker/setup-buildx-action@v3
57+
- uses: docker/login-action@v3
58+
with:
59+
registry: ghcr.io
60+
username: ${{ github.actor }}
61+
password: ${{ secrets.GITHUB_TOKEN }}
62+
- uses: actions/download-artifact@v4
63+
with:
64+
path: /tmp/digests
65+
pattern: digest-*
66+
merge-multiple: true
67+
- name: Create manifest and push
68+
run: |
69+
cd /tmp/digests
70+
docker buildx imagetools create -t ${{ env.IMAGE }}:main \
71+
$(printf '${{ env.IMAGE }}@sha256:%s ' *)
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Release Dry Run
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
CARGO_TERM_COLOR: always
8+
CARGO_INCREMENTAL: 0
9+
10+
jobs:
11+
check:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: dtolnay/rust-toolchain@stable
16+
with:
17+
components: clippy, rustfmt
18+
- uses: Swatinem/rust-cache@v2
19+
- run: cargo fmt --all --check
20+
- run: cargo clippy --workspace --all-targets -- -D warnings
21+
- run: cargo test --workspace
22+
- run: cargo build --release
23+
24+
dry-run-publish:
25+
needs: check
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
- uses: dtolnay/rust-toolchain@stable
30+
- uses: Swatinem/rust-cache@v2
31+
- name: Dry-run publish all crates
32+
run: |
33+
for crate in contextdb-core contextdb-tx contextdb-relational contextdb-graph contextdb-vector contextdb-parser contextdb-planner contextdb-engine contextdb-server contextdb-cli; do
34+
echo "Dry-run: $crate"
35+
cargo publish -p $crate --dry-run
36+
done
37+
38+
dry-run-docker:
39+
needs: check
40+
strategy:
41+
matrix:
42+
include:
43+
- platform: linux/amd64
44+
runner: ubuntu-latest
45+
- platform: linux/arm64
46+
runner: ubuntu-24.04-arm
47+
runs-on: ${{ matrix.runner }}
48+
steps:
49+
- uses: actions/checkout@v4
50+
- uses: docker/setup-buildx-action@v3
51+
- name: Build image (no push)
52+
uses: docker/build-push-action@v6
53+
with:
54+
context: .
55+
platforms: ${{ matrix.platform }}
56+
push: false
57+
cache-from: type=gha,scope=${{ matrix.platform }}
58+
cache-to: type=gha,scope=${{ matrix.platform }},mode=max
59+
60+
dry-run-binaries:
61+
needs: check
62+
strategy:
63+
matrix:
64+
include:
65+
- target: x86_64-unknown-linux-gnu
66+
os: ubuntu-latest
67+
bins: contextdb-cli,contextdb-server
68+
- target: aarch64-unknown-linux-gnu
69+
os: ubuntu-latest
70+
bins: contextdb-cli,contextdb-server
71+
- target: x86_64-apple-darwin
72+
os: macos-latest
73+
bins: contextdb-cli
74+
- target: aarch64-apple-darwin
75+
os: macos-latest
76+
bins: contextdb-cli
77+
runs-on: ${{ matrix.os }}
78+
steps:
79+
- uses: actions/checkout@v4
80+
- uses: dtolnay/rust-toolchain@stable
81+
with:
82+
targets: ${{ matrix.target }}
83+
- uses: Swatinem/rust-cache@v2
84+
with:
85+
key: ${{ matrix.target }}
86+
- name: Install cross-compilation tools
87+
if: matrix.target == 'aarch64-unknown-linux-gnu'
88+
run: |
89+
sudo apt-get update
90+
sudo apt-get install -y gcc-aarch64-linux-gnu
91+
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
92+
- name: Build
93+
run: |
94+
for bin in $(echo "${{ matrix.bins }}" | tr ',' ' '); do
95+
cargo build --release --target ${{ matrix.target }} -p $bin
96+
done

0 commit comments

Comments
 (0)