Skip to content

Commit 236117e

Browse files
authored
Merge pull request #65 from maxmind/andy/better-travis-yaml
Set env vars in travis matrix instead of hardcoding python versions
2 parents 9d6830a + 6310212 commit 236117e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

.travis.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ matrix:
1414
dist: trusty
1515
- python: 3.7
1616
dist: xenial
17+
env:
18+
- RUN_SNYK=1
19+
- RUN_LINTER=1
1720
- python: nightly
1821
dist: xenial
1922
- python: pypy
@@ -32,18 +35,18 @@ before_install:
3235
- sudo ldconfig
3336
- cd ..
3437
- pip install -e git+https://github.com/maxmind/MaxMind-DB-Reader-python#egg=maxminddb
35-
- "if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then sudo apt-get install -y nodejs; npm install -g snyk; fi"
38+
- "if [[ $RUN_SNYK ]]; then sudo apt-get install -y nodejs; npm install -g snyk; fi"
3639
install:
3740
- pip install -r requirements.txt
3841
- pip install requests_mock pylint coveralls yapf
39-
- "if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then snyk test --org=maxmind; fi"
42+
- "if [[ $RUN_SNYK ]]; then snyk test --org=maxmind; fi"
4043
script:
4144
- coverage run --source=geoip2 setup.py test
42-
- "if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then ./.travis-pylint.sh; fi"
43-
- "if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then ./.travis-yapf.sh; fi"
45+
- "if [[ $RUN_LINTER ]]; then ./.travis-pylint.sh; fi"
46+
- "if [[ $RUN_LINTER ]]; then ./.travis-yapf.sh; fi"
4447
after_success:
4548
- coveralls
46-
- "if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' && $TRAVIS_PYTHON_VERSION == '3.7' ]]; then snyk monitor --org=maxmind --project-name=maxmind/GeoIP2-python; fi"
49+
- "if [[ $RUN_SNYK && $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then snyk monitor --org=maxmind --project-name=maxmind/GeoIP2-python; fi"
4750
notifications:
4851
email:
4952
on_failure: always

0 commit comments

Comments
 (0)