Update the version of ruamel.yaml to 0.17.1
[modeling/etsicatalog.git] / mvn-phase-script.sh
1 #!/bin/bash
2 # Copyright 2018 ZTE Corporation.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #         http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16
17 set -e
18
19 echo "running script: [$0] for module [$1] at stage [$2]"
20
21 export SETTINGS_FILE=${SETTINGS_FILE:-$HOME/.m2/settings.xml}
22 MVN_PROJECT_MODULEID="$1"
23 MVN_PHASE="$2"
24
25
26 FQDN="${MVN_PROJECT_GROUPID}.${MVN_PROJECT_ARTIFACTID}"
27 if [ "$MVN_PROJECT_MODULEID" == "__" ]; then
28   MVN_PROJECT_MODULEID=""
29 fi
30
31 if [ -z "$WORKSPACE" ]; then
32     WORKSPACE=$(pwd)
33 fi
34
35
36 # mvn phase in life cycle
37 MVN_PHASE="$2"
38
39
40 echo "MVN_PROJECT_MODULEID is            [$MVN_PROJECT_MODULEID]"
41 echo "MVN_PHASE is                       [$MVN_PHASE]"
42 echo "MVN_PROJECT_GROUPID is             [$MVN_PROJECT_GROUPID]"
43 echo "MVN_PROJECT_ARTIFACTID is          [$MVN_PROJECT_ARTIFACTID]"
44 echo "MVN_PROJECT_VERSION is             [$MVN_PROJECT_VERSION]"
45
46 run_tox_test()
47 {
48   set -x
49   CURDIR=$(pwd)
50   if [[ ${CURDIR} =~ "-sonar" ]]
51   then
52     echo "====Sonar job, need execute tox."
53     TOXINIS=$(find . -name "tox.ini")
54     for TOXINI in "${TOXINIS[@]}"; do
55       DIR=$(echo "$TOXINI" | rev | cut -f3- -d'/' | rev)
56       cd "${CURDIR}/${DIR}"
57       rm -rf ./venv-tox ./.tox
58       virtualenv ./venv-tox
59       source ./venv-tox/bin/activate
60       pip install --upgrade pip
61       pip install --upgrade tox argparse
62       pip freeze
63       tox
64       deactivate
65       rm -rf ./venv-tox ./.tox
66     done
67   else
68     echo "====Not a sonar job, need not execute tox."
69   fi
70 }
71
72
73 case $MVN_PHASE in
74 clean)
75   echo "==> clean phase script"
76   rm -rf ./venv-*
77   ;;
78 test)
79   echo "==> test phase script"
80   run_tox_test
81   ;;
82 *)
83   echo "==> unprocessed phase"
84   ;;
85 esac
86