-
Notifications
You must be signed in to change notification settings - Fork 5
329 lines (280 loc) · 10.2 KB
/
release-cli.yml
File metadata and controls
329 lines (280 loc) · 10.2 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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
id-token: write
jobs:
build-cli:
name: Build CLI ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
name: linux-x86_64-musl
- target: x86_64-unknown-linux-gnu
os: ubuntu-22.04
name: linux-x86_64-gnu
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
name: linux-aarch64-musl
- target: aarch64-unknown-linux-gnu
os: ubuntu-22.04
name: linux-aarch64-gnu
- target: aarch64-apple-darwin
os: macos-latest
name: darwin-aarch64
- target: x86_64-apple-darwin
os: macos-15-intel
name: darwin-x86_64
- target: x86_64-pc-windows-msvc
os: windows-latest
name: windows-x86_64
steps:
- uses: actions/checkout@v4
- name: Install musl tools (Linux x86_64 musl)
if: matrix.target == 'x86_64-unknown-linux-musl'
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
- name: Install musl tools (Linux aarch64 musl)
if: matrix.target == 'aarch64-unknown-linux-musl'
run: |
sudo apt-get update
sudo apt-get install -y musl-tools gcc-aarch64-linux-gnu
- name: Install cross-compilation tools (Linux aarch64 gnu)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Configure cross-compilation (Linux aarch64 musl)
if: matrix.target == 'aarch64-unknown-linux-musl'
run: |
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Configure cross-compilation (Linux aarch64 gnu)
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Configure static linking (Linux musl)
if: contains(matrix.target, 'linux-musl')
run: |
echo "RUSTFLAGS=-C target-feature=+crt-static" >> $GITHUB_ENV
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Prepare artifact (Unix)
if: runner.os != 'Windows'
run: |
cp target/${{ matrix.target }}/release/pg0 pg0-${{ matrix.name }}
chmod +x pg0-${{ matrix.name }}
- name: Prepare artifact (Windows)
if: runner.os == 'Windows'
run: |
copy target\${{ matrix.target }}\release\pg0.exe pg0-${{ matrix.name }}.exe
- name: Upload artifact (Unix)
if: runner.os != 'Windows'
uses: actions/upload-artifact@v4
with:
name: cli-${{ matrix.name }}
path: pg0-${{ matrix.name }}
- name: Upload artifact (Windows)
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: cli-${{ matrix.name }}
path: pg0-${{ matrix.name }}.exe
build-python-wheels:
name: Build Python wheel (${{ matrix.platform }})
needs: build-cli
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# macOS Apple Silicon - reuse darwin-aarch64 CLI
- os: macos-14
platform: darwin-aarch64
wheel_platform: macosx_14_0_arm64
cli_artifact: cli-darwin-aarch64
cli_binary: pg0-darwin-aarch64
# macOS Intel - reuse darwin-x86_64 CLI
- os: macos-15-intel
platform: darwin-x86_64
wheel_platform: macosx_15_0_x86_64
cli_artifact: cli-darwin-x86_64
cli_binary: pg0-darwin-x86_64
# Linux x86_64 glibc - reuse linux-x86_64-gnu CLI
- os: ubuntu-22.04
platform: linux-x86_64-gnu
wheel_platform: manylinux_2_35_x86_64
cli_artifact: cli-linux-x86_64-gnu
cli_binary: pg0-linux-x86_64-gnu
# Linux ARM64 glibc - reuse linux-aarch64-gnu CLI
- os: ubuntu-22.04-arm
platform: linux-aarch64-gnu
wheel_platform: manylinux_2_35_aarch64
cli_artifact: cli-linux-aarch64-gnu
cli_binary: pg0-linux-aarch64-gnu
# Windows x64 - reuse windows-x86_64 CLI
- os: windows-latest
platform: windows-x86_64
wheel_platform: win_amd64
cli_artifact: cli-windows-x86_64
cli_binary: pg0-windows-x86_64.exe
steps:
- uses: actions/checkout@v4
- name: Download CLI artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.cli_artifact }}
path: cli-bin
- name: Prepare CLI binary (Unix)
if: runner.os != 'Windows'
run: |
chmod +x cli-bin/${{ matrix.cli_binary }}
ls -la cli-bin/
- name: Prepare CLI binary (Windows)
if: runner.os == 'Windows'
run: |
dir cli-bin\
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Build wheel
working-directory: sdk/python
env:
PG0_BINARY_PATH: ${{ github.workspace }}/cli-bin/${{ matrix.cli_binary }}
run: |
uv build --wheel
shell: bash
- name: Rename wheel to platform-specific
working-directory: sdk/python/dist
run: |
for f in *.whl; do
newname=$(echo "$f" | sed 's/py3-none-any/py3-none-${{ matrix.wheel_platform }}/g')
if [ "$f" != "$newname" ]; then
echo "Renaming $f -> $newname"
mv "$f" "$newname"
fi
done
ls -la
shell: bash
- name: Upload wheel artifact
uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.platform }}
path: sdk/python/dist/*.whl
build-python-sdist:
name: Build Python sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Build sdist
working-directory: sdk/python
run: uv build --sdist
- name: Upload sdist artifact
uses: actions/upload-artifact@v4
with:
name: python-sdist
path: sdk/python/dist/*.tar.gz
release:
name: Create GitHub Release
needs: [build-cli, build-python-wheels, build-python-sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Load versions
id: versions
run: |
source versions.env
echo "PG_VERSION=$PG_VERSION" >> $GITHUB_OUTPUT
echo "PGVECTOR_VERSION=$PGVECTOR_VERSION" >> $GITHUB_OUTPUT
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release files
run: |
mkdir release
# CLI binaries
find artifacts/cli-* -type f -exec mv {} release/ \;
# Python wheels
find artifacts/wheel-* -type f -exec mv {} release/ \;
# Python sdist
find artifacts/python-sdist -type f -exec mv {} release/ \;
ls -la release/
- name: Create Release
env:
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }}
PG_VERSION: ${{ steps.versions.outputs.PG_VERSION }}
PGVECTOR_VERSION: ${{ steps.versions.outputs.PGVECTOR_VERSION }}
run: |
cat > release_notes.md << 'EOF'
## pg0 - Embedded PostgreSQL CLI
### CLI Binaries
- `pg0-darwin-aarch64` - macOS Apple Silicon
- `pg0-darwin-x86_64` - macOS Intel
- `pg0-linux-x86_64-gnu` - Linux x86_64 for Debian/Ubuntu (glibc)
- `pg0-linux-x86_64-musl` - Linux x86_64 for Alpine (musl, statically linked)
- `pg0-linux-aarch64-gnu` - Linux ARM64 for Debian/Ubuntu (glibc)
- `pg0-linux-aarch64-musl` - Linux ARM64 for Alpine (musl, statically linked)
- `pg0-windows-x86_64.exe` - Windows x64
### Python Package
Install from PyPI:
```bash
pip install pg0-embedded
```
Pre-built wheels available for:
- macOS Apple Silicon (`macosx_14_0_arm64`)
- macOS Intel (`macosx_15_0_x86_64`)
- Linux x86_64 glibc (`manylinux_2_35_x86_64`)
- Linux ARM64 glibc (`manylinux_2_35_aarch64`)
- Windows x64 (`win_amd64`)
### Bundled Components
Everything is bundled directly in the binary - no downloads required, works completely offline!
EOF
echo "- PostgreSQL ${PG_VERSION}" >> release_notes.md
echo "- pgvector ${PGVECTOR_VERSION}" >> release_notes.md
echo "" >> release_notes.md
echo "### Installation (macOS/Linux)" >> release_notes.md
echo '```bash' >> release_notes.md
echo "curl -fsSL https://raw.githubusercontent.com/vectorize-io/pg0/main/install.sh | bash" >> release_notes.md
echo '```' >> release_notes.md
gh release create "${{ github.ref_name }}" --title "${{ github.ref_name }}" --notes-file release_notes.md release/*
publish-pypi:
name: Publish to PyPI
needs: [build-python-wheels, build-python-sdist, release]
runs-on: ubuntu-latest
steps:
- name: Download wheel artifacts
uses: actions/download-artifact@v4
with:
pattern: wheel-*
path: dist
merge-multiple: true
- name: Download sdist artifact
uses: actions/download-artifact@v4
with:
name: python-sdist
path: dist
- name: List artifacts
run: ls -la dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/