-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
193 lines (167 loc) · 6.23 KB
/
justfile
File metadata and controls
193 lines (167 loc) · 6.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# SyndDB CI Commands
#
# This justfile contains commands used by CI workflows.
# For local development, use cargo/forge commands directly.
#
# Install just: https://github.com/casey/just
# brew install just
# cargo install just
#
# Usage:
# just # Show available commands
# just test # Run all tests
# just check # Run all lints
#
# ============================================================================
# Settings
# ============================================================================
set shell := ["bash", "-euo", "pipefail", "-c"]
set dotenv-load := true
set dotenv-filename := ".env.defaults"
set export := true
# ============================================================================
# Configuration
# ============================================================================
# Variables loaded from .env.defaults for CI test commands
anvil_key_0 := env_var('ANVIL_KEY_0')
# ============================================================================
# Default & Help
# ============================================================================
# Show available commands
default:
@just --list --unsorted
# ============================================================================
# Testing
# ============================================================================
# Run unit tests
[group('test')]
test:
cargo nextest run --workspace --all-features --exclude synddb-e2e --exclude synddb-e2e-gcs
# Run tests with output
[group('test')]
test-verbose:
cargo nextest run --workspace --all-features --exclude synddb-e2e --exclude synddb-e2e-gcs --no-capture
# Run stress test (starts sequencer automatically)
[group('test')]
test-stress:
#!/usr/bin/env bash
set -euxo pipefail
cargo build --package synddb-benchmark --bin session-stress-test --release
cargo build --package synddb-sequencer --release
SIGNING_KEY={{ anvil_key_0 }} ./target/release/synddb-sequencer &
SEQUENCER_PID=$!
trap "kill $SEQUENCER_PID 2>/dev/null || true" EXIT
for i in {1..30}; do
if curl -s http://localhost:8433/health > /dev/null 2>&1; then
echo "Sequencer is healthy"
break
fi
echo "Waiting for sequencer... ($i/30)"
sleep 1
done
./target/release/session-stress-test --duration ${STRESS_TEST_DURATION:-15}
# Run client integration tests (starts sequencer automatically)
[group('test')]
test-integration:
#!/usr/bin/env bash
set -euxo pipefail
cargo build --package synddb-sequencer --release
SIGNING_KEY={{ anvil_key_0 }} ./target/release/synddb-sequencer &
SEQUENCER_PID=$!
trap "kill $SEQUENCER_PID 2>/dev/null || true" EXIT
for i in {1..30}; do
if curl -s http://localhost:8433/health > /dev/null 2>&1; then
echo "Sequencer is healthy"
break
fi
echo "Waiting for sequencer... ($i/30)"
sleep 1
done
cargo test -p synddb-client --lib -- --ignored --skip attestation
# Run SQLite fuzzer (set PROPTEST_CASES for more iterations)
[group('test')]
fuzz:
PROPTEST_CASES=${PROPTEST_CASES:-256} cargo test -p synddb-fuzzer --release
# Run E2E pipeline fuzzer (set PROPTEST_CASES for more iterations)
[group('test')]
fuzz-e2e:
PROPTEST_CASES=${PROPTEST_CASES:-100} cargo test -p synddb-e2e-fuzzer --release
# Run E2E stress tests (set PROPTEST_CASES for more iterations)
[group('test')]
fuzz-e2e-stress:
PROPTEST_CASES=${PROPTEST_CASES:-10} cargo test -p synddb-e2e-fuzzer --release -- --ignored
# ============================================================================
# Linting
# ============================================================================
# Run Clippy lints
[group('lint')]
lint:
cargo clippy --workspace --all-targets --all-features
# Check TOML formatting
[group('lint')]
lint-toml:
taplo lint "**/Cargo.toml"
taplo fmt --check "**/Cargo.toml"
# Check for unused dependencies
[group('lint')]
lint-deps:
cargo machete
# Check Rust formatting
[group('lint')]
lint-fmt:
cargo +nightly fmt --all --check
# Check documentation builds without warnings
[group('lint')]
lint-docs:
cargo doc --workspace --all-features --no-deps
# Run all lints
[group('lint')]
check: lint-toml lint-deps lint-fmt lint
@echo "All checks passed!"
# ============================================================================
# Reproducible Builds (for Confidential Space / TEE verification)
# ============================================================================
# BuildKit version pinned for reproducibility
buildkit_version := "moby/buildkit:" + trim(read("docker/reproducible/buildkit.version"))
buildkit_builder := "synddb-repro"
# Set up BuildKit builder with pinned version
[group('reproducible')]
repro-setup:
#!/usr/bin/env bash
set -euo pipefail
if docker buildx inspect {{ buildkit_builder }} >/dev/null 2>&1; then
echo "Builder '{{ buildkit_builder }}' already exists"
else
echo "Creating builder '{{ buildkit_builder }}' with {{ buildkit_version }}"
docker buildx create --name {{ buildkit_builder }} --driver docker-container --driver-opt image={{ buildkit_version }}
fi
docker buildx inspect {{ buildkit_builder }} --bootstrap
# Build reproducible sequencer image
[group('reproducible')]
repro-sequencer: repro-setup
SOURCE_DATE_EPOCH=0 docker buildx build \
--builder {{ buildkit_builder }} \
--no-cache \
--provenance=false \
--sbom=false \
--build-arg SOURCE_DATE_EPOCH=0 \
--platform linux/amd64 \
--output type=docker,rewrite-timestamp=true \
-f docker/reproducible/sequencer.Dockerfile \
-t synddb-sequencer:reproducible .
# Build reproducible validator image
[group('reproducible')]
repro-validator: repro-setup
SOURCE_DATE_EPOCH=0 docker buildx build \
--builder {{ buildkit_builder }} \
--no-cache \
--provenance=false \
--sbom=false \
--build-arg SOURCE_DATE_EPOCH=0 \
--platform linux/amd64 \
--output type=docker,rewrite-timestamp=true \
-f docker/reproducible/validator.Dockerfile \
-t synddb-validator:reproducible .
# Build all reproducible images
[group('reproducible')]
repro-all: repro-sequencer repro-validator