Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only put container docs in if publishing them #114

Merged
merged 2 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion template/README.md.jinja
coretl marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ how it does it, and why people should use it.
Source | <{{repo_url}}>
:---: | :---:
PyPI | `pip install {{distribution_name}}`
{% if sphinx %}Documentation | <{{docs_url}}>{% endif %}
{% if docker %}Docker | `docker run ghcr.io/{{github_org | lower}}/{{repo_name}}:latest`
{% endif %}{% if sphinx %}Documentation | <{{docs_url}}>{% endif %}
Releases | <{{repo_url}}/releases>

This is where you should put some images or code snippets that illustrate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ installed are available on [Github Container Registry](https://ghcr.io/{{github_
To pull the container from github container registry and run:

```
$ docker run ghcr.io/{{github_org}}/{{repo_name}}:main --version
$ docker run ghcr.io/{{github_org | lower}}/{{repo_name}}:latest --version
```

To get a released version, use a numbered release instead of `main`.
To get a released version, use a numbered release instead of `latest`.
8 changes: 8 additions & 0 deletions tests/test_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def make_venv(project_path: Path) -> callable:
def test_template(tmp_path: Path):
copy_project(tmp_path)
run = make_venv(tmp_path)
container_doc = tmp_path / "docs" / "how-to" / "run-container.md"
assert container_doc.exists()
run("./venv/bin/tox -p")
run("./venv/bin/pip install build twine")
run("./venv/bin/python -m build")
Expand All @@ -59,6 +61,12 @@ def test_template_no_docs(tmp_path: Path):
run("./venv/bin/tox -p")


def test_template_no_docker_has_no_docs(tmp_path: Path):
copy_project(tmp_path, docker=False)
container_doc = tmp_path / "docs" / "how-to" / "run-container.md"
assert not container_doc.exists()


def test_bad_repo_name(tmp_path: Path):
with pytest.raises(ValidationError, match="bad:thing is not a valid repo name"):
copy_project(tmp_path, repo_name="bad:thing")
Expand Down
Loading