-
Notifications
You must be signed in to change notification settings - Fork 0
240 lines (194 loc) · 7.56 KB
/
Copy pathbuild.yml
File metadata and controls
240 lines (194 loc) · 7.56 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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
name: Build Executables
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
target: linux-x64
artifact: semble-linux-x64
- os: ubuntu-22.04-arm
target: linux-arm64
artifact: semble-linux-arm64
- os: macos-14
target: macos-arm64
artifact: semble-macos-arm64
- os: windows-latest
target: windows-x64
artifact: semble-windows-x64.exe
runs-on: ${{ matrix.os }}
name: Build (${{ matrix.target }})
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: uv sync --extra mcp
- name: Build onefile executable
run: uv run python build.py --name semble --with-mcp
- name: Rename onefile artifact (Unix)
if: runner.os != 'Windows'
run: mv dist/semble dist/${{ matrix.artifact }}
- name: Rename onefile artifact (Windows)
if: runner.os == 'Windows'
run: mv dist/semble.exe dist/${{ matrix.artifact }}
- name: Build onedir executable
run: uv run python build.py --onedir --name semble --with-mcp
- name: Smoke test onefile (Unix)
if: runner.os != 'Windows'
run: |
chmod +x dist/${{ matrix.artifact }}
./dist/${{ matrix.artifact }} search --help
./dist/${{ matrix.artifact }} init --help
- name: Smoke test onefile (Windows)
if: runner.os == 'Windows'
run: |
dist\${{ matrix.artifact }} search --help
dist\${{ matrix.artifact }} init --help
- name: Smoke test onedir (Unix)
if: runner.os != 'Windows'
run: |
chmod +x dist/semble/semble
./dist/semble/semble search --help
./dist/semble/semble init --help
- name: Smoke test onedir (Windows)
if: runner.os == 'Windows'
run: |
dist\semble\semble.exe search --help
dist\semble\semble.exe init --help
- name: Package onedir as archive (Unix)
if: runner.os != 'Windows'
run: |
cd dist/semble
tar -czf ../semble-${{ matrix.target }}-fast.tar.gz .
- name: Package onedir as archive (Windows)
if: runner.os == 'Windows'
run: |
cd dist/semble
Compress-Archive -Path * -DestinationPath ../semble-${{ matrix.target }}-fast.zip
- name: Upload onefile artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: dist/${{ matrix.artifact }}
retention-days: 30
- name: Upload onedir artifact (Unix)
if: runner.os != 'Windows'
uses: actions/upload-artifact@v4
with:
name: semble-${{ matrix.target }}-fast.tar.gz
path: dist/semble-${{ matrix.target }}-fast.tar.gz
retention-days: 30
- name: Upload onedir artifact (Windows)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: semble-${{ matrix.target }}-fast.zip
path: dist/semble-${{ matrix.target }}-fast.zip
retention-days: 30
integration-test:
needs: [build]
runs-on: ubuntu-22.04
name: Integration Test (linux-x64)
steps:
- name: Download linux-x64 binary
uses: actions/download-artifact@v4
with:
name: semble-linux-x64
- name: Make executable
run: chmod +x semble-linux-x64
- name: Clone a test repo
run: git clone --depth 1 https://github.com/MinishLab/model2vec test-repo
- name: Test search
run: |
OUTPUT=$(./semble-linux-x64 search "save model to disk" ./test-repo)
echo "$OUTPUT"
echo "$OUTPUT" | python3 -c "import sys, json; data = json.load(sys.stdin); assert len(data['results']) > 0, 'No results returned'"
- name: Test find-related
run: |
OUTPUT=$(./semble-linux-x64 search "load pretrained" ./test-repo)
FILE=$(echo "$OUTPUT" | python3 -c "import sys, json; print(json.load(sys.stdin)['results'][0]['file_path'])")
LINE=$(echo "$OUTPUT" | python3 -c "import sys, json; print(json.load(sys.stdin)['results'][0]['start_line'])")
echo "Using file: $FILE at line: $LINE"
RELATED=$(./semble-linux-x64 find-related "$FILE" "$LINE" ./test-repo)
echo "$RELATED"
echo "$RELATED" | python3 -c "import sys, json; data = json.load(sys.stdin); assert len(data['results']) > 0, 'No related results'"
- name: Test search with --content all
run: |
OUTPUT=$(./semble-linux-x64 search "installation" ./test-repo --content all)
echo "$OUTPUT"
echo "$OUTPUT" | python3 -c "import sys, json; data = json.load(sys.stdin); assert len(data['results']) > 0, 'No results with --content all'"
- name: Test search with top-k
run: |
OUTPUT=$(./semble-linux-x64 search "tokenizer" ./test-repo -k 3)
echo "$OUTPUT"
echo "$OUTPUT" | python3 -c "import sys, json; data = json.load(sys.stdin); assert len(data['results']) <= 3, 'top-k not respected'"
- name: Test savings
run: ./semble-linux-x64 savings
release:
needs: [build, integration-test]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
merge-multiple: true
- name: Generate checksums
run: |
cd artifacts
sha256sum * > checksums-sha256.txt
cat checksums-sha256.txt
- name: Create release
uses: softprops/action-gh-release@v2
with:
files: |
artifacts/*
generate_release_notes: true
body: |
## Standalone Executables
No Python installation required. Download the binary for your platform and run it directly.
### Single-file binaries (portable, slower startup)
| Platform | Architecture | File |
|----------|-------------|------|
| Linux | x64 | `semble-linux-x64` |
| Linux | ARM64 | `semble-linux-arm64` |
| macOS | Apple Silicon (ARM64) | `semble-macos-arm64` |
| Windows | x64 | `semble-windows-x64.exe` |
### Fast-start archives (extract and run, ~20x faster startup)
| Platform | Architecture | File |
|----------|-------------|------|
| Linux | x64 | `semble-linux-x64-fast.tar.gz` |
| Linux | ARM64 | `semble-linux-arm64-fast.tar.gz` |
| macOS | Apple Silicon (ARM64) | `semble-macos-arm64-fast.tar.gz` |
| Windows | x64 | `semble-windows-x64-fast.zip` |
### Usage
**Single-file (portable):**
```bash
chmod +x semble-linux-x64
./semble-linux-x64 search "authentication flow" ./my-project
```
**Fast-start (recommended for repeated use):**
```bash
tar -xzf semble-linux-x64-fast.tar.gz -C semble/
./semble/semble search "authentication flow" ./my-project
```
### Verify checksums
```bash
sha256sum -c checksums-sha256.txt
```