Skip to content
Snippets Groups Projects
Commit a7abe51c authored by Stefano Borini's avatar Stefano Borini
Browse files

Modified travis for CI package

parent 0138ae30
No related branches found
No related tags found
1 merge request!153Introduce CI package to handle installation and development
This commit is part of merge request !153. Comments created here will be created in the context of that merge request.
...@@ -11,21 +11,14 @@ before_install: ...@@ -11,21 +11,14 @@ before_install:
- export PATH=/usr/lib/ccache:${PATH} - export PATH=/usr/lib/ccache:${PATH}
- wget https://package-data.enthought.com/edm/rh5_x86_64/1.9/edm_1.9.2_linux_x86_64.sh && bash ./edm_1.9.2_linux_x86_64.sh -b -f -p $HOME - wget https://package-data.enthought.com/edm/rh5_x86_64/1.9/edm_1.9.2_linux_x86_64.sh && bash ./edm_1.9.2_linux_x86_64.sh -b -f -p $HOME
- export PATH=${HOME}/edm/bin:${PATH} - export PATH=${HOME}/edm/bin:${PATH}
- edm environments create --version ${PYTHON_VERSION} force - edm install -y -e force-bootstrap click setuptools
- . $HOME/.edm/envs/force/bin/activate - edm run -e force-bootstrap -- python -m ci build-env --python-version ${PYTHON_VERSION}
install:
- pip install -r requirements/requirements.txt
- pip install -e .
script: script:
- pip install -r requirements/dev_requirements.txt - edm run -e force-bootstrap -- python -m ci flake8
- flake8 . - edm run -e force-bootstrap -- python -m ci test
- python -m unittest discover - edm run -e force-bootstrap -- python -m ci docs
- pip install -r requirements/doc_requirements.txt
- pushd doc
- make html
- popd
after_success: after_success:
- coverage run -m unittest discover - edm run -e force-bootstrap -- python -m ci coverage
- pip install codecov - edm run -e force-bootstrap -- pip install codecov
- codecov - edm run -e force-bootstrap -- codecov
- bash <(curl -s https://codecov.io/bash) - bash <(curl -s https://codecov.io/bash)
ci/__init__.py 0 → 100644
ci/__main__.py 0 → 100644
+ 109
0
View file @ a7abe51c
import click
from subprocess import check_call
DEFAULT_PYTHON_VERSION = "2.7"
PYTHON_VERSIONS = ["2.7", "3.6"]
CORE_DEPS = [
"envisage==4.6.0-1",
"click==6.7-1",
"six==1.10.0-1",
"stevedore==1.2.0-22"
]
DOCS_DEPS = [
"sphinx==1.5.5-5"
]
DEV_DEPS = [
"flake8==3.3.0-2",
"coverage==4.3.4-1",
"mock==2.0.0-1",
"testfixtures==4.10.0-1",
]
PIP_DEPS = [
]
@click.group()
def cli():
pass
python_version_option = click.option(
'--python-version',
default=DEFAULT_PYTHON_VERSION,
type=click.Choice(PYTHON_VERSIONS),
show_default=True,
help="Python version for the environment")
@cli.command(name="build-env", help="Creates the execution environment")
@python_version_option
def build_env(python_version):
env_name = get_env_name(python_version)
check_call([
"edm", "environments", "remove", "--purge", "--force",
"--yes", env_name])
check_call(
["edm", "environments", "create", env_name])
check_call([
"edm", "install", "-e", env_name,
"--yes"] + CORE_DEPS + DEV_DEPS + DOCS_DEPS)
if len(PIP_DEPS):
check_call([
"edm", "run", "-e", env_name, "--",
"pip", "install"] + PIP_DEPS)
check_call([
"edm", "run", "-e", env_name, "--",
"pip", "install", "-e", "."])
@cli.command(help="Run the tests")
@python_version_option
def test(python_version):
env_name = get_env_name(python_version)
check_call([
"edm", "run", "-e", env_name, "--", "python", "-m", "unittest",
"discover"
])
@cli.command(help="Run flake")
@python_version_option
def flake(python_version):
env_name = get_env_name(python_version)
check_call(["edm", "run", "-e", env_name, "--", "flake8", "."])
@cli.command(help="Builds the documentation")
@python_version_option
def coverage(python_version):
env_name = get_env_name(python_version)
check_call(["edm", "run", "-e", env_name, "--",
"coverage", "run", "-m", "unittest", "discover"])
@cli.command(help="Builds the documentation")
@python_version_option
def docs(python_version):
check_call(["make", "html"], cwd="doc")
def get_env_name(python_version):
return "force-py{}".format(remove_dot(python_version))
def remove_dot(python_version):
return "".join(python_version.split('.'))
if __name__ == "__main__":
cli()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment