Add regression testing #402
Workflow file for this run
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
name: Automated tests & code coverage | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: False | |
matrix: | |
python-version: ["3.9", "3.10", "3.11"] | |
os: [ubuntu-20.04] #, macos-latest, windows-latest] | |
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 dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e ".[develop]" | |
pip install git+https://github.com/NREL/electrolyzer.git | |
pip install https://github.com/NREL/SEAS/blob/main/SEAS.tar.gz?raw=true | |
# - uses: pre-commit/action@v3.0.0 | |
- name: Run ruff | |
run: | | |
ruff check . | |
# ruff format | |
- name: Run tests and collect coverage | |
run: | | |
# -rA displays the captured output for all tests after they're run | |
# See the docs: https://doc.pytest.org/en/latest/reference/reference.html#command-line-flags | |
pytest -rA tests/ | |
- name: Generate coverage report | |
# Run these tests on unit tests only so that we avoid inflating our code | |
# coverage through the regression tests | |
if: matrix.os == 'ubuntu-20.04' | |
run: | | |
pip install pytest | |
pip install pytest-cov | |
pytest --cov=./ --cov-report=xml tests/ | |
- name: Upload coverage to Codecov | |
if: ${{ env.CODECOV_TOKEN }} # Don't attempt to upload if the codecov token is not configured | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml | |
fail_ci_if_error: true | |