-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjustfile
103 lines (84 loc) · 2.8 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
93
94
95
96
97
98
99
100
101
102
103
VERSION := `toml get cli/Cargo.toml package.version | jq -r`
TARGET_DIR := "target/release"
export TAG:=`toml get cli/Cargo.toml "package.version" | jq -r .`
# List available commands
_default:
just --choose --chooser "fzf +s -x --tac --cycle"
# Test / watch
test:
cargo watch -x "test -- --nocapture"
# Test including ignored tests
test_all:
cargo nextest run -- --include-ignored
# Generate usage samples
_usage:
#!/usr/bin/env bash
cargo run -q -- --help > doc/help.adoc
cargo run -q -- get --help > doc/get.adoc
SAVE=$TOKEN
export TOKEN="<your admin token>"
cargo run -q -- apply --help > doc/apply.adoc
cargo run -q --features=wipe -- wipe --help > doc/wipe.adoc
export TOKEN=$SAVE
cargo run -q -- get chevdor/glabel > doc/sample_terminal.txt
cargo run -q -- get chevdor/glabel -o doc/sample_yaml.yaml
tera --template templates/doc.md.tera doc/sample_yaml.yaml > doc/sample_doc.md
# Generate documentation
doc: _usage
cargo doc -p glabel -p glabellib --all-features --no-deps
# Run rustfmt
_fmt:
cargo +nightly fmt --all
# Run clippy
_clippy:
cargo +nightly clippy --all-features --all-targets
_deny:
cargo deny check
# Run checks such as clippy, rustfmt, etc...
check: _clippy _fmt
# Minor bump, can be used once the release is ready
bump:
cargo workspaces version --no-git-commit
# Generate the readme as .md
md:
#!/usr/bin/env bash
asciidoctor -b docbook -a leveloffset=+1 -o - README_src.adoc | pandoc --markdown-headings=atx --wrap=preserve -t markdown_strict -f docbook - > README.md
cp README.md cli/
release: check test_all bump doc md
coverage:
#!/usr/bin/env bash
export RUSTFLAGS="-Zinstrument-coverage"
export LLVM_PROFILE_FILE="chevdor-%p-%m.profraw"
cargo +nightly build
cargo +nightly test
grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing -o ./target/debug/coverage/
open target/debug/coverage/index.html
find . -type f -name '*.profraw' -exec rm '{}' \;
tag:
#!/usr/bin/env bash
echo Tagging version v$TAG
git tag "v$TAG" -f
git tag | sort -Vr | head
tera:
#!/usr/bin/env bash
tera --template templates/doc.md.tera doc/sample_yaml.yaml
build:
cargo build --profile release --locked --features "wipe"
mv ./target/release/glabel ./target/release/glabel-wipe
cargo build --profile release --locked --features ""
sha256:
#!/usr/bin/env bash
cd target/release
for file in $( find . -d 1 -type f -exec test -x {} \; -print ); do
echo Creating sha256 for $file
shasum -a 256 $file > $file.sha256
shasum -c $file.sha256
done
sign:
#!/usr/bin/env bash
for file in $( find ./target/release -d 1 -type f -exec test -x {} \; -print ); do
echo Signing binaries, get your Yubikey ready
gpg --sign --default-key $KEY --armor --output $file.asc --detach-sig $file
gpg --verify $file.asc
done
build_sha256_and_sign: build sha256 sign