Skip to content
This repository was archived by the owner on Jan 26, 2025. It is now read-only.

Commit 4da609c

Browse files
committed
just: Refactor Justfiles
1 parent e8da396 commit 4da609c

File tree

4 files changed

+31
-100
lines changed

4 files changed

+31
-100
lines changed

Justfile

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,47 @@ book-src := justfile_directory() / 'docs' / 'book'
22

33
# the cargo variable is used to run `cargo` in the nix dev shell, but
44
# `cargo +1.80` outside of it
5-
CARGO_1_80 := env('CARGO_1_80', 'cargo +1.80')
5+
CARGO-1-80 := env('CARGO_1_80', 'cargo +1.80')
6+
CI-SET-ENV := 'export RUSTFLAGS="-Dwarnings" RUSTDOCFLAGS="-Dwarnings"'
67

78
[private]
89
default:
910
@just --unsorted --list --list-submodules
1011

11-
# documentation
12-
mod doc 'just/doc.just'
13-
14-
# testing
15-
mod test 'just/test.just'
16-
17-
# checks and lints
18-
mod check 'just/check.just'
19-
2012
# compile and run typst-test
2113
run *args='--release':
2214
cargo run {{ args }}
2315

16+
# run lints project wide
17+
check:
18+
# FIXME(tinger): mdbook-linkcheck is disabled, because some links are
19+
# deliberately pointing to the generated html files, see:
20+
# https://github.com/rust-lang/mdBook/issues/984
21+
# mdbook-linkcheck --standalone {{ book-src }}
22+
mdbook test {{ book-src }}
23+
cargo fmt --all --check
24+
cargo clippy --workspace --all-targets --all-features
25+
26+
# run tests project wide
27+
test:
28+
# FIXME(tinger): see
29+
# https://github.com/nextest-rs/nextest/issues/16
30+
cargo test --workspace --doc
31+
cargo nextest run --workspace
32+
33+
# build and serve the book locally
34+
book *args='--open':
35+
mdbook serve {{ book-src }} {{ args }}
36+
2437
# run tests and checks similar to CI
25-
ci $RUSTFLAGS='-Dwarnings' $RUSTDOCFLAGS='-Dwarnings':
26-
# FIXME(tinger): See https://github.com/rust-lang/rust/issues/128538 if you get
27-
# high CPU doc tests
28-
{{ CARGO_1_80 }} test --workspace
29-
{{ CARGO_1_80 }} clippy --workspace
30-
{{ CARGO_1_80 }} fmt --all --check
31-
{{ CARGO_1_80 }} doc --workspace --no-deps
38+
ci:
39+
{{ CI-SET-ENV }} && {{ CARGO-1-80 }} test --workspace
40+
{{ CI-SET-ENV }} && {{ CARGO-1-80 }} clippy --workspace
41+
{{ CI-SET-ENV }} && {{ CARGO-1-80 }} fmt --all --check
42+
{{ CI-SET-ENV }} && {{ CARGO-1-80 }} doc --workspace --no-deps
43+
@echo ""
44+
@echo These checks are not exactly the same as CI, but should get you there most of the way.
45+
@echo ""
3246

3347
# clean all temporary directories and build artifacts
3448
clean:

just/check.just

Lines changed: 0 additions & 29 deletions
This file was deleted.

just/doc.just

Lines changed: 0 additions & 25 deletions
This file was deleted.

just/test.just

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)