forked from tlsfuzzer/tlsfuzzer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
94 lines (85 loc) · 3.71 KB
/
.travis.yml
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
language: python
python:
- 2.6
- 2.7
- 3.2
- 3.3
- 3.4
- 3.5
- 3.6
branches:
only:
- master
addons:
apt_packages:
# needed for M2Crypto
- swig
- libssl-dev
before_install:
- |
echo -e "TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST\n" \
"TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG\n" \
"TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST\n" \
"TRAVIS_COMMIT=$TRAVIS_COMMIT\n" \
"TRAVIS_PYTHON_VERSION=$TRAVIS_PYTHON_VERSION"
- |
# workaround https://github.com/travis-ci/travis-ci/issues/2666
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
URL="https://github.com/${TRAVIS_REPO_SLUG}/pull/${TRAVIS_PULL_REQUEST}.patch"
# `--location` makes curl follow redirects
PR_FIRST=$(curl --silent --show-error --location $URL | head -1 | grep -o -E '\b[0-9a-f]{40}\b' | tr -d '\n')
TRAVIS_COMMIT_RANGE=$PR_FIRST^..$TRAVIS_COMMIT
fi
# sanity check current commit
- git rev-parse HEAD
- echo "TRAVIS_COMMIT_RANGE=$TRAVIS_COMMIT_RANGE"
- git fetch origin master:refs/remotes/origin/master
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
install:
- if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then travis_retry pip install unittest2 'isort<4.3' 'inflect<0.3.1' 'coveralls<1.3.0' 'pyopenssl<18'; fi
- if [[ $TRAVIS_PYTHON_VERSION == '3.2' ]]; then travis_retry pip install 'requests<2.11' 'coverage<4' 'coveralls<1'; else travis_retry pip install 'coverage' 'coveralls'; fi
- travis_retry pip install -r requirements.txt
- travis_retry pip install -r build-requirements.txt
- |
if [[ $TRAVIS_PYTHON_VERSION == '2.6' || $TRAVIS_PYTHON_VERSION == '2.7' ]]; then
travis_retry pip install --global-option=build_ext --global-option="-I/usr/include/x86_64-linux-gnu" m2crypto;
fi
- if ! [[ $TRAVIS_PYTHON_VERSION == '2.6' || $TRAVIS_PYTHON_VERSION == '2.7' ]]; then travis_retry pip install pycrypto; fi
# codeclimate supports natively just one set of results, so use the most recent python for that
- if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then ./cc-test-reporter before-build; fi
script:
- |
if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then
coverage run --branch --source tlsfuzzer -m unittest2 discover;
else
coverage run --branch --source tlsfuzzer -m unittest discover;
fi
- coverage report -m
- travis_wait 30 python tests/scripts_retention.py tests/tlslite-ng-random-subset.json `which tls.py`
# pylint doesn't work on 2.6: https://bitbucket.org/logilab/pylint/issue/390/py26-compatiblity-broken
# diff-quality doesn't work on 3.2: https://github.com/edx/diff-cover/issues/94
- |
if [[ $TRAVIS_PYTHON_VERSION != '2.6' ]] && [[ $TRAVIS_PYTHON_VERSION != '3.2' ]]; then
pylint --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" tlsfuzzer > pylint_report.txt || :
diff-quality --violations=pylint --fail-under=90 pylint_report.txt
fi
- |
if [[ $TRAVIS_PULL_REQUEST != "false" ]]; then
echo "Will test commits between $TRAVIS_COMMIT_RANGE:"
git log --oneline --reverse $TRAVIS_COMMIT_RANGE
for i in $(git log --pretty=format:%H --reverse $TRAVIS_COMMIT_RANGE); do
git checkout $i
make clean
if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then
unit2 discover || exit 1
else
python -m unittest discover || exit 1
fi
cd $TRAVIS_BUILD_DIR
done
fi
sudo: false
after_success:
- coveralls
- if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then coverage xml; ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi