Skip to content
Snippets Groups Projects
Unverified Commit cfdeb835 authored by Stefano Borini's avatar Stefano Borini Committed by GitHub
Browse files

Merge pull request #153 from force-h2020/ci-package

Introduce CI package to handle installation and development
parents 0138ae30 ce74dce4
No related branches found
No related tags found
No related merge requests found
...@@ -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 --python-version ${PYTHON_VERSION}
- flake8 . - edm run -e force-bootstrap -- python -m ci test --python-version ${PYTHON_VERSION}
- python -m unittest discover - edm run -e force-bootstrap -- python -m ci docs --python-version ${PYTHON_VERSION}
- 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 --python-version ${PYTHON_VERSION}
- pip install codecov - edm run -e force-bootstrap -- pip install codecov --python-version ${PYTHON_VERSION}
- codecov - edm run -e force-bootstrap -- codecov
- bash <(curl -s https://codecov.io/bash) - bash <(curl -s https://codecov.io/bash)
import click
from subprocess import check_call
DEFAULT_PYTHON_VERSION = "2.7"
PYTHON_VERSIONS = ["2.7", "3.5"]
CORE_DEPS = [
"distribute_remove==1.0.0-4",
"pip==10.0.1-1",
"setuptools==38.2.5-1",
"envisage==4.6.0-1",
"click==6.7-1",
"six==1.10.0-1",
]
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 = [
"stevedore==1.24.0"
]
@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 flake8(python_version):
env_name = get_env_name(python_version)
check_call(["edm", "run", "-e", env_name, "--", "flake8", "."])
@cli.command(help="Runs the coverage")
@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):
env_name = get_env_name(python_version)
check_call(["edm", "run", "-e", env_name, "--", "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()
...@@ -10,40 +10,39 @@ git repositories:: ...@@ -10,40 +10,39 @@ git repositories::
The last repository is optional, but recommended if you want to practice The last repository is optional, but recommended if you want to practice
writing plugins. writing plugins.
Next, download EDM package manager, and create an appropriate Next, download EDM package manager, and create a bootstrap environment::
environment::
wget https://package-data.enthought.com/edm/rh5_x86_64/1.4/edm_1.4.1_linux_x86_64.sh && bash ./edm_1.4.1_linux_x86_64.sh -b -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 3.5 force edm environments create --version 3.5 force
edm shell --environment=force edm install -y -e force-bootstrap click setuptools
edm shell --environment=force-bootstrap
Veryfy that your prompt changes to add "(force)". Verify that your prompt changes to add "(force-bootstrap)".
Install the required packages for the workflow manager:: Installation of the force BDSS runtime environment is performed with the
following command::
cat force-wfmanager/requirements/edm_requirements.txt | grep -v "^#" | while read line; do edm install -y `echo $line | awk '{print $1"=="$2}'`; done python -m ci build-env
Now, install the bdss:: This will create another edm environment called ``force-py27``.
pushd force-bdss To install the workflow manager::
pip install -r requirements/requirements.txt
pip install -e .
popd
the workflow manager::
pushd force-wfmanager pushd force-wfmanager
pip install -r requirements/requirements.txt python -m ci install
pip install -e .
popd popd
and (optional, but recommended), the example plugins:: and (optional, but recommended), the example plugins::
pushd force-bdss-plugin-enthought-example pushd force-bdss-plugin-enthought-example
pip install -r requirements/requirements.txt python -m ci install
pip install -e .
popd popd
Now you can invoke the workflow manager with force_wfmanager, Now you can enter the deployed environment and invoke the programs::
and the bdss with force_bdss.
edm shell -e force-py27
# Invokes the workflow manager UI
force_wfmanager
# Invokes the CLI BDSS evaluator
force_bdss
flake8
coverage
mock
testfixtures
sphinx >= 1.3.1
envisage==4.6.0
click==6.7
six==1.10.0
stevedore==1.24.0
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