-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·39 lines (35 loc) · 1.27 KB
/
test.sh
File metadata and controls
executable file
·39 lines (35 loc) · 1.27 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
output="expected/deadcode.txt"
if [ "$RUNNER_OS" == "Windows" ]; then
exclude_dirs="src\exception"
suppress="src\ToSuppress.res"
else
exclude_dirs="src/exception"
suppress="src/ToSuppress.res"
fi
dune exec -- rescript-tools reanalyze --dce --config --debug --ci --exclude-paths $exclude_dirs --live-names globallyLive1,globallyLive2,globallyLive3 --suppress $suppress > $output
# CI. We use LF, and the CI OCaml fork prints CRLF. Convert.
if [ "$RUNNER_OS" == "Windows" ]; then
perl -pi -e 's/\r\n/\n/g' -- $output
fi
output="expected/exception.txt"
if [ "$RUNNER_OS" == "Windows" ]; then
unsuppress_dirs="src\exception"
else
unsuppress_dirs="src/exception"
fi
dune exec -- rescript-tools reanalyze --exception --ci --suppress src --unsuppress $unsuppress_dirs > $output
# CI. We use LF, and the CI OCaml fork prints CRLF. Convert.
if [ "$RUNNER_OS" == "Windows" ]; then
perl -pi -e 's/\r\n/\n/g' -- $output
fi
warningYellow='\033[0;33m'
successGreen='\033[0;32m'
reset='\033[0m'
diff=$(git ls-files --modified expected)
if [[ $diff = "" ]]; then
printf "${successGreen}✅ No unstaged tests difference.${reset}\n"
else
printf "${warningYellow}⚠️ There are unstaged differences in tests/! Did you break a test?\n${diff}\n${reset}"
git --no-pager diff expected
exit 1
fi