-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathJustfile
More file actions
70 lines (57 loc) · 1.77 KB
/
Copy pathJustfile
File metadata and controls
70 lines (57 loc) · 1.77 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
# Extension file name varies by OS
ext_name := if os() == "macos" { "libext_typst.dylib" } else { "libext_typst.so" }
ext_debug := "target/debug/" + ext_name
ext_release := "target/release/" + ext_name
# Build the extension (debug mode)
build:
cargo build
# Build the extension (release mode, with LTO)
release:
cargo build --release
# Build the extension in an Alpine Linux musl container
release-musl php_version="8.4":
#!/usr/bin/env sh
docker run --rm -v "$PWD:/app" -w /app php:{{php_version}}-cli-alpine sh -lc '
apk add --no-cache bash build-base clang16-libclang curl git linux-headers openssl &&
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal &&
. "$HOME/.cargo/env" &&
export LIBCLANG_PATH=/usr/lib/llvm16/lib &&
export BINDGEN_EXTRA_CLANG_ARGS=-I/usr/lib/llvm16/lib/clang/16/include &&
cargo build --release
'
# Run all tests
test: build
php -d extension={{ext_debug}} vendor/bin/phpunit
# Run a specific test file
test-file file: build
php -d extension={{ext_debug}} vendor/bin/phpunit {{file}}
# Run clippy lints
lint:
cargo clippy -- -D warnings
vendor/bin/mago lint
# Type-check without building
check:
cargo check
vendor/bin/mago analyze
# Format Rust code
fmt:
cargo fmt
vendor/bin/mago fmt
# Check Rust formatting
fmt-check:
cargo fmt -- --check
vendor/bin/mago fmt --check
# Fix issues, and run formatter
fix:
vendor/bin/mago lint --fix --unsafe
vendor/bin/mago analyze --fix --unsafe
vendor/bin/mago fmt
cargo fmt
# Run an example by name (e.g. just run-example hello)
run-example name: release
php -d extension={{ext_release}} examples/{{name}}.php
# Run all checks
verify: fmt-check lint check
# Remove build artifacts
clean:
cargo clean