Commit 5a2d17d8 by Calen Pennington

Move travis test scripts into makefiles so that they can be parallelized

parent deb66ba2
......@@ -13,55 +13,9 @@ install:
- "sudo apt-get install -y nodejs python-demjson"
- "pip install --allow-all-external -r requirements.txt"
- "pip install --allow-all-external demjson"
env:
- MAKE_TARGET=docker.test
- MAKE_TARGET=test.syntax
- MAKE_TARGET=test.edx_east_roles
script:
- |
for yml in $(find . -name "*.yml"); do
python -c "import sys,yaml; yaml.load(open(sys.argv[1]))" $yml >/dev/null
if [[ $? -ne 0 ]]; then
echo "ERROR parsing $yml"
exit 1
fi
done
- |
for json in $(find . -name "*.json"); do
jsonlint -v $json
if [[ $? -ne 0 ]]; then
echo "ERROR parsing $json"
exit 1
fi
done
- |
pushd playbooks
for j2 in $(git diff --name-only refs/heads/master..$(git rev-parse --abbrev-ref HEAD) |grep -E '.+\.j2$|.+\.yml'); do
python ../tests/jinja_check.py ../$j2
if [[ $? -ne 0 ]]; then
echo "Jinja parsing error on $j2"
exit 1
fi
done
popd
- |
set -e
ROOT_DIR=$PWD
cd playbooks/edx-east
ROLE_DIRS=$(/bin/ls -d roles/*)
cat <<EOF >travis-test.yml
- name: Play to test all roles
hosts: all
roles:
EOF
for role_dir in $ROLE_DIRS; do
echo " - $(basename $role_dir)" >> travis-test.yml
done
ansible-playbook -i localhost, --syntax-check travis-test.yml
output_dir="$PWD/test_output/env-dep"
mkdir -p $output_dir
ansible-playbook -i localhost, -c local --tags edxapp_cfg edxapp.yml -e edxapp_user=`whoami` -e edxapp_app_dir=$output_dir -e edxapp_code_dir=$output_dir -e EDXAPP_CFG_DIR=$output_dir
root_dir=$output_dir
environment_deployments="."
source $ROOT_DIR/tests/validate_templates.sh
- cd $TRAVIS_BUILD_DIR; make docker.test
- make $MAKE_TARGET
......@@ -30,6 +30,12 @@ help:
@echo ' make docker.pkg package all defined docker containers (using local base images)'
@echo ' make docker.push push all defined docker containers'
@echo ''
@echo ' Tests:'
@echo ' test.syntax Run all syntax tests'
@echo ' test.syntax.json Run syntax tests on .json files'
@echo ' test.syntax.yml Run syntax tests on .yml files'
@echo ' test.syntax.jinja Run syntax tests on .j2 files'
@echo ' test.edx_east_roles Run validation on edx-east roles'
@echo ''
requirements:
......
yml_files:=$(shell find . -name "*.yml")
json_files:=$(shell find . -name "*.json")
jinja_files:=$(shell find . -name "*.j2")
test: test.syntax test.edx_east_roles
test.syntax: test.syntax.yml test.syntax.json test.syntax.jinja
test.syntax.yml: $(patsubst %,test.syntax.yml/%,$(yml_files))
test.syntax.yml/%:
python -c "import sys,yaml; yaml.load(open(sys.argv[1]))" $* >/dev/null
test.syntax.json: $(patsubst %,test.syntax.json/%,$(json_files))
test.syntax.json/%:
jsonlint -v $*
test.syntax.jinja: $(patsubst %,test.syntax.jinja/%,$(jinja_files))
test.syntax.jinja/%:
cd playbooks && python ../tests/jinja_check.py ../$*
test.edx_east_roles:
tests/test_edx_east_roles.sh
set -e
ROOT_DIR=$PWD
cd playbooks/edx-east
ROLE_DIRS=$(/bin/ls -d roles/*)
cat <<EOF >travis-test.yml
- name: Play to test all roles
hosts: all
roles:
EOF
for role_dir in $ROLE_DIRS; do
echo " - $(basename $role_dir)" >> travis-test.yml
done
ansible-playbook -i localhost, --syntax-check travis-test.yml
output_dir="$PWD/test_output/env-dep"
mkdir -p $output_dir
ansible-playbook -i localhost, -c local --tags edxapp_cfg edxapp.yml -e edxapp_user=`whoami` -e edxapp_app_dir=$output_dir -e edxapp_code_dir=$output_dir -e EDXAPP_CFG_DIR=$output_dir
root_dir=$output_dir
environment_deployments="."
source $ROOT_DIR/tests/validate_templates.sh
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment