-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJustfile
98 lines (77 loc) · 2.42 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
coverage OPEN='':
#!/usr/bin/env fish
set -x RUSTFLAGS '-C instrument-coverage'
set -x LLVM_PROFILE_FILE (pwd)'/scratch/'(whoami)'-%p-%m.profraw'
rm (pwd)/scratch/*.profraw
cargo test --tests
grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing -o ./target/debug/coverage/ --excl-start '^//\s*\{grcov-excl-start\}' --excl-stop '^//\s*\{grcov-excl-end\}'
cp ./target/debug/coverage/coverage.json ./coverage.json
if test '{{OPEN}}' = '--open'
open target/debug/coverage/index.html
end
doc:
cargo doc --open
release OPERATION='incrPatch':
#!/usr/bin/env fish
function info
set_color green; echo "👉 "$argv; set_color normal
end
function warning
set_color yellow; echo "🐓 "$argv; set_color normal
end
function error
set_color red; echo "💥 "$argv; set_color normal
end
if test ! -e "Cargo.toml"
error "Cargo.toml file not found"
exit 1
end
info "Checking for uncommitted changes"
if not git diff-index --quiet HEAD -- > /dev/null 2> /dev/null
error "There are uncomitted changes - commit or stash them and try again"
exit 1
end
set branch (string trim (git rev-parse --abbrev-ref HEAD 2> /dev/null))
set name (basename (pwd))
info "Starting release of '"$name"' on branch '"$branch"'"
info "Checking out '"$branch"'"
git checkout $branch
info "Pulling latest"
git pull
mkdir scratch 2> /dev/null
if not stampver {{OPERATION}} -u -i version.json5
error "Unable to generation version information"
exit 1
end
set tagName (cat "scratch/version.tag.txt")
set tagDescription (cat "scratch/version.desc.txt")
git rev-parse $tagName > /dev/null 2> /dev/null
if test $status -ne 0; set isNewTag 1; end
if set -q isNewTag
info "'"$tagName"' is a new tag"
else
warning "Tag '"$tagName"' already exists and will not be moved"
end
if test -e 'justfile' -o -e 'Justfile'
just coverage
else
cargo test
end
if test $status -ne 0
# Rollback
git checkout $branch .
error "Tests failed '"$name"' on branch '"$branch"'"
exit 1
end
info "Staging version changes"
git add :/
info "Committing version changes"
git commit -m $tagDescription
if set -q isNewTag
info "Tagging"
git tag -a $tagName -m $tagDescription
end
info "Pushing to 'origin'"
git push --follow-tags
info "Finished release of '"$name"\' on branch '"$branch"'. You can publish the crate."
exit 0