Skip to content

Commit 060c61e

Browse files
authored
Merge pull request awslabs#180 from joguSD/ci
Add ci scripts
2 parents 20a83e8 + 1813160 commit 060c61e

File tree

5 files changed

+83
-12
lines changed

5 files changed

+83
-12
lines changed

.travis.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,23 @@ language: python
33
matrix:
44
include:
55
- python: 2.6
6-
env: TOXENV=py26
6+
env: TEST_TYPE=test
77
- python: 2.7
8-
env: TOXENV=py27
8+
env: TEST_TYPE=test
9+
- python: 2.7
10+
env: TEST_TYPE=check
911
- python: 3.3
10-
env: TOXENV=py33
12+
env: TEST_TYPE=test
1113
- python: 3.4
12-
env: TOXENV=py34
14+
env: TEST_TYPE=test
1315
- python: 3.5
14-
env: TOXENV=py35
16+
env: TEST_TYPE=test
1517
- python: 3.6
16-
env: TOXENV=py36
18+
env: TEST_TYPE=test
1719

1820
sudo: false
1921
install:
20-
- travis_retry pip install tox
21-
- if [[ $TOXENV == 'py27' ]]; then pip install -r requirements-dev.txt; pip install -e .; fi
22+
- if [[ $TEST_TYPE == 'check' ]]; then pip install -r requirements-dev.txt; fi
23+
- python scripts/ci/install
2224
script:
23-
- tox
24-
# We only need to run the lint/flake8 checks on one version of python
25-
# So I've arbitrarily chosen python2.7.
26-
- if [[ $TOXENV == 'py27' ]]; then make check; fi
25+
- make $TEST_TYPE

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,16 @@ check:
3131
#
3232
pylint --rcfile .pylintrc -E awsshell
3333

34+
test:
35+
python scripts/ci/run-tests
36+
3437
pylint:
3538
###### PYLINT ######
3639
# Python linter. This will generally not have clean output.
3740
# So you'll need to manually verify this output.
3841
#
3942
#
4043
pylint --rcfile .pylintrc awsshell
44+
4145
coverage:
4246
py.test --cov awsshell --cov-report term-missing tests/

scripts/ci/install

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env python
2+
import os
3+
import sys
4+
from subprocess import check_call
5+
import shutil
6+
7+
_dname = os.path.dirname
8+
9+
REPO_ROOT = _dname(_dname(_dname(os.path.abspath(__file__))))
10+
os.chdir(REPO_ROOT)
11+
12+
13+
def run(command):
14+
return check_call(command, shell=True)
15+
16+
17+
try:
18+
# Has the form "major.minor"
19+
python_version = os.environ['PYTHON_VERSION']
20+
except KeyError:
21+
python_version = '.'.join([str(i) for i in sys.version_info[:2]])
22+
23+
run('pip install -r requirements-test.txt')
24+
if os.path.isdir('dist') and os.listdir('dist'):
25+
shutil.rmtree('dist')
26+
run('python setup.py bdist_wheel')
27+
wheel_dist = os.listdir('dist')[0]
28+
run('pip install %s' % (os.path.join('dist', wheel_dist)))

scripts/ci/run-integ-tests

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env python
2+
# Don't run tests from the root repo dir.
3+
# We want to ensure we're importing from the installed
4+
# binary package not from the CWD.
5+
6+
import os
7+
from subprocess import check_call
8+
9+
_dname = os.path.dirname
10+
11+
REPO_ROOT = _dname(_dname(_dname(os.path.abspath(__file__))))
12+
os.chdir(os.path.join(REPO_ROOT, 'tests'))
13+
14+
15+
def run(command):
16+
return check_call(command, shell=True)
17+
18+
19+
run('py.test --cov awsshell --junitxml=./pytests.xml --cov-report term-missing'
20+
' integration/')

scripts/ci/run-tests

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env python
2+
# Don't run tests from the root repo dir.
3+
# We want to ensure we're importing from the installed
4+
# binary package not from the CWD.
5+
6+
import os
7+
from subprocess import check_call
8+
9+
_dname = os.path.dirname
10+
11+
REPO_ROOT = _dname(_dname(_dname(os.path.abspath(__file__))))
12+
os.chdir(os.path.join(REPO_ROOT, 'tests'))
13+
14+
15+
def run(command):
16+
return check_call(command, shell=True)
17+
18+
19+
run('py.test --cov awsshell --junitxml=./pytests.xml --cov-report term-missing'
20+
' unit/')

0 commit comments

Comments
 (0)