]>
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 |
20effc67 | 10 | . $CEPH_ROOT/${BUILD_DIR}/src/pybind/mgr/dashboard/frontend/node-env/bin/activate |
11fdf7f2 TL |
11 | fi |
12 | ||
13 | # Build | |
14 | npm run build -- --prod --progress=false || failed=true | |
15 | ||
16 | # Unit Tests | |
11fdf7f2 TL |
17 | npm run test:ci || failed=true |
18 | ||
11fdf7f2 TL |
19 | # Linting |
20 | npm run lint --silent | |
21 | if [ $? -gt 0 ]; then | |
22 | failed=true | |
23 | echo -e "\nTry running 'npm run fix' to fix some linting errors. \ | |
24 | Some errors might need a manual fix." | |
25 | fi | |
26 | ||
27 | # I18N | |
eafe8130 | 28 | npm run i18n:extract |
e306af50 | 29 | if [ $? -gt 0 ]; then |
11fdf7f2 | 30 | failed=true |
e306af50 TL |
31 | echo -e "\nTranslations extraction has failed." |
32 | else | |
33 | i18n_lint=`awk '/<source> |<source>$| <\/source>/,/<\/context-group>/ {printf "%-4s ", NR; print}' src/locale/messages.xlf` | |
20effc67 TL |
34 | |
35 | # Excluding the node_modules/ folder errors from the lint error | |
36 | if [[ -n "$i18n_lint" && $i18n_lint != *"node_modules/"* ]]; then | |
e306af50 | 37 | echo -e "\nThe following source translations in 'messages.xlf' need to be \ |
f67539c2 | 38 | fixed, please check the I18N suggestions on https://docs.ceph.com/en/latest/dev/developer_guide/dash-devel/#i18n:\n" |
e306af50 TL |
39 | echo "${i18n_lint}" |
40 | failed=true | |
41 | fi | |
11fdf7f2 TL |
42 | fi |
43 | ||
44 | if [ `uname` != "FreeBSD" ]; then | |
45 | deactivate | |
46 | fi | |
47 | ||
48 | if [ "$failed" = "true" ]; then | |
49 | exit 1 | |
50 | fi |