Skip to content

Commit

Permalink
Add CodeCov to pull requests (#15)
Browse files Browse the repository at this point in the history
Fixed CI to show correct testing coverage

List of changes:
- Added Codecov to pull requests,
- Fixed problem of pytest not showing the correct coverage,
- Refactor CI files,
- Update `README.md` to reflect correct CI file,
- CI-coverage now runs on PR and pushes on main branch.
- Remove un-used configuration from `pyproject.toml`

---------

Co-authored-by: pesap <[email protected]>
  • Loading branch information
daniel-thom and pesap authored Apr 15, 2024
1 parent 5807058 commit b6c6265
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 84 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/main_tests.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: Main - CI
name: CI

on:
schedule:
- cron: "0 0 * * 1-5"
push:
branches:
- main
pull_request:

jobs:
test:
runs-on: ubuntu-latest
pytest:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.11"]
python-version: ["3.11", "3.12"]
os: [ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v4
Expand All @@ -24,9 +24,16 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install ".[dev]"
- name: Run pytest
- name: Run pytest with coverage
run: |
python -m pytest -v --disable-warnings tests
pytest -v --cov --cov-report=xml
- name: codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: infrasys-tests
fail_ci_if_error: false
verbose: true
mypy:
runs-on: ubuntu-latest
name: "mypy"
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/codecov.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/pull_request_tests.yml

This file was deleted.

9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# infrasys

[![Main - CI](https://github.com/NREL/infrasys/workflows/Main%20-%20CI/badge.svg)](https://github.com/NREL/infrasys/actions/workflows/main_tests.yml)
[![CI](https://github.com/NREL/infrasys/workflows/CI/badge.svg)](https://github.com/NREL/infrasys/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/NREL/infrasys/branch/main/graph/badge.svg)](https://codecov.io/gh/NREL/infrasys)

This package implements a data store for components and time series in support of Python-based
Expand Down Expand Up @@ -39,3 +39,10 @@ Please install `pre-commit` so that your code is checked before making commits.
```
$ pre-commit install
```

## License
infrasys is released under a BSD 3-Clause
[License](https://github.com/NREL/infrasys/blob/main/LICENSE.txt).

infrasys was developed under software record SWR-24-42 at the National Renewable Energy Laboratory
([NREL](https://www.nrel.gov)).
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Issues = "https://github.com/NREL/infrasys/issues"
Source = "https://github.com/NREL/infrasys"

[tool.pytest.ini_options]
pythonpath = "src"
minversion = "6.0"
addopts = "-ra"
testpaths = [
Expand Down

0 comments on commit b6c6265

Please sign in to comment.