@@ -2,10 +2,94 @@ name: "Tests"
22
33on : [ pull_request ]
44jobs :
5- lint :
6- name : Tests
5+ setup :
6+ name : Build
77 runs-on : ubuntu-latest
8+ steps :
9+ - name : Checkout repository
10+ uses : actions/checkout@v3
11+ with :
12+ fetch-depth : 2
13+
14+ - run : git checkout HEAD^2
15+
16+ - name : Build Docker image
17+ run : docker compose build
18+
19+ - name : Save Docker image
20+ run : docker compose config --images | xargs -I{} docker save {} -o /tmp/test-image.tar
21+
22+ - name : Upload image artifact
23+ uses : actions/upload-artifact@v4
24+ with :
25+ name : docker-image
26+ path : /tmp/test-image.tar
27+ retention-days : 1
28+
29+ unit :
30+ name : Unit Tests
31+ needs : setup
32+ runs-on : ubuntu-latest
33+ steps :
34+ - name : Checkout repository
35+ uses : actions/checkout@v3
36+ with :
37+ fetch-depth : 2
38+
39+ - run : git checkout HEAD^2
40+
41+ - name : Download image artifact
42+ uses : actions/download-artifact@v4
43+ with :
44+ name : docker-image
45+ path : /tmp
46+
47+ - name : Load Docker image
48+ run : docker load -i /tmp/test-image.tar
49+
50+ - name : Start services
51+ run : |
52+ docker compose up -d
53+ sleep 10
854
55+ - name : Run Unit Tests
56+ run : |
57+ docker compose exec tests vendor/bin/phpunit --configuration phpunit.xml \
58+ tests/Agents/AgentTest.php \
59+ tests/Agents/SchemaTest.php \
60+ tests/Agents/Messages \
61+ tests/Agents/Roles \
62+ tests/Agents/Schema
63+
64+ conversation :
65+ name : " ${{ matrix.provider }} Tests"
66+ needs : setup
67+ runs-on : ubuntu-latest
68+ strategy :
69+ fail-fast : false
70+ matrix :
71+ include :
72+ - provider : OpenAI
73+ test : tests/Agents/Conversation/ConversationOpenAITest.php
74+ env_key : LLM_KEY_OPENAI
75+ - provider : Anthropic
76+ test : tests/Agents/Conversation/ConversationAnthropicTest.php
77+ env_key : LLM_KEY_ANTHROPIC
78+ - provider : Deepseek
79+ test : tests/Agents/Conversation/ConversationDeepseekTest.php
80+ env_key : LLM_KEY_DEEPSEEK
81+ - provider : XAI
82+ test : tests/Agents/Conversation/ConversationXAITest.php
83+ env_key : LLM_KEY_XAI
84+ - provider : Perplexity
85+ test : tests/Agents/Conversation/ConversationPerplexityTest.php
86+ env_key : LLM_KEY_PERPLEXITY
87+ - provider : Gemini
88+ test : tests/Agents/Conversation/ConversationGeminiTest.php
89+ env_key : LLM_KEY_GEMINI
90+ - provider : OpenRouter
91+ test : tests/Agents/Conversation/ConversationOpenRouterTest.php
92+ env_key : LLM_KEY_OPENROUTER
993 steps :
1094 - name : Checkout repository
1195 uses : actions/checkout@v3
1498
1599 - run : git checkout HEAD^2
16100
17- - name : Build
101+ - name : Download image artifact
102+ uses : actions/download-artifact@v4
103+ with :
104+ name : docker-image
105+ path : /tmp
106+
107+ - name : Load Docker image
108+ run : docker load -i /tmp/test-image.tar
109+
110+ - name : Start services
18111 env :
19112 LLM_KEY_ANTHROPIC : ${{ secrets.LLM_KEY_ANTHROPIC }}
20113 LLM_KEY_OPENAI : ${{ secrets.LLM_KEY_OPENAI }}
@@ -24,9 +117,41 @@ jobs:
24117 LLM_KEY_GEMINI : ${{ secrets.LLM_KEY_GEMINI }}
25118 LLM_KEY_OPENROUTER : ${{ secrets.LLM_KEY_OPENROUTER }}
26119 run : |
27- docker compose build
28120 docker compose up -d
29121 sleep 10
30122
31- - name : Run Tests
32- run : docker compose exec tests vendor/bin/phpunit --configuration phpunit.xml tests
123+ - name : Run ${{ matrix.provider }} Tests
124+ run : |
125+ docker compose exec tests vendor/bin/phpunit --configuration phpunit.xml ${{ matrix.test }}
126+
127+ diffcheck :
128+ name : DiffCheck Tests
129+ needs : setup
130+ runs-on : ubuntu-latest
131+ steps :
132+ - name : Checkout repository
133+ uses : actions/checkout@v3
134+ with :
135+ fetch-depth : 2
136+
137+ - run : git checkout HEAD^2
138+
139+ - name : Download image artifact
140+ uses : actions/download-artifact@v4
141+ with :
142+ name : docker-image
143+ path : /tmp
144+
145+ - name : Load Docker image
146+ run : docker load -i /tmp/test-image.tar
147+
148+ - name : Start services
149+ env :
150+ LLM_KEY_OPENAI : ${{ secrets.LLM_KEY_OPENAI }}
151+ run : |
152+ docker compose up -d
153+ sleep 10
154+
155+ - name : Run DiffCheck Tests
156+ run : |
157+ docker compose exec tests vendor/bin/phpunit --configuration phpunit.xml tests/Agents/DiffCheck
0 commit comments