-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.travis.yml
131 lines (116 loc) · 6.36 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
language: python
# DO NOT CACHE PIP: we rather use a fresh conda
# cache: pip
python:
# - "2.7"
- "3.5"
# - "3.6"
# - "3.7" NOT AVAILABLE ON TRAVIS YET..
# - "3.7-dev" # 3.7 development branch
# - "nightly" # currently points to 3.7-dev
# PyPy versions
# - "pypy" # PyPy2 2.5.0
# - "pypy3" # Pypy3 2.4.0
# - "pypy-5.3.1"
env:
global:
- GH_REF: git@github.com:smarie/pytest-patterns.git
# matrix:
# - PYTEST_VERSION="<3" PYTEST_HTML_VERSION="==1.9.0" # indeed recent pytest_html require pytest>=3
# - PYTEST_VERSION="<4" PYTEST_HTML_VERSION=""
before_install:
# (a) linux dependencies
- sudo apt-get install pandoc
- sudo apt-get install ant
- sudo apt-get install ant-optional
# ------------ USE CONDA BECAUSE OTHERWISE WE HAVE VERSION CONFLICTS WITH PYTEST AND ITS PLUGINS ---
# (b) install conda - from https://conda.io/docs/user-guide/tasks/use-conda-with-travis-ci.html
- echo "downloading miniconda"; if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
sudo wget -q https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh;
else
sudo wget -q https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
fi
- echo "installing miniconda to $HOME/miniconda"; bash miniconda.sh -b -p $HOME/miniconda; export PATH="$HOME/miniconda/bin:$PATH"
- echo "configuring miniconda"; hash -r; conda config --set always_yes yes --set changeps1 no
# - conda update -q conda NO !!!!
# (c) base conda environment
- echo "creating conda environment"; conda create -q -y -n test-environment python=$TRAVIS_PYTHON_VERSION
- echo "activating conda environment"; source activate test-environment
install:
- conda list
- python ci_tools/py_install.py conda ci_tools/requirements-conda.txt
- python ci_tools/py_install.py pip ci_tools/requirements-pip.txt
# travis-specific installs
- pip install PyGithub # for ci_tools/github_release.py
- pip install codecov # See https://github.com/codecov/example-python.
- conda list
# WARNING to use the "true" pytest (or py.test) depending on version, "pytest" is NOT the way to go !
# - python -m pytest --version # - pytest --version
script:
- conda list
# - coverage run tests.py
# - pip install .
# - python -c "import os; os.chdir('..'); import pytest_patterns"
# ***tests***
# - coverage run tests.py
# - pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html --cov-report term-missing --cov=./pytest_patterns -v pytest_patterns/tests/
# now done in a dedicated script to capture exit code 1 and transform it to 0
# - chmod a+x ./ci_tools/run_tests.sh
# - sh ./ci_tools/run_tests.sh
# - python ci_tools/generate-junit-badge.py 100 # generates the badge for the test results and fail build if less than x%
after_success:
# ***reporting***
# - junit2html junit.xml testrun.html output is really not nice
# - ant -f ci_tools/generate-junit-html.xml # generates the html for the test results. Actually we dont use it anymore
# - codecov
# - pylint pytest_patterns # note that at the moment the report is simply lost, we dont transform the result into anything
# ***documentation***
- mkdocs build -f docs/mkdocs.yml
# - mv reports/junit site/
# mkdocs gh-deploy requires special care :
# ---grant the possibility to push on the repo---
- openssl aes-256-cbc -K $encrypted_142bf2245ee5_key -iv $encrypted_142bf2245ee5_iv -in ci_tools/github_travis_rsa.enc -out ci_tools/github_travis_rsa -d
# Create a tar.gz archive
- cd pytest_patterns; tar --exclude='_*' -cvzf ../all_examples.tar.gz *; cd ..
# If the output file does not exist, that is because the secret is invalid. This can happen in forked repos so do not fail the build
- |
if [ -s "ci_tools/github_travis_rsa" ]; then
chmod 600 ci_tools/github_travis_rsa
eval `ssh-agent -s` # launch the authentication agent
ssh-add ci_tools/github_travis_rsa # register the decrypted key
git config user.name "Automatic Publish"
git config user.email "sylvain.marie@schneider-electric.com"
git remote add gh-remote "${GH_REF}";
git fetch gh-remote && git fetch gh-remote gh-pages:gh-pages; # make sure we have the latest gh-remote
# push but only if this is not a build triggered by a pull request
# note: here we use the --dirty flag so that mkdocs does not clean the additional reports that we copied in the site
if [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_PYTHON_VERSION}" = "3.5" ]; then echo "Pushing to github"; PYTHONPATH=pytest_patterns/ mkdocs gh-deploy -v --dirty -f docs/mkdocs.yml --remote-name gh-remote; git push gh-remote gh-pages; fi;
else
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...'"
fi
deploy:
# Deploy on PyPI on tags
# - provider: pypi
# user: "smarie"
# password:
# # note: the pass has already been generated ok
# secure: "nWLzV870CmSAvPoQx05Fh8bti88h2wHyY+alVPnIxhCpndlZ3QAtB/vifmNZsK6oy5Ii8x0W9HAkmoXwgTOKBnFC4vU9OL4VOaqz7vrCHNrHjWlOYd9ai6fo3IcmzBamKcazNLwa3qfHAVre2kfCPxnP0KyJOiwT3JCiU7kxUiRGRKbbSNq3icViVebUgxjZKbVfeVf1mYyVv6tnPPAPyL7I3u6CZAqPx56zL1KmC9wrBy+omWiy/ZM8C8/FtHybO2ACkv+rnOlH2XyFaDiyGVZBeVDmArxD+0gJJ+mb93DmsWAnMig7QbWLnZff2yhaPF7ZbBm2wB76ISaR652us2H/dv/KaYSeyWPtYbeFSSlL+clzXvNtEyqXc6vUSmd5PInxXF8+JwWPM8QvxqcOQS/dGbE+VJMF8o8lSNoa472tjaJzTwRVS71Ka0gf7sZ5IUoXaB/ubonDXTfX7MHDLCowmvOBrVbMHsKI25s+TQJ61yxZyTuBGH9uog0m3dWkIgPm8WxkbBZvZ9sDLcDQ4SLXNwEgm78UY6Ps/cWlHgHsjeVPl8ToBdo0YYlJSS/Oy+fVpj3VIkrAkQKhyBcvwh+ZDLjiwXkDnwqkwuPyyKJSVS7JuLGAmuEopHN6V5KsRiNh2PicZ0Z7VITlm9ArOCjR91XbNXOfYGii8jbwHII="
# on:
# tags: true
# python: 3.5 #only one of the builds have to be deployed
# condition: $PYTEST_VERSION = "<3"
# # server: https://test.pypi.org/legacy/
# distributions: "sdist bdist_wheel"
# Create a github release on tags
- provider: script
script: python ci_tools/github_release.py -s $GITHUB_TOKEN --repo-slug smarie/pytest-patterns -cf ./docs/changelog.md -d https://smarie.github.io/pytest-patterns/changelog/ -df all_examples.tar.gz $TRAVIS_TAG
skip_cleanup: true
on:
tags: true
python: 3.5 #only one of the builds have to be deployed
# condition: $PYTEST_VERSION = "<3"
matrix:
fast_finish: true
notifications:
email:
on_success: never # options: [always|never|change] default: always