Skip to content

Commit 8d80628

Browse files
Validate codecov (#57)
* Added codecov validation Co-authored-by: Mathieu Kniewallner <[email protected]>
1 parent 53dae21 commit 8d80628

File tree

4 files changed

+25
-4
lines changed

4 files changed

+25
-4
lines changed

hooks/post_gen_project.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ def remove_dir(filepath: str) -> None:
2727

2828
if "{{cookiecutter.codecov}}" != "y":
2929
remove_file("codecov.yaml")
30+
remove_file(".github/workflows/validate-codecov-config.yaml")

tests/test_cookiecutter.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,15 @@ def test_not_dockerfile(cookies, tmp_path):
114114
assert not os.path.isfile(f"{result.project_path}/Dockerfile")
115115

116116

117+
def test_codecov(cookies, tmp_path):
118+
with run_within_dir(tmp_path):
119+
result = cookies.bake()
120+
assert os.path.isfile(f"{result.project_path}/codecov.yaml")
121+
assert os.path.isfile(f"{result.project_path}/.github/workflows/validate-codecov-config.yml")
122+
123+
117124
def test_not_codecov(cookies, tmp_path):
118125
with run_within_dir(tmp_path):
119126
result = cookies.bake(extra_context={"codecov": "n"})
120127
assert not os.path.isfile(f"{result.project_path}/codecov.yaml")
128+
assert not os.path.isfile(f"{result.project_path}/.github/workflows/validate-codecov-config.yml")
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: validate-codecov-config
2+
3+
on:
4+
pull_request:
5+
paths: [codecov.yaml]
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
validate-codecov-config:
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Validate codecov configuration
15+
run: curl -sSL --fail-with-body --data-binary @codecov.yaml https://codecov.io/validate

{{cookiecutter.project_name}}/codecov.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,4 @@ coverage:
66
project:
77
default:
88
target: 90%
9-
threshold: .5%
10-
11-
ignore:
12-
- "some_path"
9+
threshold: 0.5%

0 commit comments

Comments
 (0)