-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjustfile
More file actions
152 lines (109 loc) · 4.87 KB
/
Copy pathjustfile
File metadata and controls
152 lines (109 loc) · 4.87 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
# buquet - distributed task queue and workflow orchestration on S3
export UV_CACHE_DIR := justfile_directory() / ".uv-cache"
# Default: show available commands
default:
@just --list
# ============================================================================
# Combined commands
# ============================================================================
fmt: fmt-rs fmt-py
lint: lint-rs lint-py
check: check-rs check-py
test: test-rs test-py
typecheck: check-py
all: fmt lint check typecheck test
# ============================================================================
# Rust
# ============================================================================
fmt-rs:
cargo fmt
lint-rs:
uv run --project {{justfile_directory()}} cargo clippy --all-features --all-targets
check-rs:
uv run --project {{justfile_directory()}} cargo check --all-features
test-rs:
cargo test
build:
cargo build
release:
cargo build --release
load-test:
cargo test --test load --release --features load-tests -- --nocapture
chaos-test:
cargo test --test chaos --release --features chaos-tests -- --nocapture
clean:
cargo clean
run *ARGS:
cargo run -- {{ARGS}}
dev *ARGS:
@export $(grep -v '^#' {{justfile_directory()}}/examples/.env.example | xargs) && cargo run -- {{ARGS}}
serve PORT="8080":
@export $(grep -v '^#' {{justfile_directory()}}/examples/.env.example | xargs) && cargo run -- serve --port {{PORT}}
# ============================================================================
# Python
# ============================================================================
py-setup:
uv sync --project {{justfile_directory()}} --group dev
py-dev: py-setup
uv run --project {{justfile_directory()}} maturin develop
py-build: py-setup
uv run --project {{justfile_directory()}} maturin build --release
fmt-py:
uv run --project {{justfile_directory()}} ruff format python/ examples/
uv run --project {{justfile_directory()}} ruff check --fix --select I python/ examples/
lint-py:
uv run --project {{justfile_directory()}} ruff check python/ examples/
check-py: py-setup
uv run --project {{justfile_directory()}} pyright python/
test-py: py-setup py-dev
uv run --project {{justfile_directory()}} pytest python/tests/ -m "not integration"
test-py-integration: py-setup py-dev
uv run --project {{justfile_directory()}} pytest python/tests/ -m integration
py-verify:
uv run --project {{justfile_directory()}} python -c "from buquet import connect, Queue, Task, TaskStatus, Worker; from buquet.workflow import WorkflowEngine, WorkflowClient, StepDef; print('All imports OK')"
# ============================================================================
# Integration tests
# ============================================================================
integration: integration-rs integration-py
integration-rs: up
if command -v awslocal >/dev/null 2>&1; then ./scripts/init-localstack.sh; else docker compose exec localstack awslocal s3 mb s3://buquet-dev || true; docker compose exec localstack awslocal s3api put-bucket-versioning --bucket buquet-dev --versioning-configuration Status=Enabled; fi
S3_ENDPOINT=http://localhost:4566 S3_BUCKET=buquet-dev S3_REGION=us-east-1 \
AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test \
cargo test --tests --features integration
integration-py: up
if command -v awslocal >/dev/null 2>&1; then ./scripts/init-localstack.sh; else docker compose exec localstack awslocal s3 mb s3://buquet-dev || true; docker compose exec localstack awslocal s3api put-bucket-versioning --bucket buquet-dev --versioning-configuration Status=Enabled; fi
S3_ENDPOINT=http://localhost:4566 S3_BUCKET=buquet-dev S3_REGION=us-east-1 \
AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test \
just test-py-integration
# ============================================================================
# Docker
# ============================================================================
docker-build:
docker build -t buquet:latest .
docker-run-worker:
docker run --rm -it \
-e S3_ENDPOINT -e S3_BUCKET -e S3_REGION \
-e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY \
buquet:latest worker
docker-run-serve:
docker run --rm -it -p 8080:8080 \
-e S3_ENDPOINT -e S3_BUCKET -e S3_REGION \
-e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY \
buquet:latest serve --port 8080
# ============================================================================
# Docker Compose
# ============================================================================
up:
docker compose up -d
down:
docker compose down
logs:
docker compose logs -f
clean-docker:
docker compose down -v
up-full:
docker compose -f compose.full.yml up -d --build
down-full:
docker compose -f compose.full.yml down
logs-full *ARGS:
docker compose -f compose.full.yml logs -f {{ARGS}}