-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e54c03
commit 7048ce6
Showing
3 changed files
with
269 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
# This workflow will install Python dependencies, run tests and lint | ||
# with a variety of Python versions For more information see: | ||
# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: Checks | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- '*_rel' | ||
pull_request: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
|
||
defaults: | ||
run: | ||
# important to make sure that all commands on Windows are run using Bash | ||
# -l: login shell, needed when using Conda | ||
shell: bash -l {0} | ||
|
||
env: | ||
PYTEST_ADDOPTS: --color=yes -m 'not fails_in_ci' | ||
|
||
jobs: | ||
|
||
tests: | ||
name: Tests (py${{ matrix.python-version }}/${{ matrix.os }}) | ||
runs-on: ${{ matrix.os-version }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ['3.8', '3.9'] | ||
os: | ||
- linux | ||
- win64 | ||
include: | ||
- os: linux | ||
os-version: ubuntu-20.04 | ||
- os: win64 | ||
os-version: windows-2019 | ||
- python-version: '3.8' | ||
cov-report: true | ||
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 Python package and dependencies | ||
run: | | ||
_pip_install="pip install --progress-bar off" | ||
echo '::group::Output of "pip install" commands' | ||
$_pip_install --upgrade pip wheel setuptools | ||
$_pip_install -r requirements-dev.txt | ||
echo '::endgroup::' | ||
echo '::group::Display installed packages' | ||
conda list | ||
pip list | ||
pip show idaes-pse | ||
echo '::endgroup::' | ||
echo '::group::Output of "idaes get-extensions" command' | ||
idaes get-extensions --verbose | ||
echo '::endgroup::' | ||
- name: Lint with flake8 | ||
if: 'false' | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Add pytest CLI options for coverage | ||
if: matrix.cov-report | ||
run: | | ||
echo PYTEST_ADDOPTS="$PYTEST_ADDOPTS --cov --cov-report=xml" >> "$GITHUB_ENV" | ||
- name: Test with pytest | ||
run: | | ||
pytest | ||
- name: Upload coverage report to Codecov | ||
if: matrix.cov-report | ||
uses: codecov/codecov-action@v2 | ||
with: | ||
fail_ci_if_error: true | ||
|
||
tests-noneditable-install: | ||
name: Tests (non-editable install) (py${{ matrix.python-version }}/${{ matrix.os }}) | ||
runs-on: ${{ matrix.os-version }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ['3.8', '3.9'] | ||
os: | ||
- linux | ||
- win64 | ||
include: | ||
- os: linux | ||
os-version: ubuntu-20.04 | ||
- os: win64 | ||
os-version: windows-2019 | ||
steps: | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
activate-environment: dispatches-env | ||
python-version: ${{ matrix.python-version }} | ||
- name: Define install URL (default) | ||
env: | ||
_repo_full_name: gmlc-dispatches/dispatches | ||
_ref_to_install: main | ||
run: | | ||
echo "_install_url=https://github.com/${_repo_full_name}/archive/${_ref_to_install}.zip" >> $GITHUB_ENV | ||
- name: Define install URL (for PRs) | ||
if: github.event.pull_request | ||
env: | ||
_repo_full_name: ${{ github.event.pull_request.head.repo.full_name }} | ||
_ref_to_install: ${{ github.event.pull_request.head.sha }} | ||
run: | ||
echo "_install_url=https://github.com/${_repo_full_name}/archive/${_ref_to_install}.zip" >> $GITHUB_ENV | ||
- name: Install dispatches and testing dependencies | ||
run: | | ||
echo '::group::Output of "pip install" commands' | ||
pip install --progress-bar off "dispatches @ ${_install_url}" | ||
echo '::endgroup::' | ||
echo '::group::Display installed packages' | ||
pip list | ||
echo '::endgroup::' | ||
- name: Install IDAES extensions | ||
run: | | ||
echo '::group::Output of "idaes get-extensions" command' | ||
idaes get-extensions --verbose | ||
echo '::endgroup::' | ||
- name: Run pytest | ||
run: | | ||
pytest --pyargs dispatches |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
name: TEAL integration | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- '*_rel' | ||
pull_request: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
|
||
defaults: | ||
run: | ||
# important to make sure that all commands on Windows are run using Bash | ||
# -l: login shell, needed when using Conda | ||
shell: bash -l -eo pipefail {0} | ||
|
||
env: | ||
PIP_PROGRESS_BAR: "off" | ||
|
||
jobs: | ||
raven-basic: | ||
name: RAVEN (py${{ matrix.python-version }}/${{ matrix.os }}) | ||
runs-on: ${{ matrix.os-version }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ['3.8'] | ||
os: | ||
- linux | ||
- win64 | ||
include: | ||
- os: linux | ||
os-version: ubuntu-20.04 | ||
raven-supported: false | ||
- os: win64 | ||
os-version: windows-2019 | ||
raven-supported: true | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install Python package and dependencies | ||
run: | | ||
echo '::group::Output of "pip install" commands' | ||
pip install --upgrade wheel setuptools | ||
pip install -r requirements-teal.txt | ||
echo '::endgroup::' | ||
echo '::group::Display installed packages' | ||
pip list | ||
echo '::endgroup::' | ||
- name: Verify that required RAVEN Python APIs can be imported | ||
if: matrix.raven-supported | ||
run: | | ||
python -c " | ||
from ravenframework.utils import xmlUtils; print(xmlUtils) | ||
from ravenframework import ROMExternal; print(ROMExternal) | ||
" | ||
- name: Download and run RAVEN example(s) | ||
if: matrix.raven-supported | ||
env: | ||
raven_repo_clone_url: https://github.com/idaholab/raven | ||
raven_repo_clone_dir: ../raven-repo-clone | ||
raven_repo_workdir: tests/framework/user_guide/ForwardSamplingStrategies | ||
raven_file_path: forwardSamplingGrid.xml | ||
run: | | ||
git clone "$raven_repo_clone_url" "$raven_repo_clone_dir" && cd "$raven_repo_clone_dir" | ||
git log -n 1 | ||
cd "$raven_repo_workdir" | ||
raven_framework "$raven_file_path" | ||
teal: | ||
name: TEAL (py${{ matrix.python-version }}/${{ matrix.os }}) | ||
runs-on: ${{ matrix.os-version }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ['3.8'] | ||
os: | ||
- win64 | ||
include: | ||
- os: win64 | ||
os-version: windows-2019 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install Python package and dependencies | ||
run: | | ||
echo '::group::Output of "pip install" commands' | ||
pip install --upgrade wheel setuptools | ||
pip install -r requirements-teal.txt | ||
echo '::endgroup::' | ||
echo '::group::Display installed packages' | ||
pip list | ||
echo '::endgroup::' | ||
echo '::group::Output of pip freeze' | ||
pip freeze | ||
echo '::endgroup::' | ||
- name: Verify that required TEAL Python APIs can be imported | ||
run: | | ||
python -c " | ||
from TEAL.src import CashFlows; print(CashFlows) | ||
from TEAL.src import main; print(main) | ||
from TEAL.src.Amortization import MACRS; print(MACRS) | ||
" | ||
- name: Install IDAES solvers | ||
run: | | ||
echo '::group::Install IDAES solvers' | ||
idaes get-extensions --verbose | ||
echo '::endgroup::' | ||
echo "$(idaes bin-directory)" >> $GITHUB_PATH | ||
- name: Verify that both python and ipopt are available | ||
run: | | ||
which -a python | ||
which -a ipopt | ||
- name: Download and run TEAL example(s) | ||
env: | ||
teal_repo_clone_url: https://github.com/idaholab/TEAL | ||
teal_repo_clone_dir: ../teal-repo-clone | ||
run: | | ||
git clone "$teal_repo_clone_url" "$teal_repo_clone_dir" && cd "$teal_repo_clone_dir" | ||
git log -n 1 | ||
python tests/PyomoTest.py | ||
- name: Execute Jupyter notebooks with TEAL integration | ||
env: | ||
PYTEST_ADDOPTS: --color=yes -p no:python --nbcheck=exec --durations=0 --cell-timeout=600 | ||
run: | | ||
pytest -k "multiperiod_design_pricetaker_wTEALandSynhist.ipynb" |