From 2bcab1a9715ecdd79be42e3dfd2e60efd38045ae Mon Sep 17 00:00:00 2001 From: Spycner Date: Sat, 29 Nov 2025 14:35:43 +0100 Subject: [PATCH 1/4] docs: remove PyPI badge from README for clarity --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 4637f48..c80a483 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # Brix -[![PyPI version](https://badge.fury.io/py/brix.svg)](https://badge.fury.io/py/brix) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Documentation](https://img.shields.io/badge/docs-mkdocs-blue.svg)](https://spycner.github.io/brix/) From caf7f49e63f52a4f833fdcc0a05788b91a4c1bab Mon Sep 17 00:00:00 2001 From: Spycner Date: Sat, 29 Nov 2025 14:55:40 +0100 Subject: [PATCH 2/4] chore: update dependencies and add end-to-end tests for git installation - Added pyyaml as a dependency in pyproject.toml and uv.lock. - Updated brix version to 1.3.0 in uv.lock. - Introduced end-to-end tests for verifying git source installation of brix using both uv and pip package managers. --- pyproject.toml | 3 +- tests/e2e/test_git_installation.py | 81 ++++++++++++++++++++++++++++++ uv.lock | 4 +- 3 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 tests/e2e/test_git_installation.py diff --git a/pyproject.toml b/pyproject.toml index 49c8ba5..8aecd23 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,6 +10,7 @@ dependencies = [ "httpx>=0.28.1", "pydantic>=2.12.5", "pydantic-settings>=2.12.0", + "pyyaml>=6.0", "questionary>=2.1.1", "typer>=0.20.0", ] @@ -80,7 +81,7 @@ unfixable = ["B"] [tool.ruff.lint.per-file-ignores] "__init__.py" = ["E402"] -"tests/*" = ["S101", "ANN", "D"] +"tests/*" = ["S101", "ANN", "D", "S603", "S607"] [tool.ruff.lint.pydocstyle] convention = "google" diff --git a/tests/e2e/test_git_installation.py b/tests/e2e/test_git_installation.py new file mode 100644 index 0000000..378eff2 --- /dev/null +++ b/tests/e2e/test_git_installation.py @@ -0,0 +1,81 @@ +"""End-to-end tests for git source installation. + +These tests verify that brix can be installed from git source using release tags +with both uv and pip package managers. +""" + +import subprocess + +import pytest + +REPO_URL = "https://github.com/Spycner/brix.git" + + +def get_latest_tag() -> str: + """Get the latest release tag from the remote repository.""" + result = subprocess.run( + ["git", "ls-remote", "--tags", "--refs", REPO_URL], + capture_output=True, + text=True, + check=True, + ) + # Parse tags and sort by semantic version + tags = [line.split("refs/tags/")[1] for line in result.stdout.strip().split("\n") if line] + return sorted(tags, key=lambda t: [int(x) for x in t.lstrip("v").split(".")])[-1] + + +@pytest.fixture(scope="module") +def latest_tag(): + """Fixture to get latest tag once per test module.""" + return get_latest_tag() + + +@pytest.mark.e2e +class TestGitInstallation: + """E2E tests for installing brix from git source.""" + + @pytest.mark.xfail(reason="v1.3.0 missing pyyaml dependency - remove after next release") + def test_uv_install_from_git_tag(self, tmp_path, latest_tag): + """Test installing brix from git with release tag using uv.""" + venv_path = tmp_path / "venv" + git_url = f"git+{REPO_URL}@{latest_tag}" + + # Create venv with uv + result = subprocess.run(["uv", "venv", str(venv_path)], capture_output=True, text=True) + assert result.returncode == 0, f"Failed to create venv: {result.stderr}" + + # Install from git + python_path = venv_path / "bin" / "python" + result = subprocess.run( + ["uv", "pip", "install", git_url, "--python", str(python_path)], + capture_output=True, + text=True, + ) + assert result.returncode == 0, f"Failed to install from git: {result.stderr}" + + # Verify installation + brix_path = venv_path / "bin" / "brix" + result = subprocess.run([str(brix_path), "--version"], capture_output=True, text=True) + assert result.returncode == 0, f"brix --version failed: {result.stderr}" + assert "brix" in result.stdout.lower() or latest_tag.lstrip("v") in result.stdout + + @pytest.mark.xfail(reason="v1.3.0 missing pyyaml dependency - remove after next release") + def test_pip_install_from_git_tag(self, tmp_path, latest_tag): + """Test installing brix from git with release tag using pip.""" + venv_path = tmp_path / "venv_pip" + git_url = f"git+{REPO_URL}@{latest_tag}" + + # Create venv with python + result = subprocess.run(["python3", "-m", "venv", str(venv_path)], capture_output=True, text=True) + assert result.returncode == 0, f"Failed to create venv: {result.stderr}" + + # Install from git using pip + pip_path = venv_path / "bin" / "pip" + result = subprocess.run([str(pip_path), "install", git_url], capture_output=True, text=True) + assert result.returncode == 0, f"Failed to install from git: {result.stderr}" + + # Verify installation + brix_path = venv_path / "bin" / "brix" + result = subprocess.run([str(brix_path), "--version"], capture_output=True, text=True) + assert result.returncode == 0, f"brix --version failed: {result.stderr}" + assert "brix" in result.stdout.lower() or latest_tag.lstrip("v") in result.stdout diff --git a/uv.lock b/uv.lock index 0a5dd5e..282970f 100644 --- a/uv.lock +++ b/uv.lock @@ -93,12 +93,13 @@ wheels = [ [[package]] name = "brix" -version = "1.2.0" +version = "1.3.0" source = { editable = "." } dependencies = [ { name = "httpx" }, { name = "pydantic" }, { name = "pydantic-settings" }, + { name = "pyyaml" }, { name = "questionary" }, { name = "typer" }, ] @@ -139,6 +140,7 @@ requires-dist = [ { name = "mkdocstrings", extras = ["python"], marker = "extra == 'docs'", specifier = ">=0.27" }, { name = "pydantic", specifier = ">=2.12.5" }, { name = "pydantic-settings", specifier = ">=2.12.0" }, + { name = "pyyaml", specifier = ">=6.0" }, { name = "questionary", specifier = ">=2.1.1" }, { name = "typer", specifier = ">=0.20.0" }, ] From 0a0fdaf368f32c49cc3397607a4daedc3622d2bd Mon Sep 17 00:00:00 2001 From: Spycner Date: Sat, 29 Nov 2025 14:57:18 +0100 Subject: [PATCH 3/4] chore: update pre-commit configuration and add GitHub Actions workflow for testing - Removed pytest hook from pre-commit configuration. - Added a new GitHub Actions workflow to run unit, integration, and end-to-end tests across multiple Python versions. --- .github/workflows/tests.yml | 35 +++++++++++++++++++++++++++++++++++ .pre-commit-config.yaml | 7 ------- 2 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..e39bd27 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,35 @@ +name: Tests + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v4 + + - name: Set up Python ${{ matrix.python-version }} + run: uv python install ${{ matrix.python-version }} + + - name: Install dependencies + run: uv sync --dev + + - name: Run unit tests + run: uv run pytest tests/unit -v + + - name: Run integration tests + run: uv run pytest tests/integration -v -m integration + + - name: Run e2e tests + run: uv run pytest tests/e2e -v -m e2e diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ee3ef1c..f9152de 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,13 +15,6 @@ repos: types: [python] pass_filenames: false - - id: pytest - name: pytest - entry: uv run pytest - language: system - types: [python] - pass_filenames: false - - repo: https://github.com/compilerla/conventional-pre-commit rev: v3.4.0 hooks: From 72fff18c705fa34efed8b173fd1283d35a46d47b Mon Sep 17 00:00:00 2001 From: Spycner Date: Sat, 29 Nov 2025 14:59:17 +0100 Subject: [PATCH 4/4] chore: simplify GitHub Actions workflow by removing Python version matrix - Removed the Python version matrix setup from the test job in the GitHub Actions workflow. - Streamlined the workflow by eliminating unnecessary steps related to multiple Python versions. --- .github/workflows/tests.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e39bd27..e67348b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,19 +9,12 @@ on: jobs: test: runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.10", "3.11", "3.12"] - steps: - uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v4 - - name: Set up Python ${{ matrix.python-version }} - run: uv python install ${{ matrix.python-version }} - - name: Install dependencies run: uv sync --dev