forked from microsoft/wassette
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
103 lines (83 loc) · 3.4 KB
/
Justfile
File metadata and controls
103 lines (83 loc) · 3.4 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
# Clean component target directories to avoid permission issues
clean-test-components:
rm -rf examples/fetch-rs/target/
rm -rf examples/filesystem-rs/target/
# Pre-build test components to avoid building during test execution
build-test-components:
just clean-test-components
(cd examples/fetch-rs && cargo build --release --target wasm32-wasip2)
(cd examples/filesystem-rs && cargo build --release --target wasm32-wasip2)
test:
just build-test-components
cargo test --workspace -- --nocapture
cargo test --doc --workspace -- --nocapture
build mode="debug":
mkdir -p bin
cargo build --workspace {{ if mode == "release" { "--release" } else { "" } }}
cp target/{{ mode }}/wassette bin/
build-examples mode="debug":
mkdir -p bin
(cd examples/fetch-rs && just build mode)
(cd examples/filesystem-rs && just build mode)
(cd examples/get-weather-js && just build)
(cd examples/time-server-js && just build)
(cd examples/eval-py && just build)
(cd examples/gomodule-go && just build)
cp examples/fetch-rs/target/wasm32-wasip2/{{ mode }}/fetch_rs.wasm bin/fetch-rs.wasm
cp examples/filesystem-rs/target/wasm32-wasip2/{{ mode }}/filesystem.wasm bin/filesystem.wasm
cp examples/get-weather-js/weather.wasm bin/get-weather-js.wasm
cp examples/time-server-js/time.wasm bin/time-server-js.wasm
cp examples/eval-py/eval.wasm bin/eval-py.wasm
cp examples/gomodule-go/gomodule.wasm bin/gomodule.wasm
clean:
cargo clean
rm -rf bin
component2json path="examples/fetch-rs/target/wasm32-wasip2/release/fetch_rs.wasm":
cargo run --bin component2json -p component2json -- {{ path }}
run RUST_LOG='info':
RUST_LOG={{RUST_LOG}} cargo run --bin wassette serve --sse
run-streamable RUST_LOG='info':
RUST_LOG={{RUST_LOG}} cargo run --bin wassette serve --streamable-http
run-filesystem RUST_LOG='info':
RUST_LOG={{RUST_LOG}} cargo run --bin wassette serve --sse --plugin-dir ./examples/filesystem-rs
# Requires an openweather API key in the environment variable OPENWEATHER_API_KEY
run-get-weather RUST_LOG='info':
RUST_LOG={{RUST_LOG}} cargo run --bin wassette serve --sse --plugin-dir ./examples/get-weather-js
run-fetch-rs RUST_LOG='info':
RUST_LOG={{RUST_LOG}} cargo run --bin wassette serve --sse --plugin-dir ./examples/fetch-rs
# Documentation commands
docs-build:
cd docs && mdbook build
docs-serve:
cd docs && mdbook serve --open
docs-watch:
cd docs && mdbook serve
# CI Docker commands - automatically handle user mapping to prevent permission issues
ci-local:
docker build \
--build-arg USER_ID=$(id -u) \
--build-arg GROUP_ID=$(id -g) \
-f Dockerfile.ci \
--target ci-test \
-t wassette-ci-local .
docker run --rm \
-v $(PWD):/workspace \
-w /workspace \
-e GITHUB_TOKEN \
wassette-ci-local just ci-build-test
ci-build-test:
just build-test-components
cargo build --workspace
cargo test --workspace -- --nocapture
cargo test --doc --workspace -- --nocapture
ci-build-test-ghcr:
just build-test-components
cargo build --workspace
cargo test --workspace -- --nocapture --include-ignored
cargo test --doc --workspace -- --nocapture
ci-cache-info:
docker system df
docker images wassette-ci-*
ci-clean:
docker rmi $(docker images -q wassette-ci-* 2>/dev/null) 2>/dev/null || true
docker builder prune -f