diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index d27fc2e421d5..cdd635137534 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -162,6 +162,37 @@ jobs: name: coverage-${{ env.PKG_NAME }} path: ./python/coverage_${{ env.PKG_NAME }}.xml + test-docker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v5 + with: + enable-cache: true + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Run uv sync + run: | + uv sync --locked --all-extras + working-directory: ./python + - name: Run task + run: | + source ${{ github.workspace }}/python/.venv/bin/activate + poe --directory ./packages/autogen-ext test-docker + working-directory: ./python + + - name: Move coverage file + run: | + mv ./packages/autogen-ext/coverage.xml coverage_autogen-ext-docker.xml + working-directory: ./python + + - name: Upload coverage artifact + uses: actions/upload-artifact@v4 + with: + name: coverage-autogen-ext-docker + path: ./python/coverage_autogen-ext-docker.xml + test-grpc: runs-on: ubuntu-latest steps: @@ -232,7 +263,7 @@ jobs: codecov: runs-on: ubuntu-latest - needs: [test, test-grpc] + needs: [test, test-grpc, test-docker] strategy: matrix: package: @@ -241,6 +272,7 @@ jobs: "./packages/autogen-ext", "./packages/autogen-agentchat", "autogen-ext-grpc", + "autogen-ext-docker", ] steps: - uses: actions/checkout@v4 diff --git a/python/packages/autogen-ext/conftest.py b/python/packages/autogen-ext/conftest.py index a458f1548dda..4b6439923278 100644 --- a/python/packages/autogen-ext/conftest.py +++ b/python/packages/autogen-ext/conftest.py @@ -4,14 +4,25 @@ def pytest_addoption(parser): parser.addoption( "--grpc", action="store_true", default=False, help="run grpc tests" ) + parser.addoption( + "--docker", action="store_true", default=False, help="run docker tests" + ) def pytest_collection_modifyitems(config, items): grpc_option_passed = config.getoption("--grpc") + docker_option_passed = config.getoption("--docker") skip_grpc = pytest.mark.skip(reason="Need --grpc option to run") skip_non_grpc = pytest.mark.skip(reason="Skipped since --grpc passed") + skip_docker = pytest.mark.skip(reason="Need --docker option to run") + skip_non_docker = pytest.mark.skip(reason="Skipped since --docker passed") for item in items: if "grpc" in item.keywords and not grpc_option_passed: item.add_marker(skip_grpc) elif "grpc" not in item.keywords and grpc_option_passed: item.add_marker(skip_non_grpc) + + if "docker" in item.keywords and not docker_option_passed: + item.add_marker(skip_docker) + elif "docker" not in item.keywords and docker_option_passed: + item.add_marker(skip_non_docker) diff --git a/python/packages/autogen-ext/pyproject.toml b/python/packages/autogen-ext/pyproject.toml index 223b61070609..f0f31040c545 100644 --- a/python/packages/autogen-ext/pyproject.toml +++ b/python/packages/autogen-ext/pyproject.toml @@ -184,6 +184,7 @@ minversion = "6.0" testpaths = ["tests"] markers = [ "grpc", + "docker", ] [tool.poe] @@ -196,6 +197,7 @@ test.sequence = [ ] test.default_item_type = "cmd" test-grpc = "pytest -n 1 --cov=src --cov-report=term-missing --cov-report=xml --grpc" +test-docker = "pytest -n 1 --cov=src --cov-report=term-missing --cov-report=xml --docker" test-windows = "pytest -n 1 --cov=src --cov-report=term-missing --cov-report=xml -m 'windows'" mypy = "mypy --config-file ../../pyproject.toml --exclude src/autogen_ext/runtimes/grpc/protos --exclude tests/protos --ignore-missing-imports src tests" diff --git a/python/packages/autogen-ext/tests/code_executors/test_docker_commandline_code_executor.py b/python/packages/autogen-ext/tests/code_executors/test_docker_commandline_code_executor.py index 81c890efa643..744ba08c2db9 100644 --- a/python/packages/autogen-ext/tests/code_executors/test_docker_commandline_code_executor.py +++ b/python/packages/autogen-ext/tests/code_executors/test_docker_commandline_code_executor.py @@ -14,6 +14,8 @@ from autogen_core.code_executor import CodeBlock from autogen_ext.code_executors.docker import DockerCommandLineCodeExecutor +pytestmark = pytest.mark.docker + def docker_tests_enabled() -> bool: if os.environ.get("SKIP_DOCKER", "unset").lower() == "true": diff --git a/python/packages/autogen-ext/tests/code_executors/test_docker_jupyter_code_executor.py b/python/packages/autogen-ext/tests/code_executors/test_docker_jupyter_code_executor.py index ad4460a78469..a6adcfa22684 100644 --- a/python/packages/autogen-ext/tests/code_executors/test_docker_jupyter_code_executor.py +++ b/python/packages/autogen-ext/tests/code_executors/test_docker_jupyter_code_executor.py @@ -13,6 +13,8 @@ DockerJupyterServer, ) +pytestmark = pytest.mark.docker + def docker_tests_enabled() -> bool: if os.environ.get("SKIP_DOCKER", "unset").lower() == "true":