Skip to content

Commit

Permalink
Merge pull request #103 from lemonsaurus/lemon/even_simpler_semantic_…
Browse files Browse the repository at this point in the history
…versioning

lemon/even simpler semantic versioning
  • Loading branch information
lemonsaurus authored Jul 5, 2021
2 parents 5b9d5f9 + 197d6dc commit 9e95dc5
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 40 deletions.
41 changes: 31 additions & 10 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,58 @@ on:
types: [ published ]

jobs:
bump-pyproject-version:
name: Bump pyproject version
runs-on: ubuntu-latest

steps:
- name: Checkout the repo
uses: actions/checkout@v2

- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: "3.9"

- name: Install Poetry
run: pip install poetry

- name: Bump the version
run: poetry version ${{ github.event.release.tag_name }}

- name: Commit the changes
run: |
git add pyproject.toml
git commit -m "Bump version to ${{ github.event.release.tag_name }}"
git push origin main
publish-to-pipy:
name: publish to pypi.org
name: Publish to pypi.org
runs-on: ubuntu-latest
needs: bump-pyproject-version

steps:
- name: Checkout the repo and the submodules.
- name: Checkout the repo.
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.9"

- name: Install Poetry >= 1.2.0a
run: |
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py -O &&
python install-poetry.py --preview
- name: Install poetry
run: pip install poetry

- name: Install dependencies
run: poetry install

- name: Install poetry-version-plugin
run: poetry plugin add poetry-version-plugin

- name: Build and publish to pypi
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} &&
poetry publish --build
build-and-push-on-release:
name: Build and push
name: Build and push to DockerHub
runs-on: ubuntu-latest
needs: publish-to-pipy

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
run: poe lint

- name: Testing
run: poe test
run: poe tests
4 changes: 4 additions & 0 deletions blackbox/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from pathlib import Path
from single_source import get_version

__version__ = get_version(__name__, Path(__file__).parent.parent)
12 changes: 9 additions & 3 deletions blackbox/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,20 @@ def run() -> bool:


@click.command()
@click.option('--config', help="Path to blackbox.yaml file")
@click.option('--init', is_flag=True, help="Generate blackbox.yaml file and exit")
def cli(config, init):
@click.option('--config', help="Path to blackbox.yaml file.")
@click.option('--init', is_flag=True, help="Generate blackbox.yaml file and exit.")
@click.option('--version', is_flag=True, help="Show version and exit.")
def cli(config, init, version):
"""
BLACKBOX
Backup database to external storage system
""" # noqa
if version:
from blackbox import __version__
print(f"Blackbox {__version__}")
exit()

if init:
config_file = Path("blackbox.yaml")
if not config_file.exists():
Expand Down
35 changes: 23 additions & 12 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "blackbox-cli"
packages = [
{ include = "blackbox" }
]
version = "0" # This is not in use. The version is fetched from the most recent git tag.
version = "2.1.5"
description = "Tool for automatic backups of databases"
authors = ["Leon Sandøy <[email protected]>"]
license = "MIT"
Expand Down Expand Up @@ -31,31 +31,31 @@ jinja2 = "^2.11.2"
click = "^7.1.2"
dropbox = "^11.0.0"
pytelegrambotapi = "^3.7.7"
pytest-testdox = "^2.0.1"
single-source = "^0.2.0"
stone = "^3.2.1"

[tool.poetry.dev-dependencies]
flake8 = "^3.9.0"
flake8-isort = "^4.0.0"
pytest = "*"
pytest-cov = "^2.11.1"
pytest-mock = "^3.5.1"
flake8 = "^3.9.0"
flake8-isort = "^4.0.0"
pytest-subprocess = "^1.0.1"
pytest-testdox = "^2.0.1"
poethepoet = "^0.10.0"
requests-mock = "^1.8.0"
win32-setctime = "^1.0.3"
poethepoet = "^0.10.0"

[tool.poetry-version-plugin]
source = "git-tag"

[build-system]
requires = ["poetry-core>=1.1.0"]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.scripts]
blackbox = "blackbox.cli:cli"

# Use 'poetry run poe <taskname>' to run these.
[tool.poe.tasks]
test = "pytest --cov blackbox -vv --cov-report=term-missing ."
tests = "pytest --cov blackbox -vv --cov-report=term-missing ."
lint = "flake8 ."
isort = "isort ."
html = "pytest --cov blackbox --cov-report=html ."
4 changes: 0 additions & 4 deletions setup.py

This file was deleted.

0 comments on commit 9e95dc5

Please sign in to comment.