-
Notifications
You must be signed in to change notification settings - Fork 7
213 lines (177 loc) · 6.09 KB
/
Copy pathci.yml
File metadata and controls
213 lines (177 loc) · 6.09 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: Build CLI
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build --release
- name: Upload CLI artifact
uses: actions/upload-artifact@v4
with:
name: pg0-macos
path: target/release/pg0
# Mirrors the windows-x86_64 build step in release-cli.yml so CI exercises
# the exact same compile path that produces the shipped Windows executable.
build-windows:
name: Build CLI (Windows)
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc
- name: Build
run: cargo build --release --target x86_64-pc-windows-msvc
- name: Upload CLI artifact
uses: actions/upload-artifact@v4
with:
name: pg0-windows
path: target/x86_64-pc-windows-msvc/release/pg0.exe
sdk-tests:
name: SDK Tests (macOS)
needs: build
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Download CLI
uses: actions/download-artifact@v4
with:
name: pg0-macos
path: ~/.local/bin
- name: Make CLI executable
run: chmod +x ~/.local/bin/pg0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Run Python SDK tests
working-directory: sdk/python
run: |
export PATH="$HOME/.local/bin:$PATH"
uv pip install --system -e ".[dev]"
pytest tests/ -v
sdk-tests-windows:
name: SDK Tests (Windows)
needs: build-windows
runs-on: windows-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Download CLI
uses: actions/download-artifact@v4
with:
name: pg0-windows
path: pg0-bin
- name: Put CLI on PATH
shell: pwsh
run: |
$dest = "$env:USERPROFILE\pg0-bin"
New-Item -ItemType Directory -Force -Path $dest | Out-Null
Copy-Item pg0-bin\pg0.exe $dest\pg0.exe
Add-Content $env:GITHUB_PATH $dest
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Run Python SDK tests
working-directory: sdk/python
shell: pwsh
run: |
uv pip install --system -e ".[dev]"
pytest tests/ -v
# Docker tests - one job per platform, runs both CLI and Python SDK tests
# Note: ARM64 tests are skipped because QEMU emulation is too slow for PostgreSQL setup
docker-tests:
name: Docker Tests (${{ matrix.platform }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- platform: debian-amd64
cli_script: docker-tests/test_debian_amd64.sh
python_script: docker-tests/python/test_debian_amd64.sh
needs_local_binary: false
- platform: alpine-amd64
cli_script: docker-tests/test_alpine_amd64.sh
python_script: docker-tests/python/test_alpine_amd64.sh
needs_local_binary: false
# Ubuntu 24.04 + 25.10. 25.10 only works with the libxml2/ICU
# bundling added in this binary, so the test must run against a
# fresh local build rather than the latest released artifact.
- platform: ubuntu-amd64
cli_script: docker-tests/test_ubuntu_amd64.sh
python_script: ""
needs_local_binary: true
- platform: missing-libs-debian-amd64
cli_script: docker-tests/test_missing_libs.sh
python_script: ""
needs_local_binary: true
steps:
- uses: actions/checkout@v4
- name: Install Rust
if: matrix.needs_local_binary
uses: dtolnay/rust-toolchain@stable
- name: Build Linux binary
if: matrix.needs_local_binary
run: |
cargo build --release
echo "PG0_BINARY_PATH=$(pwd)/target/release/pg0" >> $GITHUB_ENV
- name: Run CLI Docker test
run: |
chmod +x ${{ matrix.cli_script }}
bash ${{ matrix.cli_script }}
- name: Run Python SDK Docker test
if: matrix.python_script != ''
run: |
chmod +x ${{ matrix.python_script }}
bash ${{ matrix.python_script }}
# Python wheel builds - test that wheel building works
python-wheels:
name: Python Wheels
uses: ./.github/workflows/build-python-wheels.yml
with:
upload-artifacts: false
test-wheels: true
# Test installing from sdist (source distribution)
python-sdist-install:
name: Python sdist Install
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: Install from sdist in isolated environment
run: |
# Create a fresh directory outside the repo to simulate user install
mkdir /tmp/sdist-test
cp sdk/python/dist/*.tar.gz /tmp/sdist-test/
cd /tmp/sdist-test
# Install from sdist (this should download binary from GitHub releases)
pip install *.tar.gz -v 2>&1 | tee install.log
# Verify the download happened
grep -q "Downloading pg0" install.log || echo "Warning: Download message not found"
# Verify the package works
python -c "from pg0 import Pg0; print('Import successful')"
python -c "from pg0 import _get_bundled_binary; assert _get_bundled_binary() is not None, 'Binary not bundled'; print('Binary bundled correctly')"