Skip to content

Commit

Permalink
add github action for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
nreinicke committed Oct 23, 2023
1 parent 0ef6273 commit 2d2b311
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 6 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: test

on:
push:
branches: [main]
pull_request:

jobs:
test:
if: github.event.pull_request.merged == false
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

env:
PYTHON: ${{ matrix.python-version }}

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 package
run: |
pip install ".[dev]"
- name: Run mypy
run: mypy .

- name: Run black
run: |
black nrel tests --check
- name: Python unit tests
run: |
pytest tests/ -v
1 change: 0 additions & 1 deletion nrel/routee/powertrain/estimators/estimator_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from nrel.routee.powertrain.core.features import DataColumn, FeatureSet, TargetSet



class Estimator(ABC):
@classmethod
@abstractmethod
Expand Down
2 changes: 1 addition & 1 deletion nrel/routee/powertrain/estimators/sklearn/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .estimator import SKLearnEstimator
from .estimator import SKLearnEstimator
7 changes: 3 additions & 4 deletions nrel/routee/powertrain/trainers/sklearn_random_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from nrel.routee.powertrain.estimators.onnx import ONNX_INPUT_NAME, ONNXEstimator
from nrel.routee.powertrain.trainers.trainer import Trainer


class RandomForestTrainerOutput(Enum):
ONNX = 1

Expand Down Expand Up @@ -54,11 +55,9 @@ def inner_train(
if self.output_type == RandomForestTrainerOutput.ONNX:
# convert to ONNX
n_features = len(features.columns)
initial_type = [
(ONNX_INPUT_NAME, FloatTensorType([None, n_features]))
]
initial_type = [(ONNX_INPUT_NAME, FloatTensorType([None, n_features]))]
onnx_model = to_onnx(
rf,
rf,
initial_types=initial_type,
)

Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ dev = [
"boxsdk",
"jupyter-book",
"sphinx-book-theme",
"types-PyYAML",
"types-protobuf",
"types-python-dateutil",
"types-redis",
"types-requests"
]

[project.urls]
Expand Down

0 comments on commit 2d2b311

Please sign in to comment.