]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | #!/usr/bin/env bash |
2 | ||
3 | failed=false | |
9f95a23c TL |
4 | SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" |
5 | : ${CEPH_ROOT:=$SCRIPTPATH/../../../../} | |
6 | ||
11fdf7f2 | 7 | cd $CEPH_ROOT/src/pybind/mgr/dashboard/frontend |
9f95a23c | 8 | [ -z "$BUILD_DIR" ] && BUILD_DIR=build |
11fdf7f2 | 9 | if [ `uname` != "FreeBSD" ]; then |
9f95a23c | 10 | . $CEPH_ROOT/${BUILD_DIR}/src/pybind/mgr/dashboard/node-env/bin/activate |
11fdf7f2 TL |
11 | fi |
12 | ||
13 | # Build | |
14 | npm run build -- --prod --progress=false || failed=true | |
15 | ||
16 | # Unit Tests | |
17 | config='src/unit-test-configuration.ts' | |
18 | if [ -e $config ]; then | |
19 | mv $config ${config}_old | |
20 | fi | |
21 | cp ${config}.sample $config | |
22 | ||
23 | npm run test:ci || failed=true | |
24 | ||
25 | rm $config | |
26 | if [ -e ${config}_old ]; then | |
27 | mv ${config}_old $config | |
28 | fi | |
29 | ||
30 | # Linting | |
31 | npm run lint --silent | |
32 | if [ $? -gt 0 ]; then | |
33 | failed=true | |
34 | echo -e "\nTry running 'npm run fix' to fix some linting errors. \ | |
35 | Some errors might need a manual fix." | |
36 | fi | |
37 | ||
38 | # I18N | |
eafe8130 TL |
39 | npm run i18n:extract |
40 | i18n_lint=`awk '/<source> |<source>$| <\/source>/,/<\/context-group>/ {printf "%-4s ", NR; print}' src/locale/messages.xlf` | |
11fdf7f2 TL |
41 | if [[ ! -z $i18n_lint ]]; then |
42 | echo -e "The following source translations in 'messages.xlf' need to be \ | |
43 | fixed, please check the I18N suggestions in 'HACKING.rst':\n" | |
44 | echo "${i18n_lint}" | |
45 | failed=true | |
46 | fi | |
47 | ||
48 | if [ `uname` != "FreeBSD" ]; then | |
49 | deactivate | |
50 | fi | |
51 | ||
52 | if [ "$failed" = "true" ]; then | |
53 | exit 1 | |
54 | fi |