make a Docker image and publish to GHCR (#15)

pull/16/head
Josh Karpel 3 years ago committed by GitHub
parent bcffbebe45
commit 4438be471f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,139 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
.idea/
.vscode/
docker/
docs/
tests/
*.yaml
*.yml
*.ini

@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

@ -1,23 +0,0 @@
name: publish-to-pypi
on:
release:
types: [published]
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: "3.x"
- uses: snok/install-poetry@v1.1.2
with:
virtualenvs-create: true
- name: Build the package
run: poetry build -vvv
- name: Publish to PyPI
run: poetry publish --username __token__ --password ${{ secrets.pypi_token }}
working-directory: ${{ github.workspace }}

@ -0,0 +1,48 @@
name: publish
on:
release:
types: [published]
jobs:
pypi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
python-version: "3.x"
- uses: snok/install-poetry@v1.1.2
with:
virtualenvs-create: true
- name: Build the package
run: poetry build -vvv
- name: Publish to PyPI
run: poetry publish --username __token__ --password ${{ secrets.pypi_token }}
working-directory: ${{ github.workspace }}
ghcr:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1.1.2
with:
install: true
- name: Log in to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build Image and Push to GHCR
uses: docker/build-push-action@v2.4.0
with:
file: ./docker/Dockerfile
repository: ${{ github.repository }}
pull: true
push: true
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
tags: |
${{ github.repository }}:latest
${{ github.repository }}:${GITHUB_REF##*/}

@ -17,3 +17,9 @@ To see what Spiel can do, install it (`pip install spiel`), then run this comman
```bash
$ spiel demo present
```
## Supported Systems
Spiel relies on underlying terminal mechanisms that are only available on POSIX systems (e.g., Linux and MacOS).
If you're on Windows, you can use the [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/) to run Spiel.

@ -0,0 +1,10 @@
FROM python:3.9
ENV COLORTERM=truecolor
WORKDIR /app
COPY . /app/spiel
RUN pip install --no-cache-dir /app/spiel
CMD ["spiel", "demo", "present"]

@ -0,0 +1,6 @@
set -xeu
TAG="spiel:test"
docker build -f docker/Dockerfile -t "$TAG" .
docker run -it --rm "$TAG" spiel version

6
poetry.lock generated

@ -141,7 +141,7 @@ python-versions = "*"
[[package]]
name = "hypothesis"
version = "6.9.2"
version = "6.10.0"
description = "A library for property-based testing"
category = "dev"
optional = false
@ -830,8 +830,8 @@ filelock = [
{file = "filelock-3.0.12.tar.gz", hash = "sha256:18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59"},
]
hypothesis = [
{file = "hypothesis-6.9.2-py3-none-any.whl", hash = "sha256:2da20c8a7d2185045961186cfe8da8bde795c8ca51ec6f9674da01d568f0da82"},
{file = "hypothesis-6.9.2.tar.gz", hash = "sha256:752ad0b7f26ece6a9f3688b1adfb29740fd631476fc4ea2db33b3d331f01ff2f"},
{file = "hypothesis-6.10.0-py3-none-any.whl", hash = "sha256:1a00a4e3ef40041b2c072deab9c71e307bc5354bb4a102ef22ae8c23fa8b3970"},
{file = "hypothesis-6.10.0.tar.gz", hash = "sha256:9f8c130b1278d30cb3cc64e3a4aacb88c4906155772beed90ce33e06794e1ee0"},
]
idna = [
{file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"},

@ -13,7 +13,7 @@ line_length = 100
[tool.poetry]
name = "spiel"
version = "0.1.1"
version = "0.1.2"
description = "A framework for building and presenting richly-styled presentations in your terminal using Python."
readme="README.md"
homepage="https://github.com/JoshKarpel/spiel"

@ -10,7 +10,7 @@ from rich.syntax import Syntax
from rich.text import Text
from typer import Argument, Exit, Option, Typer
from spiel.constants import PACKAGE_NAME
from spiel.constants import PACKAGE_NAME, __version__
from spiel.help import version_details
from spiel.load import DeckReloader, DeckWatcher, load_deck
from spiel.modes import Mode
@ -95,13 +95,21 @@ def _present(path: Path, mode: Mode, slide: int, profiling: bool, watch: bool, p
@app.command()
def version() -> None:
def version(
plain: bool = Option(
default=False,
help=f"Print only {PACKAGE_NAME}'s version.",
)
) -> None:
"""
Display version and debugging information.
"""
console = Console()
console.print(version_details(console))
if plain:
print(__version__)
else:
console.print(version_details(console))
demo = Typer(

Loading…
Cancel
Save