Skip to content
Open
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
7 changes: 7 additions & 0 deletions .github/workflows/python-cli-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ jobs:
- name: Build package
run: make build-python-cli

- name: Verify wheel install
run: |
python -m venv /tmp/agentcube-cli-smoke
/tmp/agentcube-cli-smoke/bin/python -m pip install --upgrade pip
/tmp/agentcube-cli-smoke/bin/python -m pip install cmd/cli/dist/*.whl
/tmp/agentcube-cli-smoke/bin/kubectl-agentcube --help

- name: Read package version
id: package
working-directory: cmd/cli
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/python-cli-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Python CLI Tests

on:
pull_request:
merge_group:

jobs:
python-cli-tests:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Filter paths
id: changes
uses: dorny/paths-filter@v3
with:
filters: |
cli:
- "cmd/cli/**"
- "Makefile"
- ".github/workflows/python-cli-publish.yml"
- ".github/workflows/python-cli-tests.yml"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we include .github/workflows/python-cli-publish.yml in this filter too? Changes to the release workflow are otherwise allowed to skip the CLI build/install smoke path, so a publish-only workflow edit would not be exercised until tag time.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review @acsoto. I have made the described fix. Please let me know if you want any other specific change :)


- name: Setup Python
if: steps.changes.outputs.cli == 'true'
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install dependencies
if: steps.changes.outputs.cli == 'true'
run: |
python -m pip install --upgrade pip
python -m pip install build pytest setuptools
python -m pip install -e ./cmd/cli

- name: Run unit tests
if: steps.changes.outputs.cli == 'true'
run: python -m pytest cmd/cli/tests -q

- name: Build CLI package
if: steps.changes.outputs.cli == 'true'
run: make build-python-cli

- name: Verify wheel install
if: steps.changes.outputs.cli == 'true'
run: |
python -m venv /tmp/agentcube-cli-smoke
/tmp/agentcube-cli-smoke/bin/python -m pip install --upgrade pip
/tmp/agentcube-cli-smoke/bin/python -m pip install cmd/cli/dist/*.whl
/tmp/agentcube-cli-smoke/bin/kubectl-agentcube --help
13 changes: 13 additions & 0 deletions cmd/cli/agentcube/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright The Volcano Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
8 changes: 6 additions & 2 deletions cmd/cli/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ dev = [
"ruff>=0.1.0",
"mypy>=1.5.0",
"pre-commit>=3.3.0",
"setuptools>=61.0",
]
test = [
"pytest>=7.4.0",
"pytest-asyncio>=0.21.0",
"pytest-cov>=4.1.0",
"pytest-mock>=3.11.0",
"setuptools>=61.0",
"httpx-mock>=0.10.0",
]

Expand All @@ -61,5 +63,7 @@ Issues = "https://github.com/volcano-sh/agentcube/issues"
[project.scripts]
kubectl-agentcube = "agentcube.cli.main:app"

[tool.setuptools]
packages = ["agentcube", "agentcube.cli", "agentcube.runtime", "agentcube.operations", "agentcube.services"]
[tool.setuptools.packages.find]
where = ["."]
include = ["agentcube*"]
namespaces = false
33 changes: 33 additions & 0 deletions cmd/cli/tests/test_packaging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright The Volcano Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from pathlib import Path

from setuptools import find_packages
Comment thread
mrinalchaturvedi27 marked this conversation as resolved.


def test_packages_are_correctly_discovered():
package_root = Path(__file__).resolve().parents[1]
packages = set(find_packages(where=package_root, include=["agentcube*"]))

expected_packages = {
"agentcube",
"agentcube.cli",
"agentcube.runtime",
"agentcube.operations",
"agentcube.services",
"agentcube.models",
}

assert expected_packages.issubset(packages)
Loading