Skip to content

Commit ea239f6

Browse files
committed
Build semble platform specific executables
0 parents  commit ea239f6

14 files changed

Lines changed: 680 additions & 0 deletions

.github/workflows/build.yml

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: Build Executables
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
build:
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
include:
18+
- os: ubuntu-22.04
19+
target: linux-x64
20+
artifact: semble-linux-x64
21+
22+
- os: ubuntu-22.04-arm
23+
target: linux-arm64
24+
artifact: semble-linux-arm64
25+
26+
- os: macos-13
27+
target: macos-x64
28+
artifact: semble-macos-x64
29+
30+
- os: macos-14
31+
target: macos-arm64
32+
artifact: semble-macos-arm64
33+
34+
- os: windows-latest
35+
target: windows-x64
36+
artifact: semble-windows-x64.exe
37+
38+
- os: windows-11-arm
39+
target: windows-arm64
40+
artifact: semble-windows-arm64.exe
41+
42+
runs-on: ${{ matrix.os }}
43+
name: Build (${{ matrix.target }})
44+
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- name: Install uv
49+
uses: astral-sh/setup-uv@v4
50+
with:
51+
version: "latest"
52+
53+
- name: Set up Python
54+
uses: actions/setup-python@v5
55+
with:
56+
python-version: "3.12"
57+
58+
- name: Install dependencies
59+
run: uv sync --extra mcp
60+
61+
- name: Build executable
62+
run: uv run python build.py --name semble --with-mcp
63+
64+
- name: Smoke test (Unix)
65+
if: runner.os != 'Windows'
66+
run: |
67+
chmod +x dist/semble
68+
./dist/semble search --help
69+
./dist/semble init --help
70+
71+
- name: Smoke test (Windows)
72+
if: runner.os == 'Windows'
73+
run: |
74+
dist\semble.exe search --help
75+
dist\semble.exe init --help
76+
77+
- name: Rename artifact (Unix)
78+
if: runner.os != 'Windows'
79+
run: mv dist/semble dist/${{ matrix.artifact }}
80+
81+
- name: Rename artifact (Windows)
82+
if: runner.os == 'Windows'
83+
run: mv dist/semble.exe dist/${{ matrix.artifact }}
84+
85+
- name: Upload artifact
86+
uses: actions/upload-artifact@v4
87+
with:
88+
name: ${{ matrix.artifact }}
89+
path: dist/${{ matrix.artifact }}
90+
retention-days: 30
91+
92+
release:
93+
needs: [build]
94+
runs-on: ubuntu-latest
95+
if: startsWith(github.ref, 'refs/tags/')
96+
97+
steps:
98+
- name: Download all artifacts
99+
uses: actions/download-artifact@v4
100+
with:
101+
path: artifacts/
102+
merge-multiple: true
103+
104+
- name: Generate checksums
105+
run: |
106+
cd artifacts
107+
sha256sum * > checksums-sha256.txt
108+
cat checksums-sha256.txt
109+
110+
- name: Create release
111+
uses: softprops/action-gh-release@v2
112+
with:
113+
files: |
114+
artifacts/*
115+
generate_release_notes: true
116+
body: |
117+
## Standalone Executables
118+
119+
No Python installation required. Download the binary for your platform and run it directly.
120+
121+
| Platform | Architecture | File |
122+
|----------|-------------|------|
123+
| Linux | x64 | `semble-linux-x64` |
124+
| Linux | ARM64 | `semble-linux-arm64` |
125+
| macOS | Intel (x64) | `semble-macos-x64` |
126+
| macOS | Apple Silicon (ARM64) | `semble-macos-arm64` |
127+
| Windows | x64 | `semble-windows-x64.exe` |
128+
| Windows | ARM64 | `semble-windows-arm64.exe` |
129+
130+
### Usage
131+
```bash
132+
chmod +x semble-*
133+
./semble-linux-x64 search "authentication flow" ./my-project
134+
```
135+
136+
### Verify checksums
137+
```bash
138+
sha256sum -c checksums-sha256.txt
139+
```

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Build artifacts
2+
dist/
3+
build/
4+
*.spec.bak
5+
6+
# Python
7+
__pycache__/
8+
*.py[cod]
9+
*$py.class
10+
*.egg-info/
11+
.eggs/
12+
13+
# Virtual environments
14+
.venv/
15+
venv/
16+
17+
# PyInstaller
18+
*.manifest
19+
*.spec.bak
20+
21+
# IDE
22+
.idea/
23+
.vscode/
24+
*.swp
25+
*.swo
26+
27+
# OS
28+
.DS_Store
29+
Thumbs.db
30+
31+
# uv
32+
uv.lock

Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.PHONY: install build build-mcp build-onedir test clean
2+
3+
install:
4+
uv sync
5+
6+
build:
7+
uv run python build.py
8+
9+
build-mcp:
10+
uv run python build.py --with-mcp
11+
12+
build-onedir:
13+
uv run python build.py --onedir
14+
15+
test:
16+
uv run python test_build.py
17+
18+
clean:
19+
rm -rf dist/ build/ __pycache__/

README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# semble-executable
2+
3+
Packages [semble](https://github.com/MinishLab/semble) as a standalone executable binary using PyInstaller. No Python installation required to run the resulting binary.
4+
5+
## Prerequisites
6+
7+
- Python 3.10+ (for building only)
8+
- [uv](https://docs.astral.sh/uv/getting-started/installation/) (recommended) or pip
9+
10+
## Quick Start
11+
12+
```bash
13+
# Install dependencies
14+
uv sync
15+
16+
# Build the executable
17+
uv run python build.py
18+
19+
# The binary is at: dist/semble
20+
```
21+
22+
## What Gets Built
23+
24+
The output is a single `semble` binary (or `semble.exe` on Windows) in `dist/` that includes:
25+
- The semble CLI and all its dependencies (model2vec, tree-sitter, bm25s, etc.)
26+
- Tree-sitter language grammars
27+
- The potion-code-16M model (downloaded at first run if not bundled)
28+
29+
## Usage
30+
31+
The executable works exactly like the installed `semble` CLI:
32+
33+
```bash
34+
# Search a local repo
35+
./dist/semble search "authentication flow" ./my-project
36+
37+
# Search a remote repo
38+
./dist/semble search "save model" https://github.com/MinishLab/model2vec
39+
40+
# Find related code
41+
./dist/semble find-related src/auth.py 42 ./my-project
42+
43+
# Run as MCP server (requires --with-mcp build flag)
44+
./dist/semble --content all
45+
```
46+
47+
## Build Options
48+
49+
```bash
50+
# One-file mode (default) - single portable binary
51+
uv run python build.py --onefile
52+
53+
# One-dir mode - faster startup, directory with all files
54+
uv run python build.py --onedir
55+
56+
# Include MCP server support
57+
uv run python build.py --with-mcp
58+
59+
# Specify output name
60+
uv run python build.py --name semble-search
61+
```
62+
63+
## Platform Support
64+
65+
Build on each target platform to get a native binary:
66+
- macOS (Intel & Apple Silicon)
67+
- Linux (x86_64)
68+
- Windows (x86_64)
69+
70+
Cross-compilation is not supported by PyInstaller; build on the target OS.
71+
72+
## CI/CD
73+
74+
See `.github/workflows/build.yml` for automated builds on all platforms.
75+
76+
## License
77+
78+
MIT (same as semble)

0 commit comments

Comments
 (0)