-
Notifications
You must be signed in to change notification settings - Fork 13
/
.travis.yml
80 lines (70 loc) · 2.39 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
language: generic
cache:
directories:
- $HOME/.pip-cache/
dist: xenial
# run builds and tests on Linux and MacOS
os:
- linux
# ignore the virtualenv that Travis creates
# setup a secure login to CodeCov
# set environment variables for different jobs
env:
# run build and test on two multiple versions of Python
matrix:
- PYENV_VERSION=3.7.3
# - PYENV_VERSION=3.6.8 (not using due to request on issue number 53)
# configure all of the needed global variables
# note that the secure entries reference access tokens
# that support secure access to remote services
global:
- PYENV_ROOT=$HOME/.travis-pyenv
- PIPENV_VENV_IN_PROJECT=1
- PIPENV_IGNORE_VIRTUALENVS=1
- LANG=en_US.UTF-8
- LC_ALL=en_US.UTF-8
- secure: c48e9fe3-e7a1-4fae-af4a-402755f36773 #code cov token
# install pyenv with travis-pyenv
before_install:
- wget https://github.com/praekeltfoundation/travis-pyenv/releases/latest/download/setup-pyenv.sh
- source setup-pyenv.sh
# run commands to install dependencies (from Pipfile, not Pipfile.lock)
# cannot use locked dependencies because of possible version changes
# between PYENV_VERSION versions
install:
- pip install --upgrade pip
- pip install --upgrade pipenv
- pipenv install --dev --skip-lock --python "$PYENV_VERSION"
- pip install coverage
- gem install mdl
# send emails when there is a change or failure
notifications:
email:
on_success: change
on_failure: always
# perform testing:
# --> run the test suite and generate coverage with Pipfile script
# --> lint the code with Pipfile script
# --> lint the README documentation with mdl
script:
- mdl README.md
- chmod +x ./scripts/*.sh
- pipenv run cover
- pipenv run test
- pipenv run lint --check
# report information to CodeCov and Codacy and tag the release of a pull request:
# --> Report coverage to CodeCov, which ensures that coverages does not drop by more than a threshold
# --> Report coverage to Codacy, which reports changes at various levels of granularity
# --> Automatically apply a release tag to the pull request using pr-tag-release
after_success:
- pipenv run codecov
- pipenv run python-codacy-coverage -r coverage.xml
- bash <(curl -s https://codecov.io/bash)
# deploy to GitHub Releases on PR merge
deploy:
provider: releases
api_key: "$GITHUB_OAUTH_TOKEN"
skip_cleanup: true
on:
branch: master
condition: $DO_GITHUB_RELEASE = true