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
default: all
fmt:
cargo fmt --all
check:
cargo check --workspace
clippy:
cargo clippy --workspace -- -D warnings
test:
cargo test --workspace -q
coverage:
#!/usr/bin/env bash
set -euo pipefail
export RUSTFLAGS="-Cinstrument-coverage"
export CARGO_TARGET_DIR="target/coverage"
export LLVM_PROFILE_FILE="target/coverage/profraw/%p-%m.profraw"
rm -rf target/coverage
cargo test --workspace -q
REPORT=$(grcov target/coverage/profraw \
--binary-path ./target/coverage/debug/ \
-s . \
-t covdir \
--ignore-not-existing \
--keep-only 'quire-server/src/**' \
--ignore 'quire-server/src/bin/**' \
--excl-line 'cov-excl-line|unreachable!|tracing::' \
--excl-start 'cov-excl-start' \
--excl-stop 'cov-excl-stop')
echo "$REPORT" | jq -r '
def files:
to_entries[] | .value |
if .children then .children | files
else "\(.name): \(.coveragePercent)% (\(.linesCovered)/\(.linesTotal))"
end;
.children | files
'
COVERAGE=$(echo "$REPORT" | jq '.coveragePercent')
echo ""
echo "Total: ${COVERAGE}%"
if [ "$(echo "$COVERAGE < 100" | bc -l)" -eq 1 ]; then
echo "ERROR: Coverage is below 100%"
exit 1
fi
coverage-html:
#!/usr/bin/env bash
set -euo pipefail
export RUSTFLAGS="-Cinstrument-coverage"
export CARGO_TARGET_DIR="target/coverage"
export LLVM_PROFILE_FILE="target/coverage/profraw/%p-%m.profraw"
rm -rf target/coverage
cargo test --workspace -q
rm -rf target/coverage/html
grcov target/coverage/profraw \
--binary-path ./target/coverage/debug/ \
-s . \
-t html \
--ignore-not-existing \
--keep-only 'quire-server/src/**' \
--ignore 'quire-server/src/bin/**' \
--excl-line 'cov-excl-line|unreachable!|tracing::' \
--excl-start 'cov-excl-start' \
--excl-stop 'cov-excl-stop' \
-o target/coverage/html
echo "HTML report at target/coverage/html/index.html"
mutants:
#!/usr/bin/env bash
set -uo pipefail
cargo mutants --timeout-multiplier 3 -j4
rc=$?
if [ "$rc" -eq 0 ] || [ "$rc" -eq 3 ]; then
exit 0
fi
exit "$rc"
dev:
fd -e rs -e html -e css -e toml --exclude target | entr -rc cargo run -p quire-server --features dev -- serve --dev
all: fmt clippy test
install:
cargo install --locked --path quire-server
# Manual release: tag a revision (default: closest_pushable()) as
# v<UTC-date>-<short-sha> and push to github. Use this when the normal CI path
# is not working. Triggers the release workflow.
# manual-release rev="@-":
# #!/usr/bin/env bash
# set -euo pipefail
# sha=$(jj log -r "{{rev}}" --no-graph -T commit_id --limit 1)
# short=${sha:0:8}
# date=$(TZ=UTC git show -s --format=%cd --date=format-local:%Y-%m-%d "$sha")
# tag="v${date}-${short}"
# jj tag set "$tag" -r "{{rev}}"
# git push github "$tag"
# echo "Tagged and pushed $sha as $tag"