Skip to content

Commit 605e68d

Browse files
author
Test
committed
ci: add GROQ_API_KEY for E2E tests
- Add GROQ_API_KEY secret to CI workflow - Fix git config in TestVerifyWithDynamicSelection - Skip E2E tests gracefully when no LLM key available (fork PRs)
1 parent 9bb1b2b commit 605e68d

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
- name: Run tests
2828
env:
2929
CI: true
30+
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
3031
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
3132

3233
- name: Upload coverage

internal/maestro/verifier_selection_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,12 @@ func TestVerifyWithDynamicSelection(t *testing.T) {
195195
err = execCommand(tempDir, "git", "init")
196196
require.NoError(t, err)
197197

198+
err = execCommand(tempDir, "git", "config", "user.name", "test")
199+
require.NoError(t, err)
200+
201+
err = execCommand(tempDir, "git", "config", "user.email", "test@example.com")
202+
require.NoError(t, err)
203+
198204
err = execCommand(tempDir, "git", "add", ".")
199205
require.NoError(t, err)
200206

tests/e2e/cli_workflow_test.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,21 @@ import (
99
"gptcode/internal/modes"
1010
)
1111

12+
func hasLLMConfig() bool {
13+
keys := []string{"GROQ_API_KEY", "OPENAI_API_KEY", "ANTHROPIC_API_KEY", "OPENROUTER_API_KEY"}
14+
for _, key := range keys {
15+
if os.Getenv(key) != "" {
16+
return true
17+
}
18+
}
19+
return false
20+
}
21+
1222
func TestCLIWorkflowPlanImplement(t *testing.T) {
23+
if !hasLLMConfig() {
24+
t.Skip("Skipping: no LLM API key configured")
25+
}
26+
1327
tempDir, err := os.MkdirTemp("", "gptcode_e2e_test")
1428
if err != nil {
1529
t.Fatalf("Failed to create temp directory: %v", err)
@@ -58,7 +72,7 @@ func main() {
5872
break
5973
}
6074
}
61-
75+
6276
if !planFound {
6377
t.Error("No plan file was created")
6478
}
@@ -176,4 +190,4 @@ func TestCLIIntelligenceSystem(t *testing.T) {
176190
t.Logf("Testing model selection for: %s", scenario)
177191
}
178192
})
179-
}
193+
}

0 commit comments

Comments
 (0)