summaryrefslogtreecommitdiff
path: root/test/utils/shippable/sanity.sh
blob: 84dab4c54be595588c93ce3c9040a7e31482e2ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash -eux

source_root=$(python -c "from os import path; print(path.abspath(path.join(path.dirname('$0'), '../../..')))")

install_deps="${INSTALL_DEPS:-}"

cd "${source_root}"

# FIXME REPOMERGE: No need to checkout ansible
build_dir=$(mktemp -d)
trap 'rm -rf "{$build_dir}"' EXIT

git clone "https://github.com/ansible/ansible.git" "${build_dir}" --recursive
source "${build_dir}/hacking/env-setup"
# REPOMERGE: END

if [ "${install_deps}" != "" ]; then
    add-apt-repository ppa:fkrull/deadsnakes
    apt-add-repository 'deb http://archive.ubuntu.com/ubuntu trusty-backports universe'
    apt-get update -qq

    apt-get install -qq shellcheck python2.4

    # Install dependencies for ansible and validate_modules
    pip install -r "${build_dir}/test/utils/shippable/sanity-requirements.txt" --upgrade
    pip list

fi

validate_modules="${build_dir}/test/sanity/validate-modules/validate-modules"

python2.4 -m compileall -fq   -i                    "test/utils/shippable/sanity-test-python24.txt"
python2.4 -m compileall -fq   -x "($(printf %s "$(< "test/utils/shippable/sanity-skip-python24.txt"))" | tr '\n' '|')" .
python2.6 -m compileall -fq .
python2.7 -m compileall -fq .
python3.5 -m compileall -fq . -x "($(printf %s "$(< "test/utils/shippable/sanity-skip-python3.txt"))"  | tr '\n' '|')"

ANSIBLE_DEPRECATION_WARNINGS=false \
    "${validate_modules}" --exclude '/utilities/|/shippable(/|$)' .

shellcheck \
    test/utils/shippable/*.sh