-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·54 lines (46 loc) · 1.44 KB
/
run.sh
File metadata and controls
executable file
·54 lines (46 loc) · 1.44 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
#!/bin/bash
configs=(
"pre-commit-config.yaml"
"pre-commit-config-version.yaml"
"pre-commit-config-verbose.yaml"
"pre-commit-config-style.yaml"
)
for config in "${configs[@]}"; do
echo "===================================="
echo "Test $config"
echo "===================================="
pre-commit clean
pre-commit run -c testing/$config --files testing/main.c | tee -a result.txt || true
git restore testing/main.c
done
echo "=================================================================================="
echo "Print result.txt"
cat result.txt
echo "=================================================================================="
failed_cases=$(grep -c "Failed" result.txt)
echo "$failed_cases cases failed."
if [[ $failed_cases -eq 21 ]]; then
echo "=============================="
echo "Test cpp-linter-hooks success."
echo "=============================="
result="success"
rm result.txt
exit_code=0
else
echo "============================="
echo "Test cpp-linter-hooks failed."
echo "============================="
result="failure"
exit_code=1
fi
# Add result to GitHub summary if running in GitHub Actions
if [[ -n "$GITHUB_STEP_SUMMARY" ]]; then
{
echo "### cpp-linter-hooks Test Result"
echo ""
echo "**Result:** $result"
echo ""
echo "**Failed cases:** $failed_cases"
} >> "$GITHUB_STEP_SUMMARY"
fi
exit $exit_code