Skip to content

Commit

Permalink
Fixed no codecov issue (#61)
Browse files Browse the repository at this point in the history
* Fixed no codecov issue
* fixed docs
  • Loading branch information
fpgmaas authored Oct 20, 2022
1 parent 2d3d45a commit 0cd6cd6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
7 changes: 6 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@ repos:
- repo: https://github.com/PyCQA/flake8
rev: "5.0.4"
hooks:
- id: flake8
- id: flake8
- repo: https://github.com/fpgmaas/deptry.git
rev: f80c2263a201b868c469e7cb419a5e9b363dcbf8
hooks:
- id: deptry

6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ git push -u origin main

Finally, install the environment and the pre-commit hooks with

```bash
make install
```
```bash
make install
```

You are now ready to start development on your project! The CI/CD
pipeline will be triggered when you open a pull request, merge to main,
Expand Down
2 changes: 1 addition & 1 deletion hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ def remove_dir(filepath: str) -> None:

if "{{cookiecutter.codecov}}" != "y":
remove_file("codecov.yaml")
remove_file(".github/workflows/validate-codecov-config.yaml")
remove_file(".github/workflows/validate-codecov-config.yml")
10 changes: 10 additions & 0 deletions tests/test_cookiecutter.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def test_using_pytest(cookies, tmp_path):
def test_cicd_contains_artifactory_secrets(cookies, tmp_path):
with run_within_dir(tmp_path):
result = cookies.bake(extra_context={"publish_to": "artifactory"})
assert result.exit_code == 0
for text in ["ARTIFACTORY_URL", "ARTIFACTORY_USERNAME", "ARTIFACTORY_PASSWORD"]:
assert file_contains_text(f"{result.project_path}/.github/workflows/on-release-main.yml", text)
assert file_contains_text(f"{result.project_path}/Makefile", "build-and-publish")
Expand All @@ -54,13 +55,15 @@ def test_cicd_contains_artifactory_secrets(cookies, tmp_path):
def test_cicd_contains_pypi_secrets(cookies, tmp_path):
with run_within_dir(tmp_path):
result = cookies.bake(extra_context={"publish_to": "pypi"})
assert result.exit_code == 0
assert file_contains_text(f"{result.project_path}/.github/workflows/on-release-main.yml", "PYPI_TOKEN")
assert file_contains_text(f"{result.project_path}/Makefile", "build-and-publish")


def test_dont_publish(cookies, tmp_path):
with run_within_dir(tmp_path):
result = cookies.bake(extra_context={"publish_to": "none"})
assert result.exit_code == 0
assert not file_contains_text(
f"{result.project_path}/.github/workflows/on-release-main.yml", "make build-and-publish"
)
Expand All @@ -69,6 +72,7 @@ def test_dont_publish(cookies, tmp_path):
def test_mkdocs(cookies, tmp_path):
with run_within_dir(tmp_path):
result = cookies.bake(extra_context={"mkdocs": "y"})
assert result.exit_code == 0
assert file_contains_text(f"{result.project_path}/.github/workflows/on-release-main.yml", "mkdocs gh-deploy")
assert file_contains_text(f"{result.project_path}/Makefile", "docs:")
assert os.path.isdir(f"{result.project_path}/docs")
Expand All @@ -77,6 +81,7 @@ def test_mkdocs(cookies, tmp_path):
def test_not_mkdocs(cookies, tmp_path):
with run_within_dir(tmp_path):
result = cookies.bake(extra_context={"mkdocs": "n"})
assert result.exit_code == 0
assert not file_contains_text(
f"{result.project_path}/.github/workflows/on-release-main.yml", "mkdocs gh-deploy"
)
Expand All @@ -87,6 +92,7 @@ def test_not_mkdocs(cookies, tmp_path):
def test_tox(cookies, tmp_path):
with run_within_dir(tmp_path):
result = cookies.bake()
assert result.exit_code == 0
assert file_contains_text(
f"{result.project_path}/.github/workflows/on-release-main.yml", "poetry add tox-gh-actions"
)
Expand All @@ -103,24 +109,28 @@ def test_tox(cookies, tmp_path):
def test_dockerfile(cookies, tmp_path):
with run_within_dir(tmp_path):
result = cookies.bake(extra_context={"dockerfile": "y"})
assert result.exit_code == 0
assert os.path.isfile(f"{result.project_path}/Dockerfile")


def test_not_dockerfile(cookies, tmp_path):
with run_within_dir(tmp_path):
result = cookies.bake(extra_context={"dockerfile": "n"})
assert result.exit_code == 0
assert not os.path.isfile(f"{result.project_path}/Dockerfile")


def test_codecov(cookies, tmp_path):
with run_within_dir(tmp_path):
result = cookies.bake()
assert result.exit_code == 0
assert os.path.isfile(f"{result.project_path}/codecov.yaml")
assert os.path.isfile(f"{result.project_path}/.github/workflows/validate-codecov-config.yml")


def test_not_codecov(cookies, tmp_path):
with run_within_dir(tmp_path):
result = cookies.bake(extra_context={"codecov": "n"})
assert result.exit_code == 0
assert not os.path.isfile(f"{result.project_path}/codecov.yaml")
assert not os.path.isfile(f"{result.project_path}/.github/workflows/validate-codecov-config.yml")

0 comments on commit 0cd6cd6

Please sign in to comment.