Skip to content

Commit

Permalink
Merge pull request #30 from CDAT/add_coverage
Browse files Browse the repository at this point in the history
Add coverage
  • Loading branch information
muryanto1 committed Sep 10, 2018
2 parents b8e38d6 + e92428e commit efdb052
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 24 deletions.
109 changes: 85 additions & 24 deletions .circleci/config.yml
Expand Up @@ -10,49 +10,50 @@ aliases:
name: setup_miniconda
command: |
mkdir -p workspace
git clone -b validateNightly git@github.com:CDAT/cdat workspace/cdat
git clone -b validateNightly --depth 1 git@github.com:CDAT/cdat workspace/cdat
python workspace/cdat/scripts/install_miniconda.py -w $WORKDIR -p 'py3'
- &create_conda_env
name: create_conda_env
environment:
PKGS: "genutil nose flake8 'numpy=1.14' cdat_info testsrunner"
CHANNELS: "-c cdat/label/nightly -c conda-forge -c cdat"
command: |
export PATH=$WORKDIR/miniconda/bin:$PATH
conda config --set always_yes yes --set changeps1 no
conda update -y -q conda
conda config --set anaconda_upload no
conda create -n py3 -c cdat/label/nightly -c conda-forge -c cdat genutil nose flake8 "numpy=1.14" "python>3" cdat_info testsrunner
conda create -n py2 -c cdat/label/nightly -c conda-forge -c cdat genutil nose flake8 "numpy=1.14" "python<3" cdat_info testsrunner
if [[ $PY_VER = "py2" ]]; then
conda create -n $PY_VER $CHANNELS $PKGS "python<3"
else
conda create -n $PY_VER $CHANNELS $PKGS "python>3" coverage coveralls
fi
- &setup_cdutil
name: setup_cdutil
command: |
export PATH=$WORKDIR/miniconda/bin:$PATH
export UVCDAT_ANONYMOUS_LOG=False
source activate py3
export CDAT_ANONYMOUS_LOG=False
source activate $PY_VER
python setup.py install
source activate py2
rm -rf build
python setup.py install
- &run_cdutil_tests
name: run_cdutil_tests
command: |
export PATH=$WORKDIR/miniconda/bin:$PATH
export UVCDAT_ANONYMOUS_LOG=False
export CDAT_ANONYMOUS_LOG=False
set -e
source activate py2
python run_tests.py -v2 -H
source activate $PY_VER
python run_tests.py -v2 -H $COVERAGE
RESULT=$?
echo "*** py2 test result: "${RESULT}
source activate py3
python run_tests.py -v2 -H
PY3_RESULT=$?
echo "*** py3 test result: "${PY3_RESULT}
RESULT=$(( $RESULT + $PY3_RESULT))
echo "*** $PY_VER test result: "${RESULT}
exit $RESULT
- &conda_upload
name: conda_upload
environment:
CHANNELS: "-c cdat/label/nightly -c conda-forge -c cdat"
command: |
if [[ $CIRCLE_BRANCH != 'master' ]]; then
exit 0
Expand All @@ -68,17 +69,65 @@ aliases:
export VERSION=8.0
export LABEL=nightly
python ./prep_for_build.py -l $VERSION
conda build $PKG_NAME -c cdat/label/nightly -c conda-forge -c cdat
conda build $PKG_NAME -c cdat/label/nightly -c conda-forge -c cdat --python=3.6
if [[ $PY_VER = 'py2' ]]; then
conda build $PKG_NAME $CHANNELS
else
conda build $PKG_NAME $CHANNELS --python=3.6
fi
anaconda -t $CONDA_UPLOAD_TOKEN upload -u $USER -l $LABEL $CONDA_BLD_PATH/$OS/$PKG_NAME-$VERSION.`date +%Y*`0.tar.bz2 --force
- &run_coveralls
name: run_coveralls
command: |
export PATH=$WORKDIR/miniconda/bin:$PATH
source activate $PY_VER
coveralls
source deactivate
jobs:
macos_cdutil:
macos_cdutil_py2:
macos:
xcode: "9.2.0"
environment:
WORKDIR: "workspace/test_macos_cdutil_py2"
OS: "osx-64"
PY_VER: "py2"
steps:
- checkout
- run: *setup_miniconda
- run: *create_conda_env
- run: *setup_cdutil
- run: *run_cdutil_tests
- run: *conda_upload
- store_artifacts:
path: tests_html
destination: tests_html

macos_cdutil_py3:
macos:
xcode: "9.2.0"
environment:
WORKDIR: "workspace/test_macos_cdutil"
WORKDIR: "workspace/test_macos_cdutil_py3"
OS: "osx-64"
PY_VER: "py3"
steps:
- checkout
- run: *setup_miniconda
- run: *create_conda_env
- run: *setup_cdutil
- run: *run_cdutil_tests
- run: *conda_upload
- store_artifacts:
path: tests_html
destination: tests_html

linux_cdutil_py2:
machine:
image: circleci/classic:latest
environment:
WORKDIR: "workspace/test_linux_cdutil_py2"
OS: "linux-64"
PY_VER: "py2"
steps:
- checkout
- run: *setup_miniconda
Expand All @@ -90,18 +139,21 @@ jobs:
path: tests_html
destination: tests_html

linux_cdutil:
linux_cdutil_py3:
machine:
image: circleci/classic:latest
environment:
WORKDIR: "workspace/test_linux_cdutil"
WORKDIR: "workspace/test_linux_cdutil_py3"
OS: "linux-64"
PY_VER: "py3"
COVERAGE: "-c tests/coverage.json"
steps:
- checkout
- run: *setup_miniconda
- run: *create_conda_env
- run: *setup_cdutil
- run: *run_cdutil_tests
- run: *run_coveralls
- run: *conda_upload
- store_artifacts:
path: tests_html
Expand All @@ -111,7 +163,16 @@ workflows:
version: 2
cdutil:
jobs:
- macos_cdutil
- linux_cdutil
- macos_cdutil_py2
- macos_cdutil_py3:
requires:
- macos_cdutil_py2
- linux_cdutil_py2
- linux_cdutil_py3:
requires:
- linux_cdutil_py2





3 changes: 3 additions & 0 deletions tests/coverage.json
@@ -0,0 +1,3 @@
{
"include": ["cdutil"]
}

0 comments on commit efdb052

Please sign in to comment.