blob: 7859c8dcf9021633137a6bf08c834a3159696d1d [file] [log] [blame]
Samuli Silviuscceed252019-04-16 15:41:26 +03001#! /usr/bin/env bash
2
3# COPYRIGHT NOTICE STARTS HERE
4
5# Copyright 2019 © Samsung Electronics Co., Ltd.
6#
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
18
19# COPYRIGHT NOTICE ENDS HERE
20
21#
22# This is a main wrapper script to run Molecule tests
23# Main usage is for the CI usage to keep interface stable and the way to call
24# Molecule can be adjusted in this script independently.
25#
26
Mateusz Pilat9c9be6f2019-05-06 17:12:36 +020027set -e
28
Samuli Silviuscceed252019-04-16 15:41:26 +030029SCRIPT_DIR=$(dirname "${0}")
30LOCAL_PATH=$(readlink -f "$SCRIPT_DIR")
31
32ROLE_PATH=$1
Mateusz Pilatb0f546a2019-05-08 13:33:46 +020033MOLECULE_CONTAINER=${MOLECULE_CONTAINER:-false}
Samuli Silviuscceed252019-04-16 15:41:26 +030034
35echo "Build all pre-build images"
36${LOCAL_PATH}/../images/docker/build-all.sh
37
38# Use Molecule container
39if [ "${MOLECULE_CONTAINER}" == "true" ]; then
40 echo "Build Molecule-dev docker container"
41 ${LOCAL_PATH}/../molecule-docker/build.sh
42 MOLECULE_BINARY=${LOCAL_PATH}/../bin/molecule.sh
43
44else # Install Molecule natively in the target platform
45 echo "Install Molecule with virtualenv"
46 source ${LOCAL_PATH}/../bin/install-molecule.sh
47 MOLECULE_BINARY=molecule
48fi
49
Samuli Silviuscceed252019-04-16 15:41:26 +030050cd ${ROLE_PATH}
Mateusz Pilat9c9be6f2019-05-06 17:12:36 +020051${MOLECULE_BINARY} --version
Samuli Silviuscceed252019-04-16 15:41:26 +030052${MOLECULE_BINARY} test --all
53cd -
Mateusz Pilat9c9be6f2019-05-06 17:12:36 +020054