Skip to content
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
28 changes: 19 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,29 @@ jobs:
with:
fetch-depth: 0

- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"

- name: "Install uv"
uses: astral-sh/setup-uv@v7
with:
version: "0.7.*"
enable-cache: true
cache-dependency-glob: uv.lock

- name: "Get the version"
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> "$GITHUB_OUTPUT"

- name: "Build and push image"
uses: azure/docker-login@v2
with:
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- run: |
docker build -f prod.Dockerfile -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/mpt-tool:${{ steps.get_version.outputs.VERSION }} .
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/mpt-tool:${{ steps.get_version.outputs.VERSION }}
- name: "Build"
run: |
uv version ${{ steps.get_version.outputs.VERSION }}
uv build

- name: "Publish to PyPI"
run: uv publish

dtrack:
uses: softwareone-platform/ops-template/.github/workflows/dependency-track-python-uv.yml@v2
Expand Down
19 changes: 19 additions & 0 deletions mpt_tool/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import typer

app = typer.Typer(help="MPT CLI - Migration tool for extensions.", no_args_is_help=True)


@app.callback()
def callback() -> None:
"""MPT CLI - Migration tool for extensions."""


@app.command()
def migrate() -> None:
"""Run the migration process."""
typer.echo("Hello World!")


def main() -> None:
"""Entry point for the CLI."""
app()
17 changes: 16 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ requires-python = ">=3.12,<4"
readme = "README.md"
license = {text = "Apache-2.0 license"}

dependencies = []
dependencies = [
"typer>=0.9.0",
]

[project.scripts]
mpt-tool = "mpt_tool.cli:main"

[dependency-groups]
dev = [
Expand All @@ -27,6 +32,15 @@ dev = [
]
runtime = []

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build]
include = [
"mpt_tool/**"
]

[tool.pytest.ini_options]
testpaths = "tests"
pythonpath = "."
Expand Down Expand Up @@ -166,3 +180,4 @@ convention = "google"

[tool.mypy]
warn_no_return = false
exclude = ["tests"]
6 changes: 0 additions & 6 deletions tests/dummy_test.py

This file was deleted.

24 changes: 24 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import pytest
from typer.testing import CliRunner

from mpt_tool.cli import app


@pytest.fixture
def runner():
return CliRunner()


def test_migrate_command(runner):
result = runner.invoke(app, ["migrate"])

assert result.exit_code == 0
assert "Hello World!" in result.output


def test_help(runner):
result = runner.invoke(app, ["--help"])

assert result.exit_code == 0
assert "MPT CLI - Migration tool for extensions." in result.output
assert "migrate" in result.output
76 changes: 75 additions & 1 deletion uv.lock

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