-
Notifications
You must be signed in to change notification settings - Fork 123
146 lines (127 loc) · 5.3 KB
/
Copy pathtest_unit.yml
File metadata and controls
146 lines (127 loc) · 5.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# Copyright(C) 2025-2026 Advanced Micro Devices, Inc. All rights reserved.
# SPDX-License-Identifier: MIT
# Fast unit tests that don't require Lemonade server or external dependencies
# These tests run first to provide quick feedback on core SDK components
# Platform: Ubuntu (pure Python tests, no platform-specific code)
name: Unit Tests
on:
workflow_call:
push:
branches: [ main ]
paths:
- 'src/**'
- 'tests/**'
- 'setup.py'
- 'pyproject.toml'
- '.github/workflows/test_unit.yml'
pull_request:
branches: [ main ]
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'src/**'
- 'tests/**'
- 'setup.py'
- 'pyproject.toml'
- '.github/workflows/test_unit.yml'
merge_group:
workflow_dispatch:
# Cancel in-progress runs when a new run is triggered
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
unit-tests:
name: Run Unit Tests
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'ready_for_ci')
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Install dependencies
run: |
# pyfakefs is required by tests/unit/installer/test_uninstall_command.py
# which uses the `fs` fixture to build a fake filesystem for testing
# tiered uninstall logic cross-platform without touching the real FS.
#
# keyring + httpx + respx are required by tests/unit/connections/
# (issue #915). The in-memory keyring backend in tests/conftest.py
# avoids the SecretService daemon prerequisite on Linux runners.
uv pip install --system pytest pytest-cov pytest-asyncio pyfakefs \
keyring httpx respx
uv pip install --system -e ".[api]"
- name: Validate packaging integrity
run: |
echo "=== Validating Packaging Integrity ==="
echo "Checking setup.py packages, __init__.py files, and entry points"
echo ""
pytest tests/unit/test_packaging.py -v --tb=short
echo "✅ Packaging integrity checks passed"
- name: Validate CLI commands (dry-run)
run: |
echo "=== Validating CLI Commands ==="
echo "Testing CLI help and argument parsing (no server required)"
echo ""
# Validate gaia init command parses correctly
gaia init --help
echo "✅ gaia init --help passed"
# Validate other core commands
gaia --help
echo "✅ gaia --help passed"
gaia chat --help
echo "✅ gaia chat --help passed"
gaia prompt --help
echo "✅ gaia prompt --help passed"
gaia sd --help
echo "✅ gaia sd --help passed"
- name: Run unit tests
run: |
echo "=== Running Unit Tests ==="
echo "These are fast tests for core SDK components"
echo ""
pytest tests/unit/ -v --tb=short --cov=src/gaia --cov-report=term-missing
- name: Run DatabaseMixin integration tests
run: |
echo "=== Running DatabaseMixin Integration Tests ==="
echo "Testing DatabaseMixin with Agent class"
echo ""
pytest tests/integration/test_database_mixin_integration.py -v --tb=short
- name: Run DatabaseAgent integration tests
run: |
echo "=== Running DatabaseAgent Integration Tests ==="
echo "Testing DatabaseAgent with auto-registered tools"
echo ""
pytest tests/integration/test_database_agent.py -v --tb=short
- name: Unit test summary
if: always()
run: |
echo ""
echo "=== Test Coverage ==="
echo "CLI Validation (Dry-Run):"
echo " - gaia init --help: Command parsing and argument validation"
echo " - gaia --help: Main CLI entry point"
echo " - gaia chat --help: Chat command validation"
echo " - gaia prompt --help: Prompt command validation"
echo " - gaia sd --help: Image generation command validation"
echo ""
echo "Unit Tests:"
echo " - SDToolsMixin: Stable Diffusion image generation for agents"
echo " - DatabaseMixin: SQLite database access for agents"
echo " - FileWatcher: File system monitoring utilities"
echo " - Testing Utilities: MockLLMProvider, MockVLMClient, fixtures"
echo " - EMR Agent: Medical intake form processing"
echo " - EMR CLI: Command-line interface for EMR agent"
echo " - LLM Client: Language model client utilities"
echo " - ASR: Automatic speech recognition utilities"
echo " - TTS: Text-to-speech utilities"
echo " - InitCommand: gaia init profiles and installer logic"
echo ""
echo "Integration Tests:"
echo " - DatabaseMixin + Agent: Full agent lifecycle with database"
echo " - DatabaseAgent: Auto-registered database tools"