Repository navigation
Expand file tree
/
Copy pathjustfile
More file actions
103 lines (86 loc) · 3.47 KB
/
Copy pathjustfile
File metadata and controls
103 lines (86 loc) · 3.47 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
# justfile — CANONICAL source of project build/dev/deploy tasks for dada2-rs.
#
# This file is authoritative. The Makefile is a hand-maintained portable mirror
# (deployment hosts are guaranteed to have `make`, not `just`). When you change
# a task here, mirror it in the Makefile — `just check-build-sync` (run in CI /
# the pre-commit hook) fails if the two drift apart at the recipe/target level.
#
# just build release binary
# just build-native native-CPU build (non-portable, fastest)
# PREFIX=/opt/dada2 just install binary + helper scripts onto PATH
# just check fmt-check + clippy + tests
# just test --test cli_contract one test area (args pass to cargo test)
# FEATURES=wfa just build-native Cargo features, comma-separated (build, clippy, test)
#
# Note the env-var form for overrides (PREFIX=... DESTDIR=... FEATURES=...): it works
# identically for both `just` and `make`, unlike make's `make install PREFIX=...`
# trailing-arg form which `just` does not accept.
#
# Helper R/Python scripts install namespaced as `dada2-rs-<name>` (e.g.
# scripts/plot_errors.R -> dada2-rs-plot-errors) to avoid PATH collisions.
bin := "dada2-rs"
prefix := env_var_or_default("PREFIX", "/usr/local")
destdir := env_var_or_default("DESTDIR", "")
features := env_var_or_default("FEATURES", "")
feat := if features != "" { "--features " + features } else { "" }
# list recipes (default)
default:
@just --list
# release binary
build:
cargo build --release {{feat}}
# native-CPU build (cluster/in-house; non-portable binary)
build-native:
RUSTFLAGS="-C target-cpu=native" cargo build --profile release-native {{feat}}
# cross-compile Linux ARM64 (requires `cross`)
build-arm64:
cross build --release --target aarch64-unknown-linux-gnu {{feat}}
# copy binary + helper scripts onto PATH (scripts made executable)
install: build
#!/usr/bin/env bash
set -euo pipefail
bindir="{{destdir}}{{prefix}}/bin"
install -d "$bindir"
install -m 755 target/release/{{bin}} "$bindir/{{bin}}"
for s in scripts/*.R scripts/*.py; do
name=$(basename "$s" | sed -E 's/\.(R|py)$//; s/_/-/g')
echo "install -m 755 $s $bindir/{{bin}}-$name"
install -m 755 "$s" "$bindir/{{bin}}-$name"
done
# remove installed binary + helper scripts
uninstall:
#!/usr/bin/env bash
set -euo pipefail
bindir="{{destdir}}{{prefix}}/bin"
rm -f "$bindir/{{bin}}"
for s in scripts/*.R scripts/*.py; do
name=$(basename "$s" | sed -E 's/\.(R|py)$//; s/_/-/g')
echo "rm -f $bindir/{{bin}}-$name"
rm -f "$bindir/{{bin}}-$name"
done
# fmt-check + clippy (warnings as errors) + tests
check: fmt-check clippy test
fmt:
cargo fmt
fmt-check:
cargo fmt --check
clippy:
cargo clippy --all-targets {{feat}} -- -D warnings
# tests on the test-opt profile; extra args pass through (just test --test cli_contract)
test *args:
cargo test --profile test-opt {{feat}} {{args}}
# live-reload mkdocs site
docs-serve:
mkdocs serve
# build static mkdocs site
docs-build:
mkdocs build
clean:
cargo clean
# publish an NW-only crate to crates.io (strips the WFA git dep; see issue #63).
# Pass --dry-run to verify without uploading: `just publish-crate --dry-run`.
publish-crate *ARGS:
./dev/maintenance/publish-crate.sh {{ARGS}}
# fail if justfile recipes and Makefile targets have drifted apart
check-build-sync:
./dev/maintenance/check-build-sync.sh