Skip to content

Commit 88cc4ab

Browse files
committed
Split CI verify into explicit build and test steps
1 parent ad6e5d7 commit 88cc4ab

2 files changed

Lines changed: 61 additions & 27 deletions

File tree

.github/workflows/ci.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,14 @@ jobs:
4242
solana-keygen new --outfile "$HOME/.config/solana/id.json" --no-bip39-passphrase --silent
4343
fi
4444
45-
- name: Verify
46-
run: bash scripts/verify.sh
45+
- name: Verify tools
46+
run: bash scripts/verify.sh tools
47+
48+
- name: Anchor build
49+
run: bash scripts/verify.sh build
50+
51+
- name: Anchor test
52+
run: bash scripts/verify.sh test
53+
54+
- name: Non-real-code scan
55+
run: bash scripts/verify.sh scan

scripts/verify.sh

Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,57 @@ ensure_required_tools \
1111
"SOLANA_BIN:solana" \
1212
"CARGO_BIN:cargo"
1313

14-
echo "[verify] cwd: $(pwd)"
14+
verify_tools() {
15+
echo "[verify] cwd: $(pwd)"
16+
echo "[verify] tool versions"
17+
"$NODE_BIN" -v
18+
if [[ -n "${YARN_BIN:-}" ]]; then
19+
"$YARN_BIN" --version
20+
elif command -v npm >/dev/null 2>&1; then
21+
npm -v
22+
else
23+
echo "[verify] warning: yarn/npm not found"
24+
fi
25+
"$ANCHOR_BIN" --version
26+
"$SOLANA_BIN" --version
27+
"$CARGO_BIN" --version
28+
}
1529

16-
echo "[verify] tool versions"
17-
"$NODE_BIN" -v
18-
if [[ -n "${YARN_BIN:-}" ]]; then
19-
"$YARN_BIN" --version
20-
elif command -v npm >/dev/null 2>&1; then
21-
npm -v
22-
else
23-
echo "[verify] warning: yarn/npm not found"
24-
fi
25-
"$ANCHOR_BIN" --version
26-
"$SOLANA_BIN" --version
27-
"$CARGO_BIN" --version
30+
verify_build() {
31+
echo "[verify] anchor build"
32+
"$ANCHOR_BIN" build
33+
}
2834

29-
echo "[verify] anchor build"
30-
"$ANCHOR_BIN" build
35+
verify_test() {
36+
echo "[verify] anchor test"
37+
"$ANCHOR_BIN" test --skip-build
38+
}
3139

32-
echo "[verify] anchor test"
33-
"$ANCHOR_BIN" test --skip-build
34-
35-
echo "[verify] non-real-code scan"
36-
pattern="TO""DO|FI""XME|mo""ck|place""holder|st""ub|fa""ke|not imp""lemented|to""y"
37-
if rg -n -i "$pattern" --glob '!Cargo.lock' --glob '!yarn.lock'; then
38-
echo "[verify] non-real-code scan failed"
39-
exit 1
40-
else
40+
verify_scan() {
41+
echo "[verify] non-real-code scan"
42+
local pattern
43+
pattern="TO""DO|FI""XME|mo""ck|place""holder|st""ub|fa""ke|not imp""lemented|to""y"
44+
if rg -n -i "$pattern" --glob '!Cargo.lock' --glob '!yarn.lock'; then
45+
echo "[verify] non-real-code scan failed"
46+
return 1
47+
fi
4148
echo "[verify] non-real-code scan clean"
42-
fi
49+
}
50+
51+
mode="${1:-all}"
52+
case "$mode" in
53+
tools) verify_tools ;;
54+
build) verify_build ;;
55+
test) verify_test ;;
56+
scan) verify_scan ;;
57+
all)
58+
verify_tools
59+
verify_build
60+
verify_test
61+
verify_scan
62+
;;
63+
*)
64+
echo "Usage: $0 [all|tools|build|test|scan]" >&2
65+
exit 2
66+
;;
67+
esac

0 commit comments

Comments
 (0)