-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
101 lines (91 loc) · 5.02 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
language: python
cache: pip
matrix:
fast_finish: true
include:
- python: 2.7
- python: 3.5
- python: 3.6
- python: 3.7
dist: xenial
sudo: true
env:
global:
- GH_REF: [email protected]:smarie/python-mini-lambda.git
before_install:
# (a) linux dependencies
- sudo apt-get install ant
- sudo apt-get install ant-optional # for junitreports
install:
- pip list
- pip install six setuptools_scm # apparently python 2 requires this
- python ci_tools/py_install.py pip ci_tools/requirements-pip.txt
# this does not work anymore on python 2 so lets only do it when needed
- if [ "${TRAVIS_PYTHON_VERSION}" = "3.5" ]; then pip install mkdocs-material mkdocs; fi;
# travis-specific installs
- pip install PyGithub # for ci_tools/github_release.py
- pip install codecov # See https://github.com/codecov/example-python.
- pip list
script:
# - coverage run tests.py
- python ./code_generation/mini_lambda_methods_generation.py
- pip install .
- python -c "import os; os.chdir('..'); import mini_lambda"
# ***tests***
# - coverage run tests.py
# - pytest --junitxml=reports/junit/junit.xml --html=reports/junit/report.html --cov-report term-missing --cov=./mini_lambda -v mini_lambda/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 mini_lambda # 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 docs/ # not in site/ anymore so that we do not need to use --dirty (it breaks client-side search)
# mkdocs gh-deploy requires special care :
# ---grant the possibility to push on the repo---
- openssl aes-256-cbc -K $encrypted_fdc2c20d7f8b_key -iv $encrypted_fdc2c20d7f8b_iv -in ci_tools/github_travis_rsa.enc -out ci_tools/github_travis_rsa -d
# 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 "[email protected]"
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: do not use the --dirty flag as it breaks client-side search
if [ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_PYTHON_VERSION}" = "3.5" ]; then echo "Pushing to github"; PYTHONPATH=mini_lambda/ mkdocs gh-deploy -v -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
# -- create the _version.py file: actually not needed, done in setup now
# - python ci_tools/write_version.py ./mini_lambda
deploy:
# Deploy on PyPI on tags
- provider: pypi
user: "smarie"
password:
secure: "L4CcfT7Aq4bTiVAkMadR1dHUgU0GEHFphuywP38OpPAofsgf1b/IFIZPT3SDpo5AhbzpDSm0GGgQmITJrFwUlh4K5ubs/QYB3AWQN/w1yEf9T+ON/UcwtJYvjtrMNHV5yNxtDiSmDe6T8pjV0w9210KB7cW0r3Nkjq4A/Vo6bdInMAiK1pSgreuYHqkvDvKytjBnray8UlPQK4Bc1w7ixA91veNvcD+0OlOrSROzb5No0zbZ8+6PVu0Sa6G5gV32cDWxL7sSSbfaFeebZFgoYPaZkPl14IhG/VA9698yZ26owaqI9UqKPnoO/ySisgxmljc0QA7zJksFYCPzjFOUVVmcDnRgJmcMrqg3wrbXJLYAPHoj1jDtd3R6eEXBDV/Z/rdX33YfalfeRiXj2xA6RBeYGscIrfe93PbOfKOl2oAv5So4Guip2gjubXyHH7720PUQu1D8h5kA/GP0OhISwrRc7SVg3gsx31vpQUMMWgryS4B40aVf30VIlruJFD/JNPBEIjH+otZmc1j4PIJ3swWtPgDKijaPkj0isvacCwMH89+DAYR19QyG/fuLZwEm4Vykrruk6s52FPnootWSShluRu6APbPeZ473UV7SaPDDYXt8eZAz4l7GvGz7yVpHLXLS368oUb4L8N3yICtmHha6vRJcFaVsQ6JFFH3S98A="
on:
tags: true
python: 3.6 # only one of the builds have to be deployed, we'll take the latest since generated code will be more complete
# 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/python-mini-lambda -cf ./docs/changelog.md -d https://smarie.github.io/python-mini-lambda/changelog/ $TRAVIS_TAG
skip_cleanup: true
on:
tags: true
python: 3.5 #only one of the builds have to be deployed
notifications:
email:
on_success: never # options: [always|never|change] default: always