|
| 1 | +name: Build macOS arm64 |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + TAG_NAME: |
| 7 | + description: 'Release Version Tag' |
| 8 | + required: true |
| 9 | + release: |
| 10 | + types: [created] |
| 11 | + push: |
| 12 | + branches: |
| 13 | + - main |
| 14 | + paths-ignore: |
| 15 | + - '**/*.md' |
| 16 | + pull_request: |
| 17 | + branches: |
| 18 | + - main |
| 19 | + paths-ignore: |
| 20 | + - '**/*.md' |
| 21 | + |
| 22 | +jobs: |
| 23 | + build_wheels_macos_13: |
| 24 | + name: ${{ matrix.os }} py${{ matrix.python-version }} |
| 25 | + runs-on: ${{ matrix.os }} |
| 26 | + strategy: |
| 27 | + fail-fast: false |
| 28 | + matrix: |
| 29 | + os: [ macos-13-xlarge ] |
| 30 | + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] |
| 31 | + env: |
| 32 | + RUNNER_OS: ${{ matrix.os }} |
| 33 | + PYTHON_VERSION: ${{ matrix.python-version }} |
| 34 | + steps: |
| 35 | + - name: Install python |
| 36 | + uses: actions/setup-python@v4 |
| 37 | + with: |
| 38 | + python-version: "${{ matrix.python-version }}" |
| 39 | + - name: Remove /usr/local/bin/python3 |
| 40 | + run: | |
| 41 | + sudo rm -f /usr/local/bin/python3 |
| 42 | + - name: Install clang++ for macOS |
| 43 | + run: | |
| 44 | + pwd |
| 45 | + uname -a |
| 46 | + export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 |
| 47 | + brew update |
| 48 | + brew install ca-certificates lz4 mpdecimal openssl@3 readline sqlite xz z3 zstd |
| 49 | + brew install --ignore-dependencies llvm@19 |
| 50 | + brew install git ccache ninja libtool gettext gcc binutils grep findutils nasm |
| 51 | + cd /usr/local/opt/ && sudo rm -f llvm && sudo ln -sf llvm@19 llvm |
| 52 | + export PATH=$(brew --prefix llvm@19)/bin:$PATH |
| 53 | + which clang++ |
| 54 | + clang++ --version |
| 55 | + ccache -s |
| 56 | + - uses: actions/checkout@v3 |
| 57 | + with: |
| 58 | + fetch-depth: 0 |
| 59 | + - name: Update submodules |
| 60 | + run: | |
| 61 | + git submodule update --init --recursive --jobs 4 |
| 62 | + - name: ccache |
| 63 | + uses: hendrikmuhs/[email protected] |
| 64 | + with: |
| 65 | + key: ${{ matrix.os }} |
| 66 | + max-size: 5G |
| 67 | + append-timestamp: true |
| 68 | + - name: Run chdb/build.sh |
| 69 | + timeout-minutes: 300 |
| 70 | + run: | |
| 71 | + python3 -m pip install pybind11 setuptools |
| 72 | + export PATH=$(brew --prefix llvm@19)/bin:/usr/local/opt/grep/libexec/gnubin:/usr/local/opt/binutils/bin:$PATH:/usr/local/opt/findutils/libexec/gnubin |
| 73 | + export CC=$(brew --prefix llvm@19)/bin/clang |
| 74 | + export CXX=$(brew --prefix llvm@19)/bin/clang++ |
| 75 | + bash gen_manifest.sh |
| 76 | + bash ./chdb/build.sh |
| 77 | + python3 -m pip install pandas pyarrow |
| 78 | + bash -x ./chdb/test_smoke.sh |
| 79 | + continue-on-error: false |
| 80 | + - name: Debug libchdb |
| 81 | + run: | |
| 82 | + ls -lh |
| 83 | + llvm-nm libchdb.so | grep query_stable || true |
| 84 | + echo "Global Symbol in libchdb.so:" |
| 85 | + llvm-nm -g libchdb.so || true |
| 86 | + echo "Global Symbol in libclickhouse-local-chdb.a:" |
| 87 | + llvm-nm -g buildlib/programs/local/libclickhouse-local-chdb.a || true |
| 88 | + echo "Global Symbol in libclickhouse-local-lib.a:" |
| 89 | + llvm-nm -g buildlib/programs/local/libclickhouse-local-lib.a || true |
| 90 | + echo "pychdb_cmd.sh:" |
| 91 | + cat buildlib/pychdb_cmd.sh |
| 92 | + echo "libchdb_cmd.sh:" |
| 93 | + cat buildlib/libchdb_cmd.sh |
| 94 | + - name: Run libchdb stub in examples dir |
| 95 | + run: | |
| 96 | + bash -x ./examples/runStub.sh |
| 97 | + - name: Keep killall ccache and wait for ccache to finish |
| 98 | + if: always() |
| 99 | + run: | |
| 100 | + sleep 60 |
| 101 | + while ps -ef | grep ccache | grep -v grep; do \ |
| 102 | + killall ccache; \ |
| 103 | + sleep 10; \ |
| 104 | + done |
| 105 | + - name: Check ccache statistics |
| 106 | + run: | |
| 107 | + ccache -s |
| 108 | + ls -lh chdb |
| 109 | + df -h |
| 110 | + env: |
| 111 | + CIBW_ENVIRONMENT_MACOS: "PATH=$(brew --prefix llvm@19)/bin:/usr/local/opt/grep/libexec/gnubin:/usr/local/opt/binutils/bin:$PATH:/usr/local/opt/findutils/libexec/gnubin CC=$(brew --prefix llvm@19)/bin/clang CXX=$(brew --prefix llvm@19)/bin/clang++" |
| 112 | + - name: Install dependencies for building wheels |
| 113 | + run: | |
| 114 | + python3 -m pip install -U pip tox pybind11 twine setuptools wheel>=0.40.0 |
| 115 | + - name: Build wheels |
| 116 | + run: | |
| 117 | + export PATH=$(brew --prefix llvm@19)/bin:/usr/local/opt/grep/libexec/gnubin:/usr/local/opt/binutils/bin:$PATH:/usr/local/opt/findutils/libexec/gnubin |
| 118 | + export CC=$(brew --prefix llvm@19)/bin/clang |
| 119 | + export CXX=$(brew --prefix llvm@19)/bin/clang++ |
| 120 | + make wheel |
| 121 | + - name: Fix wheel platform tag |
| 122 | + run: | |
| 123 | + python3 -m wheel tags --platform-tag=macosx_11_0_arm64 --remove dist/*.whl |
| 124 | + - name: Run tests |
| 125 | + run: | |
| 126 | + python3 -m pip install dist/*.whl |
| 127 | + python3 -m pip install pandas pyarrow psutil |
| 128 | + python3 -c "import chdb; res = chdb.query('select 1112222222,555', 'CSV'); print(res)" |
| 129 | + make test |
| 130 | + continue-on-error: false |
| 131 | + - name: Show files |
| 132 | + run: ls -lh dist |
| 133 | + shell: bash |
| 134 | + - name: Upload wheels to release |
| 135 | + if: startsWith(github.ref, 'refs/tags/v') |
| 136 | + run: | |
| 137 | + gh release upload ${{ github.ref_name }} dist/*.whl --clobber |
| 138 | + env: |
| 139 | + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
| 140 | + - name: Packege libchdb.so |
| 141 | + if: matrix.python-version == '3.12' |
| 142 | + run: | |
| 143 | + cp programs/local/chdb.h chdb.h |
| 144 | + tar -czvf macos-arm64-libchdb.tar.gz libchdb.so chdb.h |
| 145 | + - name: Upload libchdb.so to release |
| 146 | + if: startsWith(github.ref, 'refs/tags/v') && matrix.python-version == '3.12' |
| 147 | + run: | |
| 148 | + gh release upload ${{ github.ref_name }} macos-arm64-libchdb.tar.gz --clobber |
| 149 | + env: |
| 150 | + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
| 151 | + - uses: actions/upload-artifact@v4 |
| 152 | + with: |
| 153 | + name: chdb-artifacts-macos-arm64-${{ matrix.python-version }} |
| 154 | + path: | |
| 155 | + ./dist/*.whl |
| 156 | + ./macos-arm64-libchdb.tar.gz |
| 157 | + overwrite: true |
| 158 | + - name: Upload pypi |
| 159 | + if: startsWith(github.ref, 'refs/tags/v') |
| 160 | + run: | |
| 161 | + python3 -m pip install twine |
| 162 | + python3 -m twine upload dist/*.whl |
| 163 | + env: |
| 164 | + TWINE_USERNAME: __token__ |
| 165 | + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |
0 commit comments