Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test coverage to linux/osx GitHub actions #1359

Merged
merged 15 commits into from Mar 26, 2020
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/mpi_matrix_test.yml
Expand Up @@ -64,7 +64,7 @@ jobs:
export PATH=$PATH:$GAMS_DIR
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GAMS_DIR
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$GAMS_DIR
cd gams/*/apifiles/Python/
cd $GAMS_DIR/apifiles/Python/
py_ver=$(python -c 'import sys;print("%s%s" % sys.version_info[:2])')
gams_ver=api
for ver in api_*; do
Expand Down Expand Up @@ -125,4 +125,5 @@ jobs:
run: |
find . -maxdepth 10 -name ".cov*"
coverage combine
coverage report
bash <(curl -s https://codecov.io/bash) -X gcov
60 changes: 46 additions & 14 deletions .github/workflows/unix_python_matrix_test.yml
Expand Up @@ -26,7 +26,8 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install Pyomo dependencies

- name: Install dependencies
run: |
if hash brew; then
echo "Install pre-dependencies for pyodbc..."
Expand All @@ -36,15 +37,19 @@ jobs:
brew link --overwrite gcc
brew list pkg-config || brew install pkg-config
brew list unixodbc || brew install unixodbc
brew list freetds || brew install freetds
brew list freetds || brew install freetds
fi
echo ""
echo "Upgrade pip..."
echo ""
python -m pip install --upgrade pip
echo ""
echo "Install Pyomo dependencies..."
echo ""
# Note: pandas 1.0.3 causes gams 29.1.0 import to fail in python 3.8
pip install cython numpy scipy ipython openpyxl sympy pyyaml pyodbc networkx xlrd pandas matplotlib dill seaborn pymysql pyro4 pint pathos
pip install cython numpy scipy ipython openpyxl sympy pyyaml \
pyodbc networkx xlrd pandas matplotlib dill seaborn pymysql \
pyro4 pint pathos coverage nose
echo ""
echo "Install CPLEX Community Edition..."
echo ""
Expand All @@ -59,16 +64,27 @@ jobs:
fi
chmod +x gams_installer.exe
./gams_installer.exe -q -d gams
cd gams/*/apifiles/Python/
GAMS_DIR=`ls -d1 $(pwd)/gams/*/ | head -1`
export PATH=$PATH:$GAMS_DIR
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GAMS_DIR
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$GAMS_DIR
cd $GAMS_DIR/apifiles/Python/
py_ver=$(python -c 'import sys;print("%s%s" % sys.version_info[:2])')
gams_ver=api
for ver in api_*; do
if test ${ver:4} -le $py_ver; then
gams_ver=$ver
fi
fi
done
cd $gams_ver
python setup.py -q install -noCheck
echo ""
echo "Pass key environment variables to subsequent steps"
echo ""
echo "::set-env name=PATH::$PATH"
echo "::set-env name=LD_LIBRARY_PATH::$LD_LIBRARY_PATH"
echo "::set-env name=DYLD_LIBRARY_PATH::$DYLD_LIBRARY_PATH"

- name: Install Pyomo and extensions
run: |
echo "Clone Pyomo-model-libraries..."
Expand All @@ -81,17 +97,33 @@ jobs:
echo "Install Pyomo..."
echo ""
python setup.py develop
echo ""
echo "Download and install extensions..."
echo ""

- name: Set up coverage tracking
run: |
WORKSPACE=`pwd`
COVERAGE_PROCESS_START=${WORKSPACE}/coveragerc
echo "::set-env name=COVERAGE_PROCESS_START::$COVERAGE_PROCESS_START"
cp ${WORKSPACE}/.coveragerc ${COVERAGE_PROCESS_START}
echo "data_file=${WORKSPACE}/.coverage" >> ${COVERAGE_PROCESS_START}
SITE_PACKAGES=`python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"`
if [ -z "$DISABLE_COVERAGE" ]; then
echo 'import coverage; coverage.process_startup()' \
> ${SITE_PACKAGES}/run_coverage_at_startup.pth
fi

- name: Download and install extensions
run: |
pyomo download-extensions
pyomo build-extensions
- name: Run nightly tests with test.pyomo

- name: Run Pyomo tests
run: |
echo "Run test.pyomo..."
GAMS_DIR=`ls -d1 $(pwd)/gams/*/ | head -1`
export PATH=$PATH:$GAMS_DIR
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GAMS_DIR
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$GAMS_DIR
pip install nose
test.pyomo -v --cat="nightly" pyomo `pwd`/pyomo-model-libraries

- name: Upload coverage to codecov
run: |
find . -maxdepth 10 -name ".cov*"
coverage combine
coverage report
bash <(curl -s https://codecov.io/bash) -X gcov