Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Various CI improvements #38

Merged
merged 21 commits into from
Feb 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .ci/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

# Failure is a natural part of life
set -e

# Set up environment variables
export CRAN_MIRROR=http://cran.rstudio.com

# Install conda
wget ${MINICONDA_INSTALLER} -O miniconda.sh;
bash miniconda.sh -b -p ${CONDA_DIR}
echo "export PATH=${CONDA_DIR}/bin:$PATH" >> ${HOME}/.bashrc

hash -r
${CONDA_DIR}/bin/conda config --set always_yes yes --set changeps1 no
${CONDA_DIR}/bin/conda update -q conda
${CONDA_DIR}/bin/conda info -a

# Set up R (gulp)
${CONDA_DIR}/bin/conda install -c r \
r \
r-argparse \
r-jsonlite \
r-r6

# Get packages for testing
${CONDA_DIR}/bin/Rscript -e "install.packages('futile.logger', repos = '${CRAN_MIRROR}')"
${CONDA_DIR}/bin/pip install \
--user \
argparse \
click \
coverage \
codecov \
pycodestyle \
sphinx \
sphinx_autodoc_typehints \
sphinx_rtd_theme \
tabulate
61 changes: 61 additions & 0 deletions .ci/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

# Failure is a natural part of life
set -e

# Set up environment variables
TEST_DATA_DIR=$(pwd)/test_data
MIN_TEST_COVERAGE=20
INTEGRATION_TEST_PACKAGE=argparse

# Make sure we're living in conda land
export PATH="$HOME/miniconda/bin:$PATH"

echo "Checking code for style problems..."

pycodestyle \
--show-pep8 \
--show-source \
--verbose \
$(pwd)

echo "Done checking code for style problems."

echo "Checking docs for problems"

pushd $(pwd)/docs
make html
NUM_WARNINGS=$(cat warnings.txt | wc -l)
if [[ ${NUM_WARNINGS} -ne 0 ]]; then
echo "Found ${NUM_WARNINGS} issues in Sphinx docs in the docs/ folder";
exit ${NUM_WARNINGS};
fi
popd

echo "Done checking docs"

echo "Running unit tests"

coverage run setup.py test
coverage report -m --fail-under=${MIN_TEST_COVERAGE}

echo "Done running unit tests"

echo "Running integration tests"

mkdir -p ${TEST_DATA_DIR}
doppel-describe \
-p ${INTEGRATION_TEST_PACKAGE} \
--language python \
--data-dir ${TEST_DATA_DIR}
doppel-describe \
-p ${INTEGRATION_TEST_PACKAGE} \
--language r \
--data-dir ${TEST_DATA_DIR}
doppel-test \
--files ${TEST_DATA_DIR}/python_argparse.json,${TEST_DATA_DIR}/r_argparse.json \
--errors-allowed 100

echo "Done running integration tests"

# If all is good, we did it!
exit 0
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
omit =
*tests/*
*.eggs/*
*.local/*
3 changes: 3 additions & 0 deletions .pep8speaks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pycodestyle:
ignore:
- E501 # line too long
36 changes: 15 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@

# We never need more than the most recent commit
git:
depth: 1

# Stuff shared by all builds
before_install:
# Enable conda
- wget ${MINICONDA_INSTALLER} -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda info -a
# Set up R (gulp)
- conda install -c r r r-jsonlite r-r6 r-argparse
# Get packages for testing
- Rscript -e "install.packages('futile.logger', repos = 'http://cran.rstudio.com')"
- pip install argparse
- pip install coverage codecov
- .ci/setup.sh
- export PATH=${CONDA_DIR}/bin:$PATH
- echo ${PATH}
- echo ${CONDA_DIR}
- which conda
- which Rscript

# Testing strategy is just "run the code and see if it executes at all"
script:
- echo "unit tests"
- coverage run setup.py test
- echo "integration tests"
- doppel-describe -p argparse --language python --data-dir $(pwd)/test_data
- doppel-describe -p argparse --language r --data-dir $(pwd)/test_data
- doppel-test --files $(pwd)/test_data/python_argparse.json,$(pwd)/test_data/r_argparse.json --errors-allowed 100
- .ci/test.sh

matrix:
include:
Expand All @@ -33,6 +24,7 @@ matrix:
python: 3.5
env:
- MINICONDA_INSTALLER=https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
- CONDA_DIR=/home/travis/miniconda3
install:
- python setup.py install

Expand All @@ -41,6 +33,7 @@ matrix:
python: 3.6
env:
- MINICONDA_INSTALLER=https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
- CONDA_DIR=/home/travis/miniconda3
install:
- python setup.py install

Expand All @@ -52,8 +45,9 @@ matrix:
language: generic
env:
- MINICONDA_INSTALLER=https://repo.continuum.io/miniconda/Miniconda3-4.3.21-MacOSX-x86_64.sh
- CONDA_DIR=/Users/travis/miniconda3
install:
- conda create -q -n testenv python=3.6.1 nose pytest
- /Users/travis/miniconda3/bin/conda create -q -n testenv python=3.6.1 nose pytest
- source activate testenv
- pip install argparse
- python setup.py install
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,4 @@
# -- Options for intersphinx extension ---------------------------------------

# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
intersphinx_mapping = {'https://docs.python.org/': None}
14 changes: 7 additions & 7 deletions doppel/bin/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
help="Name of the python package to test"
)
parser.add_argument(
"--output_dir",
type=str,
default=os.getcwd(),
help="Path to write files to"
"--output_dir",
type=str,
default=os.getcwd(),
help="Path to write files to"
)
parser.add_argument(
"--kwargs-string",
type=str,
help="String value to replace **kwarg"
"--kwargs-string",
type=str,
help="String value to replace **kwarg"
)

# Grab args (store in constants for easier debugging)
Expand Down
2 changes: 1 addition & 1 deletion doppel/describe.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def main(language, pkg_name: str, data_dir: str):

try:
analysis_script = pkg_resources.resource_filename(
'doppel', 'bin/{}'.format(files[language])
'doppel', 'bin/{}'.format(files[language])
)
except KeyError:
raise KeyError("doppel does not know how to test {} packages".format(language))
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pycodestyle]
ignore = E501