Skip to content

Commit 615b3ce

Browse files
committed
Initial commit
0 parents  commit 615b3ce

19 files changed

Lines changed: 2232 additions & 0 deletions

File tree

.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# API KEYS
2+
# DEEPSEEK_API_KEY=sk-xxx
3+
# ALIYUN_API_KEY=sk-xxx
4+
# OPENAI_API_KEY=sk-xxx
5+
# ANTHROPIC_API_KEY=sk-xxx

.github/workflows/release.yml

Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
paths-ignore:
7+
- '**.md'
8+
- 'docs/**'
9+
- 'LICENSE'
10+
- '.gitignore'
11+
- '*.txt'
12+
tags: [ 'v*' ]
13+
pull_request:
14+
branches: [ main, master ]
15+
paths-ignore:
16+
- '**.md'
17+
- 'docs/**'
18+
- 'LICENSE'
19+
- '.gitignore'
20+
- '*.txt'
21+
22+
env:
23+
GO_VERSION: '1.23'
24+
BINARY_NAME: 'llm-caller'
25+
CGO_ENABLED: '0'
26+
27+
jobs:
28+
test:
29+
name: Test
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
35+
- name: Set up Go
36+
uses: actions/setup-go@v5
37+
with:
38+
go-version: ${{ env.GO_VERSION }}
39+
40+
- name: Cache Go modules
41+
uses: actions/cache@v4
42+
with:
43+
path: |
44+
~/.cache/go-build
45+
~/go/pkg/mod
46+
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}
47+
restore-keys: |
48+
${{ runner.os }}-go-${{ env.GO_VERSION }}-
49+
50+
- name: Download dependencies
51+
run: go mod download
52+
53+
- name: Run tests
54+
run: go test -v ./...
55+
56+
- name: Run go vet
57+
run: go vet ./...
58+
59+
- name: Check formatting
60+
run: |
61+
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
62+
echo "Code is not formatted. Run: gofmt -s -w ."
63+
gofmt -s -l .
64+
exit 1
65+
fi
66+
67+
build:
68+
name: Build
69+
runs-on: ubuntu-latest
70+
needs: test
71+
strategy:
72+
matrix:
73+
goos: [linux, windows, darwin]
74+
goarch: [amd64, arm64]
75+
include:
76+
- goos: linux
77+
goarch: arm
78+
goarm: 7
79+
exclude:
80+
- goos: windows
81+
goarch: arm64
82+
83+
steps:
84+
- name: Checkout code
85+
uses: actions/checkout@v4
86+
with:
87+
fetch-depth: 0
88+
89+
- name: Set up Go
90+
uses: actions/setup-go@v5
91+
with:
92+
go-version: ${{ env.GO_VERSION }}
93+
94+
- name: Get version info
95+
id: version
96+
run: |
97+
if git describe --tags --exact-match >/dev/null 2>&1; then
98+
VERSION=$(git describe --tags --exact-match)
99+
else
100+
COMMIT_SHORT=$(git rev-parse --short HEAD)
101+
VERSION="v1.0.0-dev+${COMMIT_SHORT}"
102+
fi
103+
104+
GIT_COMMIT=$(git rev-parse HEAD)
105+
BUILD_TIME=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
106+
107+
echo "version=$VERSION" >> $GITHUB_OUTPUT
108+
echo "git_commit=$GIT_COMMIT" >> $GITHUB_OUTPUT
109+
echo "build_time=$BUILD_TIME" >> $GITHUB_OUTPUT
110+
111+
- name: Build binary
112+
env:
113+
GOOS: ${{ matrix.goos }}
114+
GOARCH: ${{ matrix.goarch }}
115+
GOARM: ${{ matrix.goarch == 'arm' && matrix.goarm || '' }}
116+
run: |
117+
mkdir -p dist
118+
119+
# Set binary name with proper extension
120+
if [ "${{ matrix.goos }}" = "windows" ]; then
121+
BINARY_NAME="${{ env.BINARY_NAME }}_${{ matrix.goos }}_${{ matrix.goarch }}.exe"
122+
else
123+
if [ "${{ matrix.goarch }}" = "arm" ] && [ -n "${{ matrix.goarm }}" ]; then
124+
BINARY_NAME="${{ env.BINARY_NAME }}_${{ matrix.goos }}_${{ matrix.goarch }}v${{ matrix.goarm }}"
125+
else
126+
BINARY_NAME="${{ env.BINARY_NAME }}_${{ matrix.goos }}_${{ matrix.goarch }}"
127+
fi
128+
fi
129+
130+
# Build with version info
131+
go build \
132+
-ldflags "-s -w \
133+
-X 'main.Version=${{ steps.version.outputs.version }}' \
134+
-X 'main.GitCommit=${{ steps.version.outputs.git_commit }}' \
135+
-X 'main.BuildTime=${{ steps.version.outputs.build_time }}'" \
136+
-o "dist/${BINARY_NAME}" .
137+
138+
# Create checksum
139+
cd dist
140+
sha256sum "${BINARY_NAME}" > "${BINARY_NAME}.sha256"
141+
142+
- name: Upload artifacts
143+
uses: actions/upload-artifact@v4
144+
with:
145+
name: ${{ env.BINARY_NAME }}_${{ matrix.goos }}_${{ matrix.goarch }}${{ matrix.goarm && format('v{0}', matrix.goarm) || '' }}
146+
path: dist/*
147+
retention-days: 7
148+
149+
release:
150+
name: Release
151+
runs-on: ubuntu-latest
152+
needs: build
153+
if: startsWith(github.ref, 'refs/tags/')
154+
permissions:
155+
contents: write
156+
157+
steps:
158+
- name: Checkout code
159+
uses: actions/checkout@v4
160+
with:
161+
fetch-depth: 0
162+
163+
- name: Download all artifacts
164+
uses: actions/download-artifact@v4
165+
with:
166+
path: artifacts
167+
168+
- name: Generate release notes
169+
id: release_notes
170+
run: |
171+
VERSION=${GITHUB_REF#refs/tags/}
172+
GIT_COMMIT=$(git rev-parse HEAD)
173+
BUILD_TIME=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
174+
175+
cat > release_notes.md << EOF
176+
## Release $VERSION
177+
178+
### Build Information
179+
- **Version**: $VERSION
180+
- **Commit**: $GIT_COMMIT
181+
- **Build Time**: $BUILD_TIME
182+
183+
### Downloads
184+
Choose the appropriate binary for your platform:
185+
186+
**Linux:**
187+
- Linux AMD64: \`${{ env.BINARY_NAME }}_linux_amd64\`
188+
- Linux ARM64: \`${{ env.BINARY_NAME }}_linux_arm64\`
189+
- Linux ARMv7: \`${{ env.BINARY_NAME }}_linux_armv7\`
190+
191+
**macOS:**
192+
- macOS Intel: \`${{ env.BINARY_NAME }}_darwin_amd64\`
193+
- macOS Apple Silicon: \`${{ env.BINARY_NAME }}_darwin_arm64\`
194+
195+
**Windows:**
196+
- Windows AMD64: \`${{ env.BINARY_NAME }}_windows_amd64.exe\`
197+
198+
### Installation
199+
1. Download the binary for your platform
200+
2. Verify checksum (optional): \`sha256sum -c filename.sha256\`
201+
3. Make executable (Unix): \`chmod +x filename\`
202+
4. Run: \`./filename --help\`
203+
EOF
204+
205+
- name: Create Release
206+
uses: softprops/action-gh-release@v2
207+
with:
208+
files: artifacts/**/*
209+
body_path: release_notes.md
210+
draft: false
211+
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
212+
make_latest: true
213+
env:
214+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Project Related
2+
llm-caller
3+
4+
# Resource Files
5+
*.png
6+
*.jpg
7+
*.jpeg
8+
*.gif
9+
*.bmp
10+
*.tiff
11+
*.ico
12+
*.webp
13+
*.svg
14+
15+
# Built & Output
16+
build/
17+
dist/
18+
coverage/
19+
src-tauri/target
20+
target
21+
dist-ssr
22+
*.local
23+
24+
# Test
25+
test/
26+
test_*
27+
test-*
28+
examples/*.png
29+
30+
# IDE
31+
.idea/
32+
.vscode/
33+
!.vscode/extensions.json
34+
*.sublime-*
35+
*.ntvs*
36+
*.njsproj
37+
*.sln
38+
*.sw?
39+
.cursor*
40+
41+
# Dependency & Cache
42+
node_modules/
43+
.npm/
44+
package-lock.json
45+
__pycache__/
46+
*.pyc
47+
*.pyo
48+
*.pyd
49+
*.pyw
50+
*.tsbuildinfo
51+
.cache/
52+
.temp/
53+
.tmp/
54+
.swp
55+
.swo
56+
.suo
57+
58+
# Logs
59+
logs/
60+
*.log
61+
*.log.*
62+
63+
# OS Files
64+
.DS_Store
65+
Thumbs.db

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 HenryZ(nodewee@gmail.com)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)