Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
353 lines (292 loc) · 11.5 KB
/
Copy pathjustfile
File metadata and controls
353 lines (292 loc) · 11.5 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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
init: submodules
command -v cargo-zigbuild >/dev/null 2>&1 || cargo install cargo-zigbuild
command -v cargo-llvm-cov >/dev/null 2>&1 || cargo install cargo-llvm-cov
command -v zig >/dev/null 2>&1 || echo "⚠️ Warning: 'zig' not found in PATH. Required for cross-compilation."
command -v prek >/dev/null 2>&1 || echo "⚠️ Warning: 'prek' not found in PATH. Required for running pre-commit hooks."
command -v vhs >/dev/null 2>&1 || echo "⚠️ Warning: 'vhs' not found in PATH. Required for running VHS demos."
rustup target list --installed | grep -q x86_64-unknown-linux-musl || rustup target add x86_64-unknown-linux-musl
rustup target list --installed | grep -q aarch64-unknown-linux-musl || rustup target add aarch64-unknown-linux-musl
# Pull and sync git submodules
submodules:
git submodule update --init --recursive
# Build the project
build:
cargo build
# Build static lite version for Linux x86_64 (uses zigbuild for musl cross-compilation)
build-static:
cargo zigbuild --release --target x86_64-unknown-linux-musl
# Build in development mode
build-release:
cargo build --release
# Run all unit tests
test:
cargo test --lib
# Run all CTK integration tests (consolidated report)
test-ctk:
cargo test --test ctk_conformance
test-examples:
cargo test --test example_tests
test-validate:
cargo test --test validate_tests
# Run all tests (unit + integration)
test-all:
cargo test
# Run Docker integration tests (requires Docker image to be built)
test-docker: docker-build
cargo test --test docker_integration_tests
# Run listener tests (gRPC and HTTP/OpenAPI)
test-listeners:
cargo test --test listener_tests --no-fail-fast
# Run nested workflow tests
test-nested-workflows:
cargo test --test nested_workflow_tests --no-fail-fast
# Build Docker image and run integration tests
test-docker-full: docker-build test-docker
# Generate code coverage report for all tests (unit and integration tests)
coverage:
cargo llvm-cov \
--all-features \
--workspace \
--html \
--open
# Generate coverage report without opening browser
coverage-report:
cargo llvm-cov \
--all-features \
--workspace \
--html
# Clean coverage data
coverage-clean:
cargo llvm-cov clean
# Clean build artifacts
clean:
cargo clean
# Clean up test containers (PostgreSQL test containers)
clean-test-containers:
#!/usr/bin/env bash
set -euo pipefail
echo "Cleaning up PostgreSQL test containers..."
# Remove all postgres test containers
docker ps -aq --filter "ancestor=postgres:16-alpine" 2>/dev/null | xargs -r docker rm -f || true
podman ps -aq --filter "ancestor=postgres:16-alpine" 2>/dev/null | xargs -r podman rm -f || true
echo "✓ Test containers cleaned"
# Clean up all stopped containers and dangling images
clean-containers-all:
#!/usr/bin/env bash
set -euo pipefail
echo "Cleaning up all stopped containers..."
docker container prune -f 2>/dev/null || true
podman container prune -f 2>/dev/null || true
echo "✓ All stopped containers cleaned"
# Format code
fmt:
cargo fmt
# Run clippy linter
lint:
cargo clippy --all-targets --all-features -- -D warnings
# Check for potential panics (unwrap, expect, etc.)
lint-panics:
cargo clippy -- \
-W clippy::unwrap_used \
-W clippy::expect_used \
-W clippy::panic \
-W clippy::indexing_slicing
# Check code without building
check:
cargo check
# Run full CI pipeline locally
ci:
cargo build
./target/debug/jackdaw run .ci/ci.sw.yaml \
--durable-db .ci/ci-persistence.db \
--cache-db .ci/ci-cache.db \
--verbose
# Run CI and force re-execution (skip cache)
ci-clean:
cargo build
./target/debug/jackdaw run .ci/ci.sw.yaml \
--durable-db .ci/ci-persistence.db \
--cache-db .ci/ci-cache.db \
--no-cache \
--verbose
# Clean CI databases
ci-reset:
rm -f .ci/ci-persistence.db .ci/ci-cache.db
# ============================================================================
# Release Binary Building
# ============================================================================
# Build static Linux binary (x86_64, musl)
build-linux-amd64:
cargo zigbuild --release --target x86_64-unknown-linux-musl
# Build static Linux binary (ARM64, musl)
build-linux-arm64:
cargo zigbuild --release --target aarch64-unknown-linux-musl
# Build macOS binary (Intel)
build-macos-amd64:
cargo build --release --target x86_64-apple-darwin
# Build macOS binary (Apple Silicon)
build-macos-arm64:
cargo build --release --target aarch64-apple-darwin
# Build universal macOS binary (combines Intel + Apple Silicon)
build-macos-universal: build-macos-amd64 build-macos-arm64
#!/usr/bin/env bash
set -euo pipefail
mkdir -p target/universal-apple-darwin/release
lipo -create \
target/x86_64-apple-darwin/release/jackdaw \
target/aarch64-apple-darwin/release/jackdaw \
-output target/universal-apple-darwin/release/jackdaw
echo "Universal macOS binary created: target/universal-apple-darwin/release/jackdaw"
# Build all release binaries (Linux x86_64, Linux ARM64, macOS universal)
build-all-release: build-linux-amd64 build-linux-arm64 build-macos-universal
@echo "All release binaries built:"
@echo " - target/x86_64-unknown-linux-musl/release/jackdaw"
@echo " - target/aarch64-unknown-linux-musl/release/jackdaw"
@echo " - target/universal-apple-darwin/release/jackdaw"
# Package release binaries with version tag
package-release VERSION:
#!/usr/bin/env bash
set -euo pipefail
mkdir -p dist
# Linux x86_64
tar -czf dist/jackdaw-{{VERSION}}-linux-amd64.tar.gz \
-C target/x86_64-unknown-linux-musl/release jackdaw
# Linux ARM64
tar -czf dist/jackdaw-{{VERSION}}-linux-arm64.tar.gz \
-C target/aarch64-unknown-linux-musl/release jackdaw
# macOS Universal
tar -czf dist/jackdaw-{{VERSION}}-macos-universal.tar.gz \
-C target/universal-apple-darwin/release jackdaw
# Generate checksums
cd dist
shasum -a 256 jackdaw-{{VERSION}}-*.tar.gz > jackdaw-{{VERSION}}-checksums.txt
cd ..
echo "✓ Release packages created in dist/"
ls -lh dist/jackdaw-{{VERSION}}-*
# Show binary sizes
show-binary-sizes:
@echo "Binary sizes:"
@ls -lh target/x86_64-unknown-linux-musl/release/jackdaw 2>/dev/null || echo " x86_64-linux-musl: not built"
@ls -lh target/aarch64-unknown-linux-musl/release/jackdaw 2>/dev/null || echo " aarch64-linux-musl: not built"
@ls -lh target/universal-apple-darwin/release/jackdaw 2>/dev/null || echo " universal-apple-darwin: not built"
# ============================================================================
# Docker Builds (Linux cross-compilation)
# ============================================================================
# Build Docker image for current platform
docker-build:
docker buildx build --load -t jackdaw:latest .
# Build Docker image for multiple platforms (amd64 and arm64)
docker-build-multiplatform:
docker buildx build --platform linux/amd64,linux/arm64 -t jackdaw:latest .
# Build and push Docker image for multiple platforms
docker-build-push:
docker buildx build --platform linux/amd64,linux/arm64 -t jackdaw:latest --push .
# Build Linux x86_64 binary using Docker (extracts from builder stage)
docker-build-linux-amd64:
#!/usr/bin/env bash
set -euo pipefail
echo "Building Linux x86_64 binary in Docker..."
docker buildx build \
--platform linux/amd64 \
--target builder \
--load \
-t jackdaw-builder:linux-amd64 .
echo "Extracting binary..."
mkdir -p dist
docker create --name jackdaw-extract jackdaw-builder:linux-amd64
docker cp jackdaw-extract:/build/target/release/jackdaw ./dist/jackdaw-linux-amd64
docker rm jackdaw-extract
echo "Linux x86_64 binary ready: ./dist/jackdaw-linux-amd64"
ls -lh ./dist/jackdaw-linux-amd64
file ./dist/jackdaw-linux-amd64
# Build Linux ARM64 binary using Docker (extracts from builder stage)
docker-build-linux-arm64:
#!/usr/bin/env bash
set -euo pipefail
echo "Building Linux ARM64 binary in Docker..."
docker buildx build \
--platform linux/arm64 \
--target builder \
--load \
-t jackdaw-builder:linux-arm64 .
echo "Extracting binary..."
mkdir -p dist
docker create --name jackdaw-extract jackdaw-builder:linux-arm64
docker cp jackdaw-extract:/build/target/release/jackdaw ./dist/jackdaw-linux-arm64
docker rm jackdaw-extract
echo "Linux ARM64 binary ready: ./dist/jackdaw-linux-arm64"
ls -lh ./dist/jackdaw-linux-arm64
file ./dist/jackdaw-linux-arm64
# Build both Linux binaries (amd64 and arm64)
docker-build-linux: docker-build-linux-amd64 docker-build-linux-arm64
@echo ""
@echo "All Linux binaries built:"
@ls -lh ./dist/jackdaw-linux-*
# Build all release binaries (Linux via Docker, macOS native)
docker-build-all: docker-build-linux build-macos-universal
@echo ""
@echo "All release binaries ready:"
@ls -lh ./dist/jackdaw-*
@ls -lh ./target/universal-apple-darwin/release/jackdaw
vhs:
vhs docs/vhs/hello-world.tape
vhs docs/vhs/hello-world-debug.tape
vhs docs/vhs/run-container.tape
vhs docs/vhs/run-python.tape
vhs docs/vhs/run-javascript.tape
vhs docs/vhs/cache-debug.tape
vhs docs/vhs/persistence-demo.tape
# vhs docs/vhs/listener-openapi.tape
# vhs docs/vhs/listener-grpc.tape
vhs docs/vhs/hello-world-validate.tape
# ============================================================================
# Python Package Publishing
# ============================================================================
# Build Python wheels for current platform
python-build:
maturin build --release --features python
# Build Python wheels in development mode (editable install)
python-develop:
maturin develop --features python
# Build Python wheels for all platforms (requires docker/cross)
python-build-all:
#!/usr/bin/env bash
set -euo pipefail
echo "Building Python wheels for multiple platforms..."
# Build for current platform
maturin build --release --features python
echo "✓ Wheels built in target/wheels/"
ls -lh target/wheels/
# Publish Python package to PyPI
python-publish:
maturin upload target/wheels/jackdaw-*.whl
# Publish Python package to TestPyPI (for testing)
python-publish-test:
maturin upload --repository testpypi target/wheels/jackdaw-*.whl
# Run Python examples
python-examples:
python examples/python/simple_workflow.py
python examples/python/event_streaming.py
# ============================================================================
# Release Management
# ============================================================================
# Publish Rust crate to crates.io
publish-crate:
#!/usr/bin/env bash
set -euo pipefail
echo "Publishing Rust crate to crates.io..."
cargo publish
echo "✓ Published to crates.io"
# Publish Python package to PyPI
publish-python: python-build
#!/usr/bin/env bash
set -euo pipefail
echo "Publishing Python package to PyPI..."
maturin upload target/wheels/jackdaw-*.whl
echo "✓ Published to PyPI"
# Full release: publish both Rust crate and Python package
publish-all: publish-crate publish-python
@echo ""
@echo "✓ All packages published!"
@echo " - Rust crate: https://crates.io/crates/jackdaw"
@echo " - Python package: https://pypi.org/project/jackdaw"