-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathjustfile
More file actions
115 lines (94 loc) · 3.6 KB
/
justfile
File metadata and controls
115 lines (94 loc) · 3.6 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
# Set OFFLINE=true env variable for offline mode
nix_flags := if env("OFFLINE", "false") == "true" { "--offline" } else { "" }
cargo_flags := if env("OFFLINE", "false") == "true" { "--frozen" } else { "" }
export RUST_BACKTRACE := "1"
export CARGO_INCREMENTAL := "1"
export CARGO_REGISTRIES_CRATES_IO_PROTOCOL := "sparse"
version := `grep '^version =' Cargo.toml | sed 's/version = "\(.*\)"/\1/'`
# Show this help
help:
@just --list --unsorted
# Check code issues with clippy
lint:
nix develop {{nix_flags}} \
--command cargo {{cargo_flags}} clippy --all --all-targets -- -D warnings
# Check code issues with clippy nightly
lint-nightly:
nix develop {{nix_flags}} .#nightly \
--command cargo {{cargo_flags}} clippy --all --all-targets -- -D warnings
# Run tests
test:
# Default test
nix {{nix_flags}} develop --command cargo {{cargo_flags}} nextest run
# Test with array-based table generator
nix {{nix_flags}} develop --command cargo nextest {{cargo_flags}} run --features arrays
# Run tests for the compiler
test-compiler:
nix {{nix_flags}} develop --command cargo {{cargo_flags}} nextest run -p rustemo-compiler
# Run all checks
check: lint install-compiler doc-examples test
# Run all tests for all versions. Run with -L flag to see full output.
check-all flags="":
nix {{nix_flags}} flake check {{flags}}
# Format the code
[no-cd]
format *paths=".":
nix {{nix_flags}} develop --command cargo {{cargo_flags}} fmt --all {{paths}}
# Install the rcomp compiler
install-compiler: test-compiler
nix {{nix_flags}} develop --command cargo {{cargo_flags}} install --path rustemo-compiler --debug
# Setup development environment with STABLE version
stable:
nix {{nix_flags}} develop .#default
# Setup development environment with NIGHTLY version
nightly:
nix {{nix_flags}} develop .#nightly
# Serve docs locally
docs:
python -c "import webbrowser; webbrowser.open('http://localhost:3000/')"
cd docs && nix {{nix_flags}} develop --command mdbook serve
# Compile docs examples
doc-examples: install-compiler
rcomp docs/src/readme_example/src/testlr/calclr.rustemo
rcomp --parser-algo glr docs/src/readme_example/src/testglr/calc.rustemo
for i in $(seq 1 5); do \
rcomp docs/src/tutorials/calculator/calculator$i/src/calculator.rustemo; \
done
# Login to crates.io and cache the API key - needed for release
login:
@echo "Version: {{version}}"
cargo login
# Dry run test releasing rustemo crate to crates.io
[private]
test-release-rustemo:
cargo publish --dry-run -p rustemo
cargo package --list -p rustemo
@echo "Ready to publish rustemo version {{version}}?"
@read -p "Type 'y' to confirm release: " CONFIRM; \
if [ "$CONFIRM" != "y" ]; then \
echo "Release aborted."; \
exit 1; \
fi
# Release rustemo crate to crates.io
release-rustemo: test-release-rustemo
cargo publish -p rustemo
# Dry run test releasing rustemo compiler crate to crates.io
[private]
test-release-compiler:
cargo publish --dry-run -p rustemo-compiler
cargo package --list -p rustemo-compiler
@echo "Ready to publish rustemo compiler version {{version}}?"
@read -p "Type 'y' to confirm release: " CONFIRM; \
if [ "$CONFIRM" != "y" ]; then \
echo "Release aborted."; \
exit 1; \
fi
# Release rustemo compiler crate to crates.io
release-compiler: test-release-compiler
cargo publish -p rustemo-compiler
# Tag a new release and push to GitHub
release-tag-push:
git tag -s {{version}} -m "Release {{version}}"
git push
git push --tags origin {{version}}
@echo "Don't forget to make GitHub release"