]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/run-frontend-unittests.sh
import ceph nautilus 14.2.2
[ceph.git] / ceph / src / pybind / mgr / dashboard / run-frontend-unittests.sh
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
36 npm run i18n
37 i18n_lint=`grep -En "<source> |<source>$| </source>" src/locale/messages.xlf`
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