Skip to content

Commit 00d519a

Browse files
edenreichclaude
andauthored
ci: Add CI workflow for automated testing and linting (#9)
## Summary Add standard Golang CI to ensure code quality. --------- Signed-off-by: Eden Reich <[email protected]> Co-authored-by: Claude <[email protected]>
1 parent 9ea63ad commit 00d519a

File tree

4 files changed

+61
-56
lines changed

4 files changed

+61
-56
lines changed

.github/workflows/ci.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- '**/*.md'
9+
pull_request:
10+
branches:
11+
- main
12+
paths-ignore:
13+
- '**/*.md'
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
ci:
21+
runs-on: ubuntu-24.04
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/[email protected]
26+
27+
- name: Install Flox
28+
uses: flox/install-flox-action@v2
29+
30+
- name: Activate Flox environment
31+
run: flox activate
32+
33+
- name: Run mod tidy
34+
run: flox activate -- task mod:tidy
35+
36+
- name: Run linter
37+
run: flox activate -- task lint
38+
39+
- name: Run vet
40+
run: flox activate -- task vet
41+
42+
- name: Build project
43+
run: flox activate -- task build
44+
45+
- name: Run tests
46+
run: flox activate -- task test
47+
48+
- name: Clean build artifacts
49+
run: flox activate -- task clean
50+
51+
- name: Check for dirty project
52+
run: |
53+
if [ -n "$(git status --porcelain)" ]; then
54+
echo "Project has uncommitted changes:"
55+
git status --porcelain
56+
git diff
57+
exit 1
58+
fi
59+
echo "Project is clean"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
**/.env
22
/.task
33
/dist
4+
flox.*-linux.*

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[![Go Version](https://img.shields.io/badge/Go-1.24+-00ADD8?style=for-the-badge&logo=go&logoColor=white)](https://golang.org/)
66
[![License](https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge)](LICENSE)
7-
[![Build Status](https://img.shields.io/github/actions/workflow/status/inference-gateway/cli/release.yml?style=for-the-badge&logo=github)](https://github.com/inference-gateway/cli/actions)
7+
[![Build Status](https://img.shields.io/github/actions/workflow/status/inference-gateway/cli/ci.yml?style=for-the-badge&logo=github)](https://github.com/inference-gateway/cli/actions)
88
[![Release](https://img.shields.io/github/v/release/inference-gateway/cli?style=for-the-badge&logo=github)](https://github.com/inference-gateway/cli/releases)
99
[![Go Report Card](https://goreportcard.com/badge/github.com/inference-gateway/cli?style=for-the-badge)](https://goreportcard.com/report/github.com/inference-gateway/cli)
1010

cmd/chat.go

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -598,63 +598,8 @@ func stopSpinner(result *streamingResult) {
598598
result.mu.Unlock()
599599
}
600600

601-
func executeToolCalls(cfg *config.Config, activeToolCalls map[int]*sdk.ChatCompletionMessageToolCall) []sdk.ChatCompletionMessageToolCall {
602-
var toolCalls []sdk.ChatCompletionMessageToolCall
603-
604-
for _, toolCall := range activeToolCalls {
605-
if toolCall.Function.Name != "" {
606-
fmt.Printf(" with arguments: %s\n", toolCall.Function.Arguments)
607-
608-
toolResult, err := executeToolCall(cfg, toolCall.Function.Name, toolCall.Function.Arguments)
609-
if err != nil {
610-
fmt.Printf("❌ Tool execution failed: %v\n", err)
611-
} else {
612-
fmt.Printf("✅ Tool result:\n%s\n", toolResult)
613-
}
614-
615-
toolCalls = append(toolCalls, *toolCall)
616-
}
617-
}
618-
619-
return toolCalls
620-
}
621-
622-
func executeRemainingToolCalls(cfg *config.Config, activeToolCalls map[int]*sdk.ChatCompletionMessageToolCall, processedToolCalls []sdk.ChatCompletionMessageToolCall) []sdk.ChatCompletionMessageToolCall {
623-
finalToolCalls := make([]sdk.ChatCompletionMessageToolCall, len(processedToolCalls))
624-
copy(finalToolCalls, processedToolCalls)
625-
626-
for _, toolCall := range activeToolCalls {
627-
if toolCall.Function.Name == "" {
628-
continue
629-
}
630-
631-
if isToolCallProcessed(toolCall.Id, processedToolCalls) {
632-
continue
633-
}
634-
635-
fmt.Printf(" with arguments: %s\n", toolCall.Function.Arguments)
636-
637-
toolResult, err := executeToolCall(cfg, toolCall.Function.Name, toolCall.Function.Arguments)
638-
if err != nil {
639-
fmt.Printf("❌ Tool execution failed: %v\n", err)
640-
} else {
641-
fmt.Printf("✅ Tool result:\n%s\n", toolResult)
642-
}
643-
644-
finalToolCalls = append(finalToolCalls, *toolCall)
645-
}
646601

647-
return finalToolCalls
648-
}
649602

650-
func isToolCallProcessed(toolCallId string, processedToolCalls []sdk.ChatCompletionMessageToolCall) bool {
651-
for _, processedCall := range processedToolCalls {
652-
if processedCall.Id == toolCallId {
653-
return true
654-
}
655-
}
656-
return false
657-
}
658603

659604
func showSpinner(active *bool, mu *sync.Mutex) {
660605
spinner := []string{"⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"}

0 commit comments

Comments
 (0)