Skip to content

Commit

Permalink
Merge pull request #71 from kaklise/master
Browse files Browse the repository at this point in the history
Added GitHub actions
  • Loading branch information
kaklise authored Jun 17, 2021
2 parents 39543fa + bad9312 commit d9f2a01
Show file tree
Hide file tree
Showing 12 changed files with 322 additions and 5 deletions.
241 changes: 241 additions & 0 deletions .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: build

on:
push:
branches: [ master]
pull_request:
branches: [ master]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python --version
python -m pip install --upgrade pip
pip install wheel
pip install -r requirements.txt
- name: Build wheel
run: |
python setup.py bdist_wheel
ls dist/*
- name: Save wheel
uses: actions/upload-artifact@v2
with:
name: wheel
path: dist/pecos*.whl

test:
name: Import test
needs: build
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
os: [windows-latest, macOS-latest, ubuntu-latest]
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Download wheel
uses: actions/download-artifact@v2
with:
name: wheel
- name: Install pecos
run: |
python -m pip install --upgrade pip
pip install wheel
pip install --find-links=. pecos
- name: Import test
run: |
python -c "import pecos"
windows:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
os: [windows-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python --version
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install coveralls
python setup.py develop
- name: Run Tests
run: |
coverage erase
coverage run --context=${{ matrix.os }}.py${{ matrix.python-version }} --source=pecos --omit="*/tests/*" -m nose -v --nologcapture --with-doctest --traverse-namespace pecos
env:
COVERAGE_FILE: .coverage.${{ matrix.python-version }}.${{ matrix.os }}
- name: Save coverage
uses: actions/upload-artifact@v2
# if: ${{ matrix.os != 'windows-latest' }}
with:
name: coverage
path: .coverage.${{ matrix.python-version }}.${{ matrix.os }}

macOS:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
os: [macOS-latest]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python --version
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install coveralls
python setup.py develop
- name: Run Tests
run: |
coverage erase
coverage run --context=${{ matrix.os }}.py${{ matrix.python-version }} --source=pecos --omit="*/tests/*" -m nose -v --nologcapture --with-doctest --traverse-namespace --doctest-extension=.rst documentation/*.rst pecos
env:
COVERAGE_FILE: .coverage.${{ matrix.python-version }}.${{ matrix.os }}
- name: Save coverage
uses: actions/upload-artifact@v2
# if: ${{ matrix.os != 'windows-latest' }}
with:
name: coverage
path: .coverage.${{ matrix.python-version }}.${{ matrix.os }}

linux:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Setup conda
uses: s-weigand/setup-conda@v1
with:
update-conda: true
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
conda config --set always_yes yes --set changeps1 no
python --version
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install coveralls
python setup.py develop
- name: Run Tests
run: |
coverage erase
coverage run --context=${{ matrix.os }}.py${{ matrix.python-version }} --source=pecos --omit="*/tests/*" -m nose -v --nologcapture --with-doctest --doctest-extension=.rst --traverse-namespace documentation/*.rst pecos
env:
COVERAGE_FILE: .coverage.${{ matrix.python-version }}.${{ matrix.os }}
- name: Save coverage
uses: actions/upload-artifact@v2
# if: ${{ matrix.os != 'windows-latest' }}
with:
name: coverage
path: .coverage.${{ matrix.python-version }}.${{ matrix.os }}

coverage:
needs: [ windows, macOS, linux ]
runs-on: windows-latest
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/checkout@v2
- name: Install coverage
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install coveralls
python setup.py develop
- name: Download coverage artifacts from test matrix
uses: actions/download-artifact@v2
with:
name: coverage
- name: Setup coverage and combine reports
run: |
echo "[paths]" > .coveragerc
echo "source = " >> .coveragerc
echo " pecos/" >> .coveragerc
echo " pecos\\" >> .coveragerc
echo " D:\\a\\pecos\\pecos\\pecos" >> .coveragerc
echo " /home/runner/work/pecos/pecos/pecos" >> .coveragerc
echo " /Users/runner/work/pecos/pecos/pecos" >> .coveragerc
coverage combine
- name: Create coverage report
run: |
coverage report
coverage json --pretty-print
coverage html --show-contexts
- name: Save coverage JSON
uses: actions/upload-artifact@v2
with:
name: coverage
path: coverage.json
- name: Save coverage html
uses: actions/upload-artifact@v2
with:
name: coverage
path: htmlcov

coveralls:
needs: [ windows, macOS, linux ]
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/checkout@v2
- name: Install coverage
run: |
python -m pip install --upgrade pip
pip install coveralls
pip install -r requirements.txt
python setup.py develop
- name: Download coverage artifacts from test matrix
uses: actions/download-artifact@v2
with:
name: coverage
- name: Setup coverage and combine reports
run: |
echo "[paths]" > .coveragerc
echo "source = " >> .coveragerc
echo " pecos/" >> .coveragerc
echo " pecos\\" >> .coveragerc
echo " D:\\a\\pecos\\pecos\\pecos" >> .coveragerc
echo " /home/runner/work/pecos/pecos/pecos" >> .coveragerc
echo " /Users/runner/work/pecos/pecos/pecos" >> .coveragerc
coverage combine
- name: Push to coveralls
run: |
coveralls --service=github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/quick_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: quick-check

on:
push:
branches:
- '**'
pull_request:
branches:
- '**'

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install packages
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install --upgrade coverage nose
python setup.py develop
- name: Run tests
run: |
nosetests -v --nologcapture --with-doctest --with-coverage --cover-package=pecos --cover-min-percentage=70 pecos
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ matrix:
services:
- xvfb
sudo: true
- python: 3.9
dist: xenial
env: CONDA_ENV=py39
services:
- xvfb
sudo: true

addons:
apt:
Expand Down
17 changes: 17 additions & 0 deletions ci/requirements-py39.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: test_env
channels:
- defaults
- http://conda.anaconda.org/pvlib
dependencies:
- python=3.9
- pandas
- numpy
- jinja2
- matplotlib
- nose
- pvlib
- plotly
- ephem
- sqlalchemy
- pip:
- coveralls
2 changes: 1 addition & 1 deletion documentation/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
#html_theme = 'sphinxdoc'

def setup(app):
app.add_stylesheet( "pecos.css" )
app.add_css_file( "pecos.css" )

on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only import and set the theme if we're building docs locally
Expand Down
2 changes: 1 addition & 1 deletion documentation/installation.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Installation
======================================

Pecos requires Python (tested on 3.6, 3.7, and 3.8) along with several Python
Pecos requires Python (tested on 3.6, 3.7, 3.8, and 3.9) along with several Python
package dependencies. Information on installing and using Python can be found at
https://www.python.org/. Python distributions, such as Anaconda,
are recommended to manage the Python interface.
Expand Down
2 changes: 2 additions & 0 deletions documentation/whatsnew.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Release Notes
================

.. include:: whatsnew/v0.2.1.rst

.. include:: whatsnew/v0.2.0.rst

.. include:: whatsnew/v0.1.9.rst
Expand Down
2 changes: 1 addition & 1 deletion documentation/whatsnew/v0.2.0.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. _whatsnew_020:

v0.2.0 (master)
v0.2.0 (March 5, 2021)
--------------------------

* Replaced the use of Excel files in examples/tests with CSV files. The Excel files were causing test failures.
Expand Down
8 changes: 8 additions & 0 deletions documentation/whatsnew/v0.2.1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. _whatsnew_021:

v0.2.1 (master)
--------------------------

* Minor updates for testing and documentation
* Added GitHub Actions and Python 3.9 tests

2 changes: 1 addition & 1 deletion pecos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from pecos import utils
from pecos import pv

__version__ = '0.2.0'
__version__ = '0.2.1'

__copyright__ = """Copyright 2016 National Technology & Engineering
Solutions of Sandia, LLC (NTESS). Under the terms of Contract
Expand Down
2 changes: 1 addition & 1 deletion pecos/monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ def check_custom_streaming(self, quality_control_func, window, key=None,
# still expects pandas DataFrames and Series in the user defined quality
# control function to keep data types consitent on the user side.
np_mask = pd.DataFrame(True, index=self.df.index, columns=self.df.columns).values
np_data = df.values.astype('Float64')
np_data = df.values.astype('float64')

ti = df.index.get_loc(df.index[0]+history_window)

Expand Down
12 changes: 12 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Required
pandas
numpy
jinja2
matplotlib

# Optional
nose
pvlib
plotly
ephem
sqlalchemy

0 comments on commit d9f2a01

Please sign in to comment.