Merge "Remove unnecessary check for pytest.skip"
[vvp/validation-scripts.git] / mvn-phase-script.sh
1 #!/bin/bash
2
3 # ================================================================================
4 # Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
5 # ================================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 # ============LICENSE_END=========================================================
18 #
19
20 set -ex
21
22
23 echo "running script: [$0] for module [$1] at stage [$2]"
24
25 MVN_PROJECT_MODULEID="$1"
26 MVN_PHASE="$2"
27 PROJECT_ROOT=$(dirname $0)
28
29 run_tox_test () {
30   CURDIR=$(pwd)
31   TOXINIS=$(find . -name "tox.ini")
32   for TOXINI in "${TOXINIS[@]}"; do
33     DIR=$(echo "$TOXINI" | rev | cut -f2- -d'/' | rev)
34     cd "${CURDIR}/${DIR}"
35     rm -rf ./venv-tox ./.tox
36     virtualenv ./venv-tox
37     source ./venv-tox/bin/activate
38     pip install --upgrade pip
39     pip install --upgrade tox argparse
40     pip freeze
41     tox
42     deactivate
43     rm -rf ./venv-tox ./.tox
44   done
45 }
46
47 # Customize the section below for each project
48 case $MVN_PHASE in
49 test)
50   echo "==> test phase script"
51   run_tox_test
52   ;;
53 *)
54   echo "==> unprocessed phase"
55   ;;
56 esac
57
58