-
Notifications
You must be signed in to change notification settings - Fork 8
/
justfile
92 lines (70 loc) · 2.36 KB
/
justfile
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
target := `echo -n "${TARGET:-x86_64-unknown-linux-gnu}"`
build_dir := `echo -n $PWD/target/${TARGET:-x86_64-unknown-linux-gnu}/release`
package_dir := `echo -n $PWD/target/package`
cargo := `echo -n "${CARGO:-cargo}"`
bin_name := 'templar'
release: tag publish
default: build
_readme: setup-cargo
_validate:
#!/usr/bin/env bash
set -Eeou pipefail
echo 'Making sure all changes have been committed...'
if [[ $(git diff --stat) != '' ]]; then
echo 'Working tree dirty, not allowing publish until all changes have been committed.'
#exit 1
fi
echo 'Running "cargo check"'
cargo check --all-features --tests --examples --bins --benches
echo 'Running unit tests'
cargo test --all-features
@setup-cargo:
rustup toolchain install stable
rustup target add '{{ target }}'
# DOGFOODING
cargo install templar --all-features
# Other stuff
cargo install cargo-deb
cargo install cargo-readme
cargo install cargo-strip
cargo install mdbook
build:
cargo build --all-features
changelog:
#!/usr/bin/env bash
set -Eeou pipefail
git log --pretty=format:'%d %s' --no-merges | grep -E '(tag:|#chg)' | sed 's/.*#chg /- /g' | sed 's/ (tag:/\n## Release/g' | sed 's/) .*/\n/g'
run +args="":
cargo run --all-features -- {{args}}
watch +args="":
watchexec -w src just run -- {{args}}
build-release:
#!/usr/bin/env bash
set -Eeou pipefail
echo 'Building for {{ target }}'
{{cargo}} build --all-features --release --target '{{ target }}'
package-tar: build-release
#!/usr/bin/env bash
set -Eeou pipefail
mkdir -p '{{ package_dir }}'
cargo strip --target '{{ target }}' || true
tar -C '{{ build_dir }}' -cvJf '{{ package_dir }}/{{ bin_name }}-{{ target }}.tar.xz' '{{ bin_name }}'
package-deb: build-release
cp -f target/{{ target }}/release/templar target/release/templar
cargo deb --no-build --no-strip -o "{{ package_dir }}/{{ bin_name }}-{{ target }}.deb"
book:
mdbook build docs
serve-book:
mdbook serve docs
package: package-tar package-deb
dry-run: _validate
cargo publish --all-features --dry-run
tag: _validate
#!/usr/bin/env bash
set -Eeou pipefail
git tag "v$(templar -i Cargo.toml -e '.[`package`][`version`]')"
git push --tags
publish: _validate
#!/usr/bin/env bash
set -Eeou pipefail
cargo publish --all-features