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