diff --git a/Justfile b/Justfile index 563cfe3..f3df8f4 100644 --- a/Justfile +++ b/Justfile @@ -1,18 +1,32 @@ +book-src := justfile_directory() / 'docs' / 'book' + [private] default: - @just --list - -# run a full test harness -test *args: - cargo nextest run {{ args }} - # TODO: re-enable this once we know why this make my CPU skyrocket to 100% - # usage - # cargo test --doc - -# compile the documentation -docs: - cargo doc - typst compile docs/test-set-dsl.typ docs/test-set-dsl.pdf + @just --unsorted --list --list-submodules + +# documentation +mod doc 'just/doc.just' + +# testing +mod test 'just/test.just' + +# checks and lints +mod check 'just/check.just' + +# compile and run typst-test +run *args='--release': + cargo run {{ args }} + +# run tests and checks similar to CI +ci $RUSTFLAGS='-Dwarnings' $RUSTDOCFLAGS='-Dwarnings': + just check clippy + just check format + cargo doc --workspace --no-deps + +# clean all temporary directories and build artifacts +clean: + rm -r target + rm -r {{ book-src / 'book' }} # install typst-test using cargo install: diff --git a/just/check.just b/just/check.just new file mode 100644 index 0000000..cd13d84 --- /dev/null +++ b/just/check.just @@ -0,0 +1,29 @@ +book-src := justfile_directory() / 'docs' / 'book' + +# run all (doesn't include typos) +all: clippy format book + +# check the whole project for typos +typos *args: + typos {{ args }} + +# run various book checks and linters +book: book-test book-linkcheck + +# check book code examples +book-test: + mdbook test {{ book-src }} + +# check book links (disabled) +book-linkcheck: + # TODO: this is currently disabled as the book is in progress and contains dead + # links + # mdbook-linkcheck --standalone {{ book-src }} + +# run clippy lints +clippy *args='--all-targets --all-features': + cargo clippy --workspace {{ args }} + +# check rust formatting +format *args: + cargo fmt --all --check {{ args }} diff --git a/just/doc.just b/just/doc.just new file mode 100644 index 0000000..2077f56 --- /dev/null +++ b/just/doc.just @@ -0,0 +1,25 @@ +book-src := justfile_directory() / 'docs' / 'book' + +# build all documentation +all: build + +# build all documentation +build: book-build rust-build + +# build and open the book +book *args: (book-serve '--open' args) + +# build the book +book-build *args: + mdbook build {{ book-src }} {{ args }} + +# serve the book +book-serve *args='--open': + mdbook serve {{ book-src }} {{ args }} + +# compile and open the rust documentation +rust *args: (rust-build '--open' args) + +# compile the rust documentation +rust-build *args: + cargo doc --workspace {{ args }} diff --git a/just/test.just b/just/test.just new file mode 100644 index 0000000..d2ce9d3 --- /dev/null +++ b/just/test.just @@ -0,0 +1,22 @@ +book-src := justfile_directory() / 'docs' / 'book' + +# run a full test harness (doc tests disabled) +all: && book doc + cargo nextest run --workspace + +# run the lib tests +lib *args: + cargo nextest run --package typst-test-lib {{ args }} + +# run the cli tests +cli *args: + cargo nextest run --package typst-test {{ args }} + +# run the doc tests +doc *args: + # TODO: this currently deadlocks my pc at 100% CPU + # cargo test --workspace --doc {{ args }} + +# test the book +book *args: + mdbook test {{ book-src }} {{ args }}