-
Notifications
You must be signed in to change notification settings - Fork 4
223 lines (192 loc) · 5.96 KB
/
ci.yml
File metadata and controls
223 lines (192 loc) · 5.96 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
name: CI
on:
push:
tags:
- 'v*'
pull_request:
branches: [main, master]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Build
run: go build -o aict ./main.go
- name: Test
run: go test ./...
- name: Vet
run: go vet ./...
test-cross-platform:
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, darwin, windows]
goarch: [amd64, arm64]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
ext=""
if [ "$GOOS" = "windows" ]; then
ext=".exe"
fi
go build -o aict${ext} ./main.go
test-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Build aict
run: go build -o aict ./main.go
- name: Build aict-mcp
run: go build -o aict-mcp ./cmd/mcp
- name: Test binary
run: |
./aict --help
./aict ls .
./aict cat README.md
./aict grep "aict" . -r
release:
needs: [test, test-linux]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Get tag
id: get_tag
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Build releases
run: |
mkdir -p releases
# Build aict for all platforms
for os in linux darwin windows; do
for arch in amd64 arm64; do
ext=""
if [ "$os" = "windows" ]; then
ext=".exe"
fi
GOOS=$os GOARCH=$arch CGO_ENABLED=0 go build -o aict-${os}-${arch}${ext} ./main.go
cp aict-${os}-${arch}${ext} releases/
done
done
# Build aict-mcp for all platforms
for os in linux darwin windows; do
for arch in amd64 arm64; do
ext=""
if [ "$os" = "windows" ]; then
ext=".exe"
fi
GOOS=$os GOARCH=$arch CGO_ENABLED=0 go build -o aict-mcp-${os}-${arch}${ext} ./cmd/mcp
cp aict-mcp-${os}-${arch}${ext} releases/
done
done
- name: Create platform tarballs
run: |
TAG=${{ steps.get_tag.outputs.TAG }}
for os in linux darwin windows; do
for arch in amd64 arm64; do
ext=""
if [ "$os" = "windows" ]; then
ext=".exe"
fi
staging="aict-${TAG}-${os}-${arch}"
mkdir -p "$staging/completions"
cp "aict-${os}-${arch}${ext}" "$staging/aict${ext}"
cp "aict-mcp-${os}-${arch}${ext}" "$staging/aict-mcp${ext}"
cp completions/aict.bash "$staging/completions/"
cp completions/aict.zsh "$staging/completions/"
cp LICENSE "$staging/"
tar czf "releases/aict-${TAG}-${os}-${arch}.tar.gz" "$staging"
rm -rf "$staging"
done
done
- name: Create checksums
run: |
cd releases
sha256sum * > checksums.txt
cat checksums.txt
- name: Upload Release Assets
uses: softprops/action-gh-release@v2
with:
files: releases/*
name: ${{ steps.get_tag.outputs.TAG }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Build and upload latest artifacts on every push to main
artifacts:
needs: [test, test-linux]
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Build releases
run: |
mkdir -p releases
# Build aict for all platforms
for os in linux darwin windows; do
for arch in amd64 arm64; do
ext=""
if [ "$os" = "windows" ]; then
ext=".exe"
fi
GOOS=$os GOARCH=$arch CGO_ENABLED=0 go build -o aict-${os}-${arch}${ext} ./main.go
cp aict-${os}-${arch}${ext} releases/
done
done
# Build aict-mcp for all platforms
for os in linux darwin windows; do
for arch in amd64 arm64; do
ext=""
if [ "$os" = "windows" ]; then
ext=".exe"
fi
GOOS=$os GOARCH=$arch CGO_ENABLED=0 go build -o aict-mcp-${os}-${arch}${ext} ./cmd/mcp
cp aict-mcp-${os}-${arch}${ext} releases/
done
done
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: releases
path: releases/
retention-days: 30
# Update Homebrew tap formula on new releases
update-brew:
needs: [release]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update Homebrew formula
uses: mislav/bump-homebrew-formula-action@v3
with:
formula-name: aict
homebrew-tap: synseqack/homebrew-aict
download-url: https://github.com/synseqack/aict/releases/download/${{ github.ref_name }}/aict-${{ github.ref_name }}-darwin-arm64.tar.gz
env:
COMMITTER_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}