Skip to content

Commit 2acad24

Browse files
committed
build(ci/cd): try to repair CI/CD codecov
1 parent 021915f commit 2acad24

File tree

4 files changed

+38
-30
lines changed

4 files changed

+38
-30
lines changed

.github/workflows/develop.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@ on:
88

99
permissions:
1010
contents: read
11-
id-token: write
11+
checks: write
12+
pull-requests: write
1213

1314
jobs:
14-
test-and-lint:
15+
development:
1516
name: Test & Lint
1617
runs-on: ubuntu-latest
17-
strategy:
18-
fail-fast: false
19-
matrix:
20-
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
2118

2219
steps:
2320
- name: Checkout
@@ -39,14 +36,18 @@ jobs:
3936
- name: Sync dev dependencies
4037
run: uv sync --locked --all-extras --dev --no-progress -q
4138

42-
- name: Run tests
43-
run: uv run pytest
44-
4539
- name: Lint / Format / Type-check
4640
run: uv run lint
4741

48-
- name: Upload test results to Codecov
49-
if: ${{ !cancelled() }}
50-
uses: codecov/test-results-action@v1
42+
- name: Run tests
43+
run: uv run pytest
44+
45+
- name: Upload coverage to Codecov
46+
uses: codecov/codecov-action@v4
5147
with:
52-
token: ${{ secrets.CODECOV_TOKEN }}
48+
files: ./coverage.xml
49+
slug: Athroniaeth/fastapi-api-key
50+
fail_ci_if_error: true
51+
env:
52+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
53+

.github/workflows/main.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,21 @@ jobs:
4343
- name: Sync dev dependencies
4444
run: uv sync --locked --all-extras --dev --no-progress -q
4545

46+
- name: Lint / Format / Type-check
47+
run: uv run lint
48+
4649
- name: Run tests
4750
run: uv run pytest
4851

49-
- name: Lint / Format / Type-check
50-
run: uv run lint
52+
- name: Upload coverage to Codecov
53+
uses: codecov/codecov-action@v4
54+
with:
55+
files: ./coverage.xml
56+
slug: Athroniaeth/fastapi-api-key
57+
fail_ci_if_error: true
58+
env:
59+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
60+
5161

5262
publish:
5363
name: Publish to PyPI & Create GitHub Release
@@ -75,15 +85,18 @@ jobs:
7585
uv run lint
7686
uv run pytest
7787
88+
- name: Upload coverage to Codecov
89+
uses: codecov/codecov-action@v4
90+
with:
91+
files: ./coverage.xml
92+
slug: Athroniaeth/fastapi-api-key
93+
fail_ci_if_error: true
94+
env:
95+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
96+
7897
- name: Build sdist & wheel with uv
7998
run: uv build
8099

81-
- name: Upload test results to Codecov
82-
if: ${{ !cancelled() }}
83-
uses: codecov/test-results-action@v1
84-
with:
85-
token: ${{ secrets.CODECOV_TOKEN }}
86-
87100
# Publication via OIDC (Trusted Publisher) – no secret required on GitHub side
88101
- name: Publish to PyPI
89102
env:

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ addopts = [
117117
"--cov-report=xml",
118118
"--doctest-modules",
119119
"--cov-report=html",
120+
"--cov-branch",
121+
"--cov-report=xml:coverage.xml",
120122
"--cov-report=term-missing",
121123
"--junitxml=junit.xml",
122124
"-o junit_family=legacy"
@@ -135,3 +137,4 @@ testpaths = ["src", "tests"]
135137

136138
[tool.coverage.run]
137139
omit = ["src/fastapi_api_key/__init__.py"]
140+
branch = true

tests/test_regression.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@
1717
)
1818

1919

20-
def test_version():
21-
"""Ensure the version attribute is present and correctly formatted."""
22-
module = importlib.import_module("fastapi_api_key")
23-
24-
assert hasattr(module, "__version__")
25-
assert isinstance(module.__version__, str)
26-
assert module.__version__ == "0.5.0" # Replace with the expected version
27-
28-
2920
@pytest.mark.parametrize(
3021
[
3122
"module_path",

0 commit comments

Comments
 (0)