Skip to content

Commit 35dead3

Browse files
authored
Merge branch 'main' into 787-figure-out-queue-block
2 parents dae5fa8 + 613a23a commit 35dead3

File tree

32 files changed

+1032
-252
lines changed

32 files changed

+1032
-252
lines changed

.github/actions/build_bindings_python/action.yml

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ runs:
1616
shell: bash
1717
run: |
1818
raw_version="${{ inputs.version }}"
19-
# Remove v prefix: v1.2.3-nightly -> 1.2.3-nightly
20-
version_no_v=${raw_version/v/}
21-
# Convert to Python-compatible version: 1.2.3-nightly -> 1.2.3.dev0, 1.2.3-p1 -> 1.2.3.post1
22-
VERSION=$(echo "$version_no_v" | sed 's/-nightly/.dev0/' | sed 's/-p\([0-9]*\)/.post\1/')
19+
# Remove v prefix and suffixes: v1.2.809-nightly -> 1.2.809
20+
VERSION=$(echo "$raw_version" | sed 's/^v//' | sed 's/-nightly//' | sed 's/-p[0-9]*//')
21+
2322
echo "building version: $raw_version -> $VERSION"
24-
sed "s#version = \"0.1.0\"#version = \"$VERSION\"#g" Cargo.toml > Cargo.toml.bak
25-
sed "s#version = \"0.1.0\"#version = \"$VERSION\"#g" pyproject.toml > pyproject.toml.bak
23+
# Replace any existing version in Cargo.toml and pyproject.toml
24+
sed "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml > Cargo.toml.tmp
25+
sed "s/^version = \".*\"/version = \"$VERSION\"/" pyproject.toml > pyproject.toml.tmp
2626
27-
mv Cargo.toml.bak Cargo.toml
28-
mv pyproject.toml.bak pyproject.toml
27+
mv Cargo.toml.tmp Cargo.toml
28+
mv pyproject.toml.tmp pyproject.toml
2929
3030
echo "version in Cargo.toml: $(grep 'version' Cargo.toml)"
3131
echo "version in pyproject.toml: $(grep 'version' pyproject.toml)"
@@ -80,7 +80,8 @@ runs:
8080
# Install cargo-zigbuild manually to avoid musl target issues
8181
cargo install cargo-zigbuild --target ${{ inputs.target }}
8282
../../scripts/setup/dev_setup.sh -yb
83-
uv venv --python=python3.12
83+
# Create virtual environment for build dependencies (overwrite if exists)
84+
uv venv .venv --python=python3.12 --clear
8485
uv sync --all-groups --all-extras
8586
8687
- name: Setup Rust for development builds
@@ -97,8 +98,8 @@ runs:
9798
run: |
9899
echo "Building development wheel for testing..."
99100
100-
# Create and activate virtual environment
101-
uv venv --python python3.12
101+
# Create virtual environment (overwrite if exists)
102+
uv venv .venv --python python3.12 --clear
102103
source .venv/bin/activate
103104
104105
# Install development dependencies
@@ -116,22 +117,3 @@ runs:
116117
python -m pytest tests/ -v --tb=short
117118
118119
echo "All Python binding tests passed!"
119-
120-
- name: Test built wheels
121-
if: inputs.version != ''
122-
shell: bash
123-
working-directory: src/bendpy
124-
run: |
125-
echo "Testing built wheels..."
126-
127-
# Install from built wheel for release testing
128-
uv venv --python python3.12
129-
source .venv/bin/activate
130-
uv pip install dist/*.whl
131-
uv pip install pytest pandas polars pyarrow
132-
133-
# Run pytest tests
134-
echo "Executing pytest tests..."
135-
python -m pytest tests/ -v --tb=short
136-
137-
echo "All Python binding tests passed!"

.github/actions/test_private_tasks/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ runs:
1717
shell: bash
1818
run: |
1919
bash ./tests/task/test-private-task.sh
20-
bash ./tests/task/test-private-task-warehouse.sh
20+
# bash ./tests/task/test-private-task-warehouse.sh
2121

2222
- name: Upload failure
2323
if: failure()
Lines changed: 97 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
1-
name: Bindings Python
1+
name: Python Package Release
22

33
on:
4-
## uncomment it when bendpy is enabled
54
workflow_dispatch:
6-
inputs:
7-
version:
8-
description: Version to release (optional for testing)
9-
required: false
10-
type: string
11-
default: "test-build"
12-
pull_request:
13-
branches:
14-
- main
15-
paths:
16-
- "src/**"
17-
- ".github/workflows/bindings.python.yml"
185
workflow_call:
196
inputs:
207
version:
@@ -33,9 +20,43 @@ permissions:
3320
packages: write
3421

3522
jobs:
23+
get-version:
24+
name: Determine Version
25+
if: (github.event_name == 'workflow_call' && inputs.version != '') || github.event_name == 'workflow_dispatch'
26+
runs-on: ubuntu-latest
27+
outputs:
28+
version: ${{ steps.version.outputs.version }}
29+
steps:
30+
- uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
- name: Get and validate version
34+
id: version
35+
shell: bash
36+
run: |
37+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
38+
VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.1.0")
39+
echo "Using latest tag for manual trigger: $VERSION"
40+
elif [[ "${{ github.event_name }}" == "workflow_call" && -n "${{ inputs.version }}" ]]; then
41+
VERSION="${{ inputs.version }}"
42+
echo "Using provided version from workflow_call: $VERSION"
43+
else
44+
echo "Error: No version provided for workflow_call"
45+
exit 1
46+
fi
47+
48+
# Validate version format
49+
if [[ ! $VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
50+
echo "Warning: Version $VERSION may not follow semantic versioning (vX.Y.Z)"
51+
fi
52+
53+
echo "Final version: $VERSION"
54+
echo "version=$VERSION" >> $GITHUB_OUTPUT
55+
3656
test:
37-
# Run tests on all PRs and workflow dispatches
38-
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
57+
name: Run Tests
58+
if: (github.event_name == 'workflow_call' && inputs.version != '') || github.event_name == 'workflow_dispatch'
59+
needs: [get-version]
3960
runs-on:
4061
- self-hosted
4162
- X64
@@ -52,79 +73,103 @@ jobs:
5273
# No version means development build with tests
5374

5475
linux:
55-
# Only run for version builds (releases)
56-
if: inputs.version
76+
name: Build Linux Wheels
77+
if: (github.event_name == 'workflow_call' && inputs.version != '') || github.event_name == 'workflow_dispatch'
78+
needs: [get-version, test]
5779
runs-on:
5880
- self-hosted
5981
- "${{ matrix.runner }}"
6082
- Linux
6183
- 4c16g
6284
- aws
6385
strategy:
86+
fail-fast: false
6487
matrix:
6588
include:
6689
- { arch: x86_64, runner: X64 }
67-
# - { arch: aarch64, runner: ARM64 }
90+
- { arch: aarch64, runner: ARM64 }
6891
steps:
6992
- uses: actions/checkout@v4
7093
with:
7194
fetch-depth: 0
7295
- uses: ./.github/actions/build_bindings_python
7396
with:
7497
target: ${{ matrix.arch }}-unknown-linux-gnu
75-
version: ${{ inputs.version }}
76-
- name: upload
77-
if: inputs.version
98+
version: ${{ needs.get-version.outputs.version }}
99+
- name: Upload Linux wheel
78100
uses: actions/upload-artifact@v4
79101
with:
80102
name: python-linux-${{ matrix.arch }}
81103
path: src/bendpy/dist/*.whl
104+
retention-days: 7
82105

83-
# macos:
84-
# if: inputs.version
85-
# runs-on: macos-latest
86-
# strategy:
87-
# matrix:
88-
# arch:
89-
# - aarch64
90-
# steps:
91-
# - uses: actions/checkout@v4
92-
# with:
93-
# fetch-depth: 0
94-
# - uses: ./.github/actions/build_bindings_python
95-
# with:
96-
# target: ${{ matrix.arch }}-apple-darwin
97-
# version: ${{ inputs.version }}
98-
# - name: upload
99-
# if: inputs.version
100-
# uses: actions/upload-artifact@v4
101-
# with:
102-
# name: python-macos-${{ matrix.arch }}
103-
# path: src/bendpy/dist/*.whl
106+
macos:
107+
name: Build macOS Wheels
108+
if: (github.event_name == 'workflow_call' && inputs.version != '') || github.event_name == 'workflow_dispatch'
109+
needs: [get-version, test]
110+
runs-on: macos-latest
111+
continue-on-error: true
112+
strategy:
113+
matrix:
114+
target: [x86_64-apple-darwin, aarch64-apple-darwin]
115+
steps:
116+
- uses: actions/checkout@v4
117+
with:
118+
fetch-depth: 0
119+
120+
- name: Install dependencies
121+
run: |
122+
# Install OpenSSL and necessary tools
123+
brew install openssl@3
124+
125+
# Use vendored OpenSSL to avoid cross-compilation issues
126+
echo "OPENSSL_STATIC=1" >> $GITHUB_ENV
127+
echo "OPENSSL_VENDORED=1" >> $GITHUB_ENV
128+
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
129+
130+
- uses: ./.github/actions/build_bindings_python
131+
with:
132+
target: ${{ matrix.target }}
133+
version: ${{ needs.get-version.outputs.version }}
134+
- name: Upload macOS wheel
135+
uses: actions/upload-artifact@v4
136+
with:
137+
name: python-macos-${{ matrix.target }}
138+
path: src/bendpy/dist/*.whl
139+
retention-days: 7
104140

105141
publish:
106-
if: inputs.version
107-
name: Publish
108-
needs: [linux]
142+
name: Publish to PyPI
143+
if: (github.event_name == 'workflow_call' && inputs.version != '') || github.event_name == 'workflow_dispatch'
144+
needs: [get-version, test, linux]
109145
runs-on: ubuntu-latest
110-
permissions:
111-
id-token: write
112-
pull-requests: write
113-
contents: read
114-
packages: write
115146
steps:
116147
- uses: actions/checkout@v4
117148
- uses: actions/download-artifact@v4
118149
with:
119150
pattern: python-*
120151
merge-multiple: true
121152
path: src/bendpy/dist
153+
continue-on-error: true
154+
155+
- name: Show packages to publish
156+
run: |
157+
echo "Publishing packages for version: ${{ needs.get-version.outputs.version }}"
158+
echo "Packages found:"
159+
ls -la src/bendpy/dist/ || echo "No packages found"
160+
echo "Total packages: $(ls src/bendpy/dist/*.whl 2>/dev/null | wc -l)"
122161
123162
- name: Publish to PyPI
124163
timeout-minutes: 10
125164
run: |
126165
pip install twine
127-
twine upload --skip-existing --verbose src/bendpy/dist/*.whl
166+
echo "Publishing to PyPI..."
167+
if [ -n "$(find src/bendpy/dist -name "*.whl" 2>/dev/null)" ]; then
168+
twine upload --skip-existing --verbose src/bendpy/dist/*.whl
169+
else
170+
echo "No wheel files found to publish"
171+
exit 1
172+
fi
128173
env:
129174
TWINE_USERNAME: __token__
130175
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}

Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/test-bend-tests/main.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ echo "🔧 Installing databend_test_helper..."
1010
pip install -e "$PROJECT_DIR/databend_test_helper"
1111

1212
echo "🚀 Running test cluster..."
13-
python "$SCRIPT_DIR/test_cluster.py"
13+
python "$SCRIPT_DIR/test_cluster.py"

src/bendpy/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,16 @@ databend-common-exception = { workspace = true }
2525
databend-common-expression = { workspace = true }
2626
databend-common-license = { workspace = true }
2727
databend-common-meta-app = { workspace = true }
28+
databend-common-telemetry = { workspace = true }
2829
databend-common-tracing = { workspace = true }
2930
databend-common-version = { workspace = true }
3031
databend-query = { workspace = true, features = [
3132
"simd",
3233
"disable_initial_exec_tls",
3334
] }
3435
pyo3 = { version = "0.24", features = ["generate-import-lib", "abi3-py312"] }
36+
serde_json = { workspace = true }
37+
sysinfo = { workspace = true }
3538
tokio = { workspace = true, features = ["macros", "rt", "rt-multi-thread", "sync"] }
3639
tokio-stream = { workspace = true }
3740

0 commit comments

Comments
 (0)