Skip to content

Commit b4fa2f6

Browse files
author
Sylvain MARIE
committed
Fixed travis configuration
1 parent 8a4bec8 commit b4fa2f6

2 files changed

Lines changed: 39 additions & 34 deletions

File tree

.travis.yml

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,19 @@ cache: pip
55
matrix:
66
fast_finish: true
77
include:
8-
- python: 2.7
9-
- python: 3.5
10-
- python: 3.6
11-
- python: 3.7
8+
- name: "Python 2.7"
9+
python: 2.7
10+
- name: "Python 3.5"
11+
python: 3.5
12+
- name: "Python 3.6"
13+
python: 3.6
14+
- name: "Python 3.7 - DEPLOY WebSite+Coverage+PyPi"
15+
python: 3.7
16+
env: DEPLOY_ENV="true"
17+
dist: xenial
18+
sudo: true
19+
- name: "Python 3.8"
20+
python: 3.8
1221
dist: xenial
1322
sudo: true
1423

@@ -23,10 +32,11 @@ before_install:
2332

2433
install:
2534
- pip list
26-
- pip install six setuptools_scm # apparently python 2 requires this
35+
# Install all requirements using pip
36+
- pip install six setuptools_scm # apparently python 2 requires this done beforehand
2737
- python ci_tools/py_install.py pip ci_tools/requirements-pip.txt
2838
# this does not work anymore on python 2 so lets only do it when needed
29-
- if [ "${TRAVIS_PYTHON_VERSION}" = "3.5" ]; then pip install mkdocs-material mkdocs; fi;
39+
- if [ "${DEPLOY_ENV}" = "true" ]; then pip install mkdocs-material mkdocs pymdown-extensions pygments; fi;
3040
- |
3141
if [ "${TRAVIS_PYTHON_VERSION}" = "2.7" ]; then
3242
echo "No need to install enforce pytypes checktypes BUT need to install future"
@@ -44,20 +54,19 @@ install:
4454
- pip list
4555

4656
script:
47-
# - coverage run tests.py
57+
# Local installation test
4858
- pip install .
4959
- python -c "import os; os.chdir('..'); import valid8"
50-
# ***tests***
51-
# - coverage run tests.py
52-
# - pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html --cov-report term-missing --cov=./valid8 -v valid8/tests/
53-
# now done in a dedicated script to capture exit code 1 and transform it to 0
60+
- pip uninstall -y valid8 # so that the setuptools_scm test can be executed
61+
# ***tests+coverage*** done in a dedicated script to capture exit code 1 and transform it to 0
5462
- chmod a+x ./ci_tools/run_tests.sh
5563
- sh ./ci_tools/run_tests.sh
56-
- python ci_tools/generate-junit-badge.py 100 # generates the badge for the test results and fail build if less than x%
64+
# generate the badge for the test results and fail build if less than x%
65+
- python ci_tools/generate-junit-badge.py 100
5766

5867
after_success:
59-
# ***reporting***
60-
# - junit2html junit.xml testrun.html output is really not nice
68+
# ***reporting***
69+
# - junit2html junit.xml testrun.html output is really not nice
6170
- ant -f ci_tools/generate-junit-html.xml # generates the html for the test results. Actually we dont use it anymore
6271
- codecov
6372
#- pylint valid8 # note that at the moment the report is simply lost, we dont transform the result into anything
@@ -78,7 +87,8 @@ after_success:
7887
git remote add gh-remote "${GH_REF}";
7988
git fetch gh-remote && git fetch gh-remote gh-pages:gh-pages; # make sure we have the latest gh-remote
8089
# push but only if this is not a build triggered by a pull request
81-
if [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_PYTHON_VERSION}" = "3.5" ]; then echo "Pushing to github"; PYTHONPATH=valid8/ mkdocs gh-deploy -v -f docs/mkdocs.yml --remote-name gh-remote; git push gh-remote gh-pages; fi;
90+
# note: do not use the --dirty flag as it breaks client-side search
91+
if [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${DEPLOY_ENV}" = "true" ]; then echo "Pushing to github"; PYTHONPATH=valid8/ mkdocs gh-deploy -v -f docs/mkdocs.yml --remote-name gh-remote; git push gh-remote gh-pages; fi;
8292
else
8393
echo "File 'ci_tools/github_travis_rsa' has not been created, please check your encrypted repo token in .travis.yml, on the line starting with 'openssl aes-256-cbc...'"
8494
fi
@@ -93,7 +103,8 @@ deploy:
93103
secure: "qQqjDAx4pD5V+U3ruuWqu3xldmNs6Q+XAi7yfgT8E5l47mYEZ0jFNz+SpDgQpgYbQzGRjAKRHWzJejhncv5wJYMqPa70B7DNMRgNL7GEpsT8mYQJYtG5ZUDx2NbNFzcVRTyzl7dJj6LzPVQt6z/2yZ/9KqBXsxvwGBjZCOGXtgFhqUJscFy51jwgo2IWuVUNRCnVJtaUkjudWPxH86RviKpyvDAxzCW2ZMXVOlpFxyeOu1oTSVIq9hPwOcUn9Roukl491YSK6vF9b6zZYzTEGhMp/+t+gccgrMRmcjdbXQnVSKsBlfzWI1hNmclqzKXjNCzFZIH3uELVhlRAmwLPDbdby2RMVARKfnMEGW+mqbM3gET8cXoxqz+hKXp6ZdJtm9+McO2ECa6+zVn/8V/QSlCT5HRf1a7/jyL/Ytv5LPEYnaU4dH52BfSgjaFzsOS/5DEa0CJb034LDCwc2L6yZfmVo7Rx6n2YcakE2UrQ7xDizlS6c0Ukcj/7U2fji3O7CjXBoccKotxJ9Eml2isMjq4rwW5Uizo2P1CbSgn05fdWeLl04drbE0ENze1Ac0bMaWkvDItJYW7ZqT1pBGRh6c1/AYgF/g34l2Uz6yDQyA5FBCgVSbeVz5u9Hzs7x0XQmk0z6L0L/bi9SDC93m7bon60gwNM6YAeT6N8wpt/jrw="
94104
on:
95105
tags: true
96-
python: 3.5 #only one of the builds have to be deployed
106+
# python: 3.5 #only one of the builds have to be deployed
107+
condition: $DEPLOY_ENV = "true"
97108
# server: https://test.pypi.org/legacy/
98109
distributions: "sdist bdist_wheel"
99110

@@ -103,7 +114,8 @@ deploy:
103114
skip_cleanup: true
104115
on:
105116
tags: true
106-
python: 3.5 #only one of the builds have to be deployed
117+
# only one of the builds have to be deployed
118+
condition: $DEPLOY_ENV = "true"
107119

108120
notifications:
109121
email:

ci_tools/run_tests.sh

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,15 @@ cleanup() {
1212

1313
trap "cleanup" INT TERM EXIT
1414

15-
#if hash pytest 2>/dev/null; then
16-
# echo "pytest found"
17-
#else
18-
# echo "pytest not found. Trying py.test"
19-
#fi
20-
21-
# First the raw for coverage
22-
echo -e "\n\n****** Running tests ******\n\n"
23-
if [ "${TRAVIS_PYTHON_VERSION}" = "3.5" ]; then
24-
# copy the conftest.py file before executing.
25-
# cp ci_tools/conftest.py valid8/
26-
# Note: an alternative could be to add ci_tools/ at the end of the below command but not sure it will be applied on all tests.
27-
28-
coverage run --source valid8 -m pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html -v valid8/
29-
# python -m pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html --cov-report term-missing --cov=./valid8 -v valid8/
15+
if [ "${DEPLOY_ENV}" = "true" ]; then
16+
# full
17+
# Run tests with "python -m pytest" to use the correct version of pytest
18+
echo -e "\n\n****** Running tests with coverage ******\n\n"
19+
coverage run --source valid8 -m pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html -v valid8/tests/
20+
# buggy
21+
# python -m pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html --cov-report term-missing --cov=./valid8 -v valid8/tests/
3022
else
31-
# faster - skip coverage and html report
32-
python -m pytest --junitxml=reports/junit/junit.xml -v valid8/
23+
# faster - skip coverage and html report but keep junit (because used in validity threshold)
24+
echo -e "\n\n****** Running tests******\n\n"
25+
python -m pytest --junitxml=reports/junit/junit.xml -v valid8/tests/
3326
fi

0 commit comments

Comments
 (0)