Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
308 lines (256 loc) · 11 KB
/
Copy pathjustfile
File metadata and controls
308 lines (256 loc) · 11 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
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."
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
# Vendor the Open Workflow DSL models into jackdaw/src/dsl, copied verbatim (no edits) from `core/src/models`
# of the SDK. The commit is recorded in jackdaw/src/dsl/UPSTREAM. e.g. `just update-dsl` or
# `just update-dsl https://github.com/open-workflow-specification/sdk-rust.git v1.0.0`
update-dsl repo="https://github.com/arminhammer/sdk-rust.git" ref="main":
#!/usr/bin/env bash
set -euo pipefail
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
git clone --quiet "{{repo}}" "$tmp/sdk"
git -C "$tmp/sdk" checkout --quiet "{{ref}}"
rev=$(git -C "$tmp/sdk" rev-parse HEAD)
rm -rf jackdaw/src/dsl
cp -r "$tmp/sdk/core/src/models" jackdaw/src/dsl
cp "$tmp/sdk/LICENSE" jackdaw/src/dsl/LICENSE
# The SDK's unit tests (in its lib.rs), run as `dsl::unit_tests`: without lib.rs's `mod models;`, and with
# serde-saphyr in place of serde_yaml.
sed -e '/^pub mod models;$/d' -e 's/serde_yaml::/serde_saphyr::/g' "$tmp/sdk/core/src/lib.rs" > jackdaw/src/dsl/unit_tests.rs
printf 'repository: %s\nref: %s\nrevision: %s\npath: core/src/models\ntests: core/src/lib.rs (unit_tests.rs)\n' "{{repo}}" "{{ref}}" "$rev" > jackdaw/src/dsl/UPSTREAM
echo "jackdaw/src/dsl now at $rev"
git status --short jackdaw/src/dsl
# 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 the library BDD feature specs in jackdaw/tests/lib (skips @todo scenarios).
# Extra arguments go to cucumber, e.g. `just test-lib --tags '@crash and not @todo'`
test-lib *ARGS:
cargo test -p jackdaw-wf --test lib_features -- {{ARGS}}
# Run all tests (unit + integration, including the library BDD specs)
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
# C
8000
lean 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 dependency licenses, versions and sources (deny.toml)
deny:
cargo deny check licenses bans sources
# Check the public API against the latest release on crates.io
semver:
cargo semver-checks -p jackdaw-wf --all-features
# 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
# ============================================================================
# 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 -f jackdaw-cli/Dockerfile --load -t jackdaw:latest .
# Build Docker image for multiple platforms (amd64 and arm64)
docker-build-multiplatform:
docker buildx build -f jackdaw-cli/Dockerfile --platform linux/amd64,linux/arm64 -t jackdaw:latest .
# Build and push Docker image for multiple platforms
docker-build-push:
docker buildx build -f jackdaw-cli/Dockerfile --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 \
-f jackdaw-cli/Dockerfile \
--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:/out/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 \
-f jackdaw-cli/Dockerfile \
--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:/out/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
# ============================================================================
# Release Management
# ============================================================================
# Package and verify the published crates without uploading
publish-dry-run:
cargo publish --dry-run --locked -p jackdaw-wf-macros -p jackdaw-wf -p jackdaw-cli
# Publish jackdaw-wf-macros, jackdaw-wf and jackdaw-cli (cargo orders them) to crates.io. Irreversible: run publish-dry-run first
publish-crate:
#!/usr/bin/env bash
set -euo pipefail
echo "Publishing jackdaw-wf-macros, jackdaw-wf and jackdaw-cli to crates.io..."
cargo publish --locked -p jackdaw-wf-macros -p jackdaw-wf -p jackdaw-cli
echo "✓ Published to crates.io"