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
73 changes: 73 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: CI

on:
pull_request:
branches: [ main ]
push:
branches: [ main ]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black nox
- name: Run lint
run: nox -s lint

tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install nox
- name: Run tests
run: nox -s tests-${{ matrix.python-version }}

smoke-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install nox .
- name: Run smoke tests
run: nox -s smoke_tests

llm-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install nox . google-genai
- name: Run LLM tests
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
run: nox -s llm_tests
11 changes: 3 additions & 8 deletions ads_mcp/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ def _get_login_customer_id() -> str | None:


def _get_googleads_client() -> GoogleAdsClient:
# Use this line if you have a google-ads.yaml file
# client = GoogleAdsClient.load_from_storage()
args = {
"credentials": _create_credentials(),
"developer_token": _get_developer_token(),
Expand All @@ -80,21 +78,18 @@ def _get_googleads_client() -> GoogleAdsClient:
return client


_googleads_client = _get_googleads_client()


def get_googleads_service(serviceName: str) -> GoogleAdsServiceClient:
return _googleads_client.get_service(
return _get_googleads_client().get_service(
serviceName, interceptors=[MCPHeaderInterceptor()]
)


def get_googleads_type(typeName: str):
return _googleads_client.get_type(typeName)
return _get_googleads_client().get_type(typeName)


def get_googleads_client():
return _googleads_client
return _get_googleads_client()


def format_output_value(value: Any) -> Any:
Expand Down
1 change: 0 additions & 1 deletion tests/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class TestUtils(unittest.TestCase):
def test_format_output_value(self):
"""Tests that output values are formatted correctly."""

client = utils.get_googleads_client()
self.assertEqual(
utils.format_output_value(
CampaignStatusEnum.CampaignStatus.ENABLED
Expand Down
Loading