Skip to content

Commit

Permalink
Only put container docs in if publishing them
Browse files Browse the repository at this point in the history
Add link to README too
  • Loading branch information
coretl committed Feb 16, 2024
1 parent a43b9b4 commit 619c8c2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions template/README.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ how it does it, and why people should use it.
Source | <{{repo_url}}>
:---: | :---:
PyPI | `pip install {{distribution_name}}`
{% if docker %}Docker | `docker run ghcr.io/{{github_org | lower}}/{{repo_name}}:latest`{% endif %}
{% if sphinx %}Documentation | <{{docs_url}}>{% endif %}
Releases | <{{repo_url}}/releases>

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

0 comments on commit 619c8c2

Please sign in to comment.