Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Justfile #41

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 27 additions & 13 deletions Justfile
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
29 changes: 29 additions & 0 deletions just/check.just
Original file line number Diff line number Diff line change
@@ -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 }}
25 changes: 25 additions & 0 deletions just/doc.just
Original file line number Diff line number Diff line change
@@ -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 }}
22 changes: 22 additions & 0 deletions just/test.just
Original file line number Diff line number Diff line change
@@ -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 }}