Skip to content

Commit 3665e7a

Browse files
authored
Merge pull request #88 from 898803709/add-coverage-ci
lint: update setup-python action version in lint workflow
2 parents f4bef63 + 42cb321 commit 3665e7a

7 files changed

Lines changed: 105 additions & 5 deletions

File tree

.github/workflows/coverage.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: pytest-coverage-comment
2+
on:
3+
pull_request:
4+
branches:
5+
- '*'
6+
permissions:
7+
contents: write
8+
checks: write
9+
pull-requests: write
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5.5.0
19+
with:
20+
python-version-file: '.python-version'
21+
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v5
24+
with:
25+
version: '0.5.4'
26+
enable-cache: true
27+
28+
- name: Install dependencies
29+
run: uv sync
30+
31+
- name: Build coverage file
32+
run: uv run pytest --junitxml=pytest.xml tests | tee pytest-coverage.txt
33+
34+
- name: Pytest coverage comment
35+
uses: MishaKav/pytest-coverage-comment@main
36+
with:
37+
pytest-coverage-path: ./pytest-coverage.txt
38+
junitxml-path: ./pytest.xml

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
uses: actions/checkout@v4
2828

2929
- name: "Set up Python"
30-
uses: actions/setup-python@v5
30+
uses: actions/setup-python@v5.5.0
3131
with:
3232
python-version-file: ".python-version"
3333

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,8 @@ dependencies = [
3636
"types-requests>=2.32.0.20250328",
3737
"types-ujson>=5.10.0.20250326",
3838
]
39+
40+
[dependency-groups]
41+
dev = [
42+
"pytest>=8.3.5",
43+
]

scripts/fix.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
# コードスタイルの自動修正を行います
33

44
cd "$( dirname "$0" )"/..
5-
uv run ruff check --fix-only api
6-
uv run black api
5+
uv run ruff check --fix-only api tests
6+
uv run black api tests

tests/test.py

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/test_add.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import pytest
2+
3+
4+
def add(a: int, b: int) -> int:
5+
return a + b
6+
7+
8+
@pytest.mark.parametrize(
9+
"a, b, expected",
10+
[
11+
(1, 2, 3),
12+
(0, 0, 0),
13+
(-1, 1, 0),
14+
(1000000, 2000000, 3000000),
15+
],
16+
)
17+
def test_normal(a, b, expected):
18+
assert add(a, b) == expected

uv.lock

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)