forked from jf-tech/omniparser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
regen.sh
executable file
·45 lines (34 loc) · 1001 Bytes
/
regen.sh
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
#!/bin/bash
function green_printf () {
printf "\e[32m$@\e[m\n"
}
function red_printf () {
printf "\e[31m$@\e[m\n"
}
function panic () {
echo
red_printf "$@"
echo
exit 1
}
function panic_fail_op () {
panic "Operation failed! Exit."
}
SCRIPT_DIR=$(pwd `dirname "$0"`)
cd $SCRIPT_DIR/validation || panic_fail_op
green_printf "go:generate in 'validation'...\n"
go generate || panic_fail_op
cd $SCRIPT_DIR/extensions/omniv21/validation || panic_fail_op
green_printf "go:generate in 'extensions/omniv21/validation'...\n"
go generate || panic_fail_op
cd $SCRIPT_DIR/
green_printf "Remove all existing test '.snapshots' directories...\n"
find . -type d | grep -e "\.snapshots$" | xargs rm -rf || panic_fail_op
green_printf "Regenerating all snapshots...\n"
go clean -testcache ./... || panic_fail_op
go test ./...
green_printf "\nVerifying snapshots generation...\n"
go clean -testcache ./... || panic_fail_op
go test ./... || panic_fail_op
cd $SCRIPT_DIR/
green_printf "All done!\n"