Merge pull request #630 from chdb-io/fix/playground-remove-cloud-cred… #1350
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build & Test Linux x86_64 | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| TAG_NAME: | |
| description: 'Release Version Tag' | |
| required: true | |
| release: | |
| types: [created] | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - 'docs/**' | |
| - '.github/workflows/build_*_wheels*.yml' | |
| - '.github/workflows/external_clickhouse_integration.yaml' | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| branches: | |
| - main | |
| paths-ignore: | |
| - 'docs/**' | |
| - '.github/workflows/build_*_wheels*.yml' | |
| - '.github/workflows/external_clickhouse_integration.yaml' | |
| jobs: | |
| build_and_test: | |
| name: Build & Test (Linux x86_64) | |
| runs-on: [self-hosted, linux, x64, ubuntu-latest] | |
| if: ${{ !github.event.pull_request.draft }} | |
| steps: | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \ | |
| libbz2-dev libreadline-dev wget curl \ | |
| libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev \ | |
| libffi-dev liblzma-dev libsqlite3-dev | |
| - name: Install GitHub CLI | |
| run: | | |
| wget https://github.com/cli/cli/releases/download/v2.82.1/gh_2.82.1_linux_amd64.tar.gz -O gh.tar.gz | |
| tar -xf gh.tar.gz | |
| sudo cp gh_*/bin/gh /usr/local/bin/ | |
| sudo chmod +x /usr/local/bin/gh | |
| if ! gh --version; then | |
| echo "ERROR: GitHub CLI installation failed!" | |
| exit 1 | |
| fi | |
| echo "GitHub CLI installed successfully" | |
| - name: Setup pyenv | |
| run: | | |
| rm -rf $HOME/.pyenv | |
| curl https://pyenv.run | bash | |
| export PATH="$HOME/.pyenv/bin:$PATH" | |
| eval "$(pyenv init -)" | |
| plain_pyenv_version() { | |
| local pattern="${1//./\\.}" | |
| pyenv versions --bare 2>/dev/null | grep -E "^${pattern}\.[0-9]+$" | tail -1 | |
| } | |
| INSTALLED="" | |
| set +e | |
| for v in 3.9 3.10 3.11 3.12 3.13 3.14; do | |
| echo "=== Installing Python $v ===" | |
| if pyenv install "$v:latest"; then | |
| installed_version="$(plain_pyenv_version "$v")" | |
| if [ -n "$installed_version" ]; then | |
| INSTALLED="$INSTALLED $installed_version" | |
| else | |
| echo "WARNING: pyenv installed no non-free-threaded Python $v, skipping" | |
| fi | |
| else | |
| echo "Normal install failed, retrying without ensurepip..." | |
| installed_ver=$(pyenv latest "$v" 2>/dev/null) | |
| if [ -n "$installed_ver" ]; then pyenv uninstall -f "$installed_ver" 2>/dev/null; fi | |
| PYTHON_CONFIGURE_OPTS="--without-ensurepip" pyenv install "$v:latest" || true | |
| installed_version="$(plain_pyenv_version "$v")" | |
| if [ -n "$installed_version" ]; then | |
| INSTALLED="$INSTALLED $installed_version" | |
| echo "Python $installed_version binary installed (pip bootstrap deferred)" | |
| else | |
| echo "WARNING: Python $v install failed completely, skipping" | |
| fi | |
| fi | |
| done | |
| set -e | |
| if [ -z "$INSTALLED" ]; then echo "No Python installed!"; exit 1; fi | |
| pyenv global $INSTALLED | |
| echo "Installed versions:" | |
| pyenv versions | |
| - name: Install dependencies for all Python versions | |
| run: | | |
| export PATH="$HOME/.pyenv/bin:$PATH" | |
| eval "$(pyenv init -)" | |
| plain_pyenv_version() { | |
| local pattern="${1//./\\.}" | |
| pyenv versions --bare 2>/dev/null | grep -E "^${pattern}\.[0-9]+$" | tail -1 | |
| } | |
| for version in 3.9 3.10 3.11 3.12 3.13 3.14; do | |
| PYTHON_VERSION="$(plain_pyenv_version "$version")" | |
| if [ -z "$PYTHON_VERSION" ]; then continue; fi | |
| echo "Installing dependencies for Python $PYTHON_VERSION" | |
| pyenv shell "$PYTHON_VERSION" | |
| if ! python -m pip --version 2>/dev/null; then | |
| echo "pip missing, bootstrapping..." | |
| curl -sS https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py | |
| python /tmp/get-pip.py || python -m ensurepip --upgrade || true | |
| fi | |
| python -m pip install --upgrade pip | |
| python -m pip install setuptools tox pandas pyarrow twine wheel pytest pytest-cov | |
| pyenv shell --unset | |
| done | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Update version for release | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| export PATH="$HOME/.pyenv/bin:$PATH" | |
| eval "$(pyenv init -)" | |
| plain_pyenv_version() { | |
| local pattern="${1//./\\.}" | |
| pyenv versions --bare 2>/dev/null | grep -E "^${pattern}\.[0-9]+$" | tail -1 | |
| } | |
| PYTHON_VERSION="$(plain_pyenv_version 3.9)" | |
| if [ -z "$PYTHON_VERSION" ]; then echo "Python 3.9 not available"; exit 1; fi | |
| pyenv shell "$PYTHON_VERSION" | |
| python -m pip install bump-my-version | |
| TAG_NAME=${GITHUB_REF#refs/tags/v} | |
| bump-my-version replace --new-version $TAG_NAME | |
| echo "Version files updated to $TAG_NAME" | |
| pyenv shell --unset | |
| - name: Build wheel | |
| run: | | |
| export PATH="$HOME/.pyenv/bin:$PATH" | |
| eval "$(pyenv init -)" | |
| plain_pyenv_version() { | |
| local pattern="${1//./\\.}" | |
| pyenv versions --bare 2>/dev/null | grep -E "^${pattern}\.[0-9]+$" | tail -1 | |
| } | |
| PYTHON_VERSION="$(plain_pyenv_version 3.9)" | |
| if [ -z "$PYTHON_VERSION" ]; then echo "Python 3.9 not available"; exit 1; fi | |
| pyenv shell "$PYTHON_VERSION" | |
| make wheel | |
| - name: Show files | |
| run: | | |
| ls -lh dist | |
| shell: bash | |
| - name: Test DataStore on all Python versions with pandas 2.x and 3.x | |
| run: | | |
| export PATH="$HOME/.pyenv/bin:$PATH" | |
| eval "$(pyenv init -)" | |
| plain_pyenv_version() { | |
| local pattern="${1//./\\.}" | |
| pyenv versions --bare 2>/dev/null | grep -E "^${pattern}\.[0-9]+$" | tail -1 | |
| } | |
| for version in 3.9 3.10 3.11 3.12 3.13 3.14; do | |
| PYTHON_VERSION="$(plain_pyenv_version "$version")" | |
| if [ -z "$PYTHON_VERSION" ]; then | |
| echo "Python $version not available, skipping" | |
| continue | |
| fi | |
| # pandas 3.x requires Python >= 3.11 | |
| if [[ "$version" == "3.9" || "$version" == "3.10" ]]; then | |
| PANDAS_CONSTRAINTS=("pandas<3.0") | |
| else | |
| PANDAS_CONSTRAINTS=("pandas<3.0" "pandas>=3.0") | |
| fi | |
| for PANDAS_CONSTRAINT in "${PANDAS_CONSTRAINTS[@]}"; do | |
| echo "==============================================" | |
| echo "Testing DataStore on Python $PYTHON_VERSION with $PANDAS_CONSTRAINT" | |
| echo "==============================================" | |
| pyenv shell "$PYTHON_VERSION" | |
| python -m pip install dist/*.whl --force-reinstall | |
| python -m pip install pytest pytest-cov hypothesis ray "$PANDAS_CONSTRAINT" | |
| echo "Installed pandas version:" | |
| python -c "import pandas; print(pandas.__version__)" | |
| echo "Running DataStore tests on Python $PYTHON_VERSION with $PANDAS_CONSTRAINT ..." | |
| cd datastore | |
| python -m pytest tests/ -v --tb=short -x | |
| cd .. | |
| echo "==============================================" | |
| echo "DataStore tests PASSED on Python $PYTHON_VERSION with $PANDAS_CONSTRAINT" | |
| echo "==============================================" | |
| pyenv shell --unset | |
| done | |
| done | |
| continue-on-error: false | |
| - name: Upload wheels to release | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| gh release upload ${{ github.ref_name }} dist/*.whl --clobber | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: chdb-wheel | |
| path: ./dist/*.whl | |
| overwrite: true | |
| - name: Upload pypi | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| export PATH="$HOME/.pyenv/bin:$PATH" | |
| eval "$(pyenv init -)" | |
| plain_pyenv_version() { | |
| local pattern="${1//./\\.}" | |
| pyenv versions --bare 2>/dev/null | grep -E "^${pattern}\.[0-9]+$" | tail -1 | |
| } | |
| PYTHON_VERSION="$(plain_pyenv_version 3.9)" | |
| if [ -z "$PYTHON_VERSION" ]; then echo "Python 3.9 not available"; exit 1; fi | |
| pyenv shell "$PYTHON_VERSION" | |
| python -m twine upload dist/*.whl | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |