forked from auths-dev/auths
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
138 lines (117 loc) · 5.2 KB
/
Copy pathjustfile
File metadata and controls
138 lines (117 loc) · 5.2 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# Auths project recipes
# Run all tests (nextest + doc tests).
test:
cargo nextest run --workspace --all-features
cargo test --workspace --doc
# Run only integration tests (tests/ directories across all crates).
intest:
cargo nextest run --workspace -E 'kind(test)'
# Run all build targets in parallel and report pass/fail cleanly.
# Optional targets (wasm-pack, cross/aarch64) are skipped if the tool is not installed.
# Install optional tools:
# cargo install wasm-pack --version "=0.12.1" --locked
# cargo install cross --locked (also needs Docker running)
build:
#!/usr/bin/env bash
set -uo pipefail
GREEN='\033[0;32m'
RED='\033[0;31m'
BOLD='\033[1m'
DIM='\033[2m'
NC='\033[0m'
TMP=$(mktemp -d)
trap 'rm -rf "$TMP"' EXIT
pids=()
names=()
logs=()
_run() {
local label="$1"; shift
local log="$TMP/${#pids[@]}.log"
names+=("$label")
logs+=("$log")
"$@" >"$log" 2>&1 &
pids+=($!)
}
# --- Always-run builds ---
_run "native (auths-cli)" cargo build --release --package auths-cli
# Run from inside the crate to avoid workspace resolver v3 feature-scoping
# issues. From the workspace root, `--features wasm` (with or without the
# pkg/feature qualifier) triggers "cannot specify features for packages
# outside of workspace" under resolver = "3". cd-ing in sidesteps this.
_run "wasm32 check" bash -c 'rustup target add wasm32-unknown-unknown 2>/dev/null; cd crates/auths-verifier && cargo check --target wasm32-unknown-unknown --features wasm'
_run "python bindings" cargo check --manifest-path packages/auths-verifier-python/Cargo.toml
# --- Optional: wasm-pack (full wasm-pack pipeline, not just cargo check) ---
if command -v wasm-pack >/dev/null 2>&1; then
_run "wasm-pack build" bash -c 'cd crates/auths-verifier && wasm-pack build --target bundler --features wasm'
fi
# --- Optional: execute the compiled WASM verdict path under Node ---
# `cargo check` proves it links; this proves the verdict is computed correctly
# on the wasm32 target. Needs `wasm-bindgen-test-runner` (matching the locked
# wasm-bindgen version) and Node >= 20 (for the Web Crypto Ed25519 leg).
if command -v wasm-bindgen-test-runner >/dev/null 2>&1 && command -v node >/dev/null 2>&1; then
_run "wasm32 verdict tests (node)" bash -c 'cd crates/auths-verifier && CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER=wasm-bindgen-test-runner cargo test --target wasm32-unknown-unknown --no-default-features --features wasm --test wasm_bindings'
fi
# --- Optional: aarch64 cross build (requires cross + Docker) ---
if command -v cross >/dev/null 2>&1 && docker info >/dev/null 2>&1; then
_run "aarch64 cross build" cross build --release --package auths-cli --target aarch64-unknown-linux-gnu
fi
echo ""
echo -e "${BOLD}Running ${#pids[@]} builds in parallel...${NC}"
echo ""
failed=0
for i in "${!pids[@]}"; do
wait "${pids[$i]}"
rc=$?
label="${names[$i]}"
log="${logs[$i]}"
if [ "$rc" -eq 0 ]; then
printf " ${GREEN}✓${NC} %-32s built\n" "$label"
else
printf " ${RED}✗${NC} %-32s failed\n" "$label"
# Show error lines and their file locations; skip Compiling/Checking noise
errors=$(grep -E "^error" "$log" 2>/dev/null | head -8 || true)
locs=$(grep -E "^ +--> " "$log" 2>/dev/null | head -4 || true)
if [ -n "$errors" ]; then
echo "$errors" | sed 's/^/ /'
[ -n "$locs" ] && echo "$locs" | sed 's/^/ /'
else
# Fallback: last few non-blank lines if no ^error lines found
tail -6 "$log" | grep -v '^\s*$' | sed 's/^/ /'
fi
failed=1
fi
done
echo ""
if [ "$failed" -eq 0 ]; then
echo -e "${GREEN}${BOLD}All builds passed${NC}"
else
echo -e "${RED}${BOLD}One or more builds failed — see above${NC}"
exit 1
fi
# Run the Radicle multi-device e2e demo (requires rad CLI).
# Install auths-cli from local source into ~/.cargo/bin
install:
cargo install --path crates/auths-cli
# Sync npm/PyPI/mobile-ffi package versions to the workspace version.
release-versions:
python scripts/releases/0_versions.py --write
# One-shot release: bump every version, refresh locks, commit, auths-sign,
# tag, and push commit + tag together. Local pre-push gates are skipped —
# CI on the release commit and tag is the authority (issue #260).
release version:
python scripts/releases/0_versions.py --set {{version}}
cd packages/auths-fastapi && uv lock
cd packages/auths-python && uv lock
cargo update --workspace
cargo run -p xtask -- gen-error-docs
git add -A
git commit -m "release: {{version}}"
auths sign HEAD
git tag v{{version}}
git push --no-verify origin main v{{version}}
# Create and push a GitHub release (tag + binaries).
release-github:
python scripts/releases/1_github.py --push
# Publish all workspace crates to crates.io in dependency order.
release-crates:
python scripts/releases/2_crates.py --publish