Skip to content

Commit

Permalink
Merge pull request #144 from PAICookers/workflow/codecov
Browse files Browse the repository at this point in the history
ci(codecov): rename workflow & add code coverage report
  • Loading branch information
KafCoppelia authored Nov 26, 2024
2 parents 51df95f + e0fbae7 commit d216eaa
Show file tree
Hide file tree
Showing 5 changed files with 172 additions and 46 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Pytest & code coverage

on:
push:
branches:
- master
pull_request:
branches:
- master
- dev
paths:
- "paibox/**"
- "tests/**"
- ".github/workflows/codecov.yml"
- "pyproject.toml"
- "poetry.lock"

permissions:
contents: read

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

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry
uses: abatilo/actions-poetry@v3

- name: Install test dependencies
run: |
poetry install --with test --sync
- name: Run pytest
run: |
poetry run pytest --cov-append --cov-report=xml --junitxml=junit.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true
flags: unittests
token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
fail_ci_if_error: true
flags: unittests
token: ${{ secrets.CODECOV_TOKEN }}
45 changes: 0 additions & 45 deletions .github/workflows/pytest-ci.yml

This file was deleted.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
<a href="https://results.pre-commit.ci/latest/github/PAICookers/PAIBox/master">
<img alt="pre-commit.ci status" src="https://results.pre-commit.ci/badge/github/PAICookers/PAIBox/master.svg">
</a>
<a href="https://codecov.io/gh/PAICookers/PAIBox" >
<img src="https://codecov.io/gh/PAICookers/PAIBox/branch/master/graph/badge.svg?token=949SKVGRMC"/>
</a>
</p>

👉 [用户使用指南](docs/Guide-of-PAIBox.md)
Expand Down
107 changes: 106 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ optional = true
[tool.poetry.group.test.dependencies]
pytest = "^8.0.0"
pytest-md = "^0.2.0"
pytest-cov = "^6.0.0"
paicorelib = {git = "https://github.com/PAICookers/PAIlib.git", rev = "dev"}
orjson = "^3.10.0"

Expand All @@ -59,6 +60,7 @@ orjson = "^3.10.0"
[tool.pytest.ini_options]
minversion = "8.0.0"
testpaths = ["tests"]
addopts = "--cov=paibox --cov-report=term"


[[tool.poetry.source]]
Expand Down

0 comments on commit d216eaa

Please sign in to comment.