Skip to content

Commit a5b0148

Browse files
author
Sylvain MARIE
committed
Added pyproject.toml, improved mkdocs.md, and fixed travis builds so that deployment works again. Added python 3.8 in the builds. Deploy env is now 3.7
1 parent ad3f310 commit a5b0148

File tree

5 files changed

+44
-27
lines changed

5 files changed

+44
-27
lines changed

.travis.yml

Lines changed: 30 additions & 21 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,34 +32,34 @@ before_install:
2332

2433
install:
2534
- pip list
26-
- pip install setuptools_scm # apparently python 2 requires this
35+
# Install all requirements using pip
36+
- pip install setuptools_scm # apparently python 2 requires this done beforehand
2737
- python ci_tools/py_install.py pip ci_tools/requirements-pip.txt
28-
# 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;
38+
# mkdocs requirements: this does not work anymore on python 2 so lets only do it when needed
39+
- if [ "${DEPLOY_ENV}" = "true" ]; then pip install mkdocs-material mkdocs pymdown-extensions pygments; fi;
40+
# - if [ ! "${TRAVIS_PYTHON_VERSION}" = "2.7" ]; then pip install doit; fi;
3041
# travis-specific installs
3142
- pip install PyGithub # for ci_tools/github_release.py
3243
- pip install codecov # See https://github.com/codecov/example-python.
3344
- pip list
3445

3546
script:
36-
# - coverage run tests.py
47+
# Local installation test
3748
- pip install .
3849
- python -c "import os; os.chdir('..'); import getversion"
3950
- pip uninstall -y getversion # so that the setuptools_scm test can be executed
40-
# ***tests***
41-
# - coverage run tests.py
42-
# - pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html --cov-report term-missing --cov=./getversion -v getversion/tests/
43-
# now done in a dedicated script to capture exit code 1 and transform it to 0
51+
# ***tests+coverage*** done in a dedicated script to capture exit code 1 and transform it to 0
4452
- chmod a+x ./ci_tools/run_tests.sh
4553
- sh ./ci_tools/run_tests.sh
46-
- python ci_tools/generate-junit-badge.py 100 # generates the badge for the test results and fail build if less than x%
54+
# generate the badge for the test results and fail build if less than x%
55+
- python ci_tools/generate-junit-badge.py 100
4756

4857
after_success:
49-
# ***reporting***
50-
# - junit2html junit.xml testrun.html output is really not nice
58+
# ***reporting***
59+
# - junit2html junit.xml testrun.html output is really not nice
5160
- ant -f ci_tools/generate-junit-html.xml # generates the html for the test results. Actually we dont use it anymore
5261
- codecov
53-
# - pylint getversion # note that at the moment the report is simply lost, we dont transform the result into anything
62+
# - pylint getversion # at the moment the report would be simply lost, we dont transform the result into anything
5463
# ***documentation***
5564
- mkdocs build -f docs/mkdocs.yml
5665
- mv reports/junit docs/ # not in site/ anymore so that we do not need to use --dirty (it breaks client-side search)
@@ -69,7 +78,7 @@ after_success:
6978
git fetch gh-remote && git fetch gh-remote gh-pages:gh-pages; # make sure we have the latest gh-remote
7079
# push but only if this is not a build triggered by a pull request
7180
# note: do not use the --dirty flag as it breaks client-side search
72-
if [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_PYTHON_VERSION}" = "3.5" ]; then echo "Pushing to github"; PYTHONPATH=getversion/ mkdocs gh-deploy -v -f docs/mkdocs.yml --remote-name gh-remote; git push gh-remote gh-pages; fi;
81+
if [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${DEPLOY_ENV}" = "true" ]; then echo "Pushing to github"; PYTHONPATH=getversion/ mkdocs gh-deploy -v -f docs/mkdocs.yml --remote-name gh-remote; git push gh-remote gh-pages; fi;
7382
else
7483
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...'"
7584
fi
@@ -84,8 +93,8 @@ deploy:
8493
secure: "yaf389gcod/g9nvHtgt4AHuHi2qeVljwuHOTb5l4N2dkoGQz+UZiEiXY80+KcZ3XPHcE2MsrFNO2rKqHVCOjwvtrZCNjM9w2Zk+jBAyOKKx1SICWbfzvhlZN0pSNee6+805N6MrlzJ3SlgtsJeMjLttrh51Zrh2LsashSDI9YNVRG1a5iB6k8LOCp+5PZcuhh9qA0tWxQdxDU/NGcazGx97nrjT+xHaQ1agDt/h9wOZoLlUK+A1TnVesXF8k1DC6sirPmtvF5fCKOFniHZwFV2hS/htEgCuK5fpjheD6nGKNguUw88wiHTCNIuebyqaab79HPrWUNNpoOfJ8sSecJs0d9Kf647AueN8XX3KSDyhs4P+JwtRaAYCsVkqKbqyxlxE6bxe1KoRFREqk9mrad/ify/N9Cwrc02vkuJu3mBNZciO8oqosY1xRlvQQxz+p201eaads8cIMfzJkRVbIF8QC2ADfH9uGnwp1St6lBDx88+ZtM9LvPIzaQsvMXAqvA5mN4TlFBFxDuYDnL6C/sPAfk+Mc8hRWQ0CA2lwRQbLkQXI0VF0QpIAJbNIDrE8apYDVGZ6wZsy+TP5v9yxR2CM3mB+qzX71kYsvNHB3DlK89PXhRt/qLnY4+lhiIwC24YsOiS3KRQlWrE+3fi/8TzNjsrFV/UAnzW9jQk9WkeY="
8594
on:
8695
tags: true
87-
python: 3.5 #only one of the builds have to be deployed
88-
# condition: $PYTEST_VERSION = "<3"
96+
# python: 3.5 #only one of the builds have to be deployed
97+
condition: $DEPLOY_ENV = "true"
8998
# server: https://test.pypi.org/legacy/
9099
distributions: "sdist bdist_wheel"
91100

@@ -95,8 +104,8 @@ deploy:
95104
skip_cleanup: true
96105
on:
97106
tags: true
98-
python: 3.5 #only one of the builds have to be deployed
99-
# condition: $PYTEST_VERSION = "<3"
107+
# only one of the builds have to be deployed
108+
condition: $DEPLOY_ENV = "true"
100109

101110
notifications:
102111
email:

ci_tools/requirements-pip.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ pytest-html==1.9.0 # otherwise requires pytest 5
1515
xunitparser
1616

1717
# --- to generate the doc (see .travis)
18+
# does not work on python 2 anymore
1819
# mkdocs-material # ==2.7.3
1920
# mkdocs # ==0.17.3 # this is to prevent a version non-compliant with mkdocs-material to be installed.

ci_tools/run_tests.sh

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

1313
trap "cleanup" INT TERM EXIT
1414

15-
if [ "${TRAVIS_PYTHON_VERSION}" = "3.5" ]; then
15+
if [ "${DEPLOY_ENV}" = "true" ]; then
1616
# full
1717
# Run tests with "python -m pytest" to use the correct version of pytest
18-
echo -e "\n\n****** Running tests ******\n\n"
18+
echo -e "\n\n****** Running tests with coverage ******\n\n"
1919
coverage run --source getversion -m pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html -v getversion/tests/
2020
# buggy
2121
# python -m pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html --cov-report term-missing --cov=./getversion -v getversion/tests/

docs/mkdocs.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ nav:
77
- Home: index.md
88
# - API reference: api_reference.md
99
- Changelog: changelog.md
10-
1110
theme: material # readthedocs mkdocs
1211

1312
markdown_extensions:
13+
- pymdownx.highlight # see https://squidfunk.github.io/mkdocs-material/reference/code-blocks/#highlight
14+
- pymdownx.superfences # same as above as well as code blocks inside other blocks
1415
- admonition # to add notes such as http://squidfunk.github.io/mkdocs-material/extensions/admonition/
15-
- codehilite:
16-
guess_lang: true
16+
# - codehilite:
17+
# guess_lang: false
1718
- toc:
18-
permalink: true
19+
permalink: true

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[build-system]
2+
requires = [
3+
"setuptools",
4+
"setuptools_scm",
5+
]
6+
build-backend = "setuptools.build_meta"

0 commit comments

Comments
 (0)