|
| 1 | +name: Build arm64 |
| 2 | + |
| 3 | +on: |
| 4 | + # for test action |
| 5 | + pull_request: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + - feat/add-arm-wheel-build |
| 9 | + # end for test action |
| 10 | + workflow_dispatch: |
| 11 | + inputs: |
| 12 | + TAG_NAME: |
| 13 | + description: 'Release Version Tag' |
| 14 | + required: true |
| 15 | + release: |
| 16 | + types: [created] |
| 17 | + |
| 18 | +defaults: |
| 19 | + run: |
| 20 | + shell: bash -leo pipefail {0} |
| 21 | + |
| 22 | +jobs: |
| 23 | + build_wheels_linux_arm64: |
| 24 | + name: ${{ matrix.os }} py${{ matrix.python-version }} |
| 25 | + runs-on: |
| 26 | + - self-hosted |
| 27 | + - ARM64 |
| 28 | + strategy: |
| 29 | + fail-fast: false |
| 30 | + matrix: |
| 31 | + os: [ ubuntu-20.04 ] |
| 32 | + env: |
| 33 | + RUNNER_OS: ${{ matrix.os }} |
| 34 | + PYTHON_VERSIONS: "3.8 3.9 3.10 3.11" |
| 35 | + steps: |
| 36 | + - name: Install clang++ for Ubuntu |
| 37 | + if: matrix.os == 'ubuntu-20.04' |
| 38 | + run: | |
| 39 | + pwd |
| 40 | + uname -a |
| 41 | + wget https://apt.llvm.org/llvm.sh |
| 42 | + chmod +x llvm.sh |
| 43 | + sudo ./llvm.sh 15 |
| 44 | + which clang++-15 |
| 45 | + clang++-15 --version |
| 46 | + sudo apt-get install -y make cmake ccache ninja-build yasm gawk wget |
| 47 | + ccache -s |
| 48 | + - name: Update git |
| 49 | + run: | |
| 50 | + sudo add-apt-repository ppa:git-core/ppa -y |
| 51 | + sudo apt-get update |
| 52 | + sudo apt-get install -y git |
| 53 | + git --version |
| 54 | + shell: bash -l {0} |
| 55 | + - uses: actions/checkout@v3 |
| 56 | + with: |
| 57 | + fetch-depth: 0 |
| 58 | + - name: Restore submodules cache |
| 59 | + uses: actions/cache/restore@v3 |
| 60 | + id: cache |
| 61 | + with: |
| 62 | + path: | |
| 63 | + contrib/** |
| 64 | + key: | |
| 65 | + submodule-${{ hashFiles('.gitmodules') }} |
| 66 | + - name: Update submodules if cache miss |
| 67 | + if: steps.cache.outputs.cache-hit != 'true' |
| 68 | + run: | |
| 69 | + git submodule update --init --recursive --jobs 4 |
| 70 | + - name: Save submodules cache |
| 71 | + if: steps.cache.outputs.cache-hit != 'true' |
| 72 | + uses: actions/cache/save@v3 |
| 73 | + with: |
| 74 | + path: | |
| 75 | + contrib/** |
| 76 | + key: | |
| 77 | + submodule-${{ hashFiles('.gitmodules') }} |
| 78 | + - name: ccache |
| 79 | + uses: hendrikmuhs/ccache-action@v1.2 |
| 80 | + with: |
| 81 | + key: ${{ matrix.os }} |
| 82 | + max-size: 5G |
| 83 | + append-timestamp: true |
| 84 | + - name: remove old clang and link clang-15 to clang |
| 85 | + if: matrix.os == 'ubuntu-20.04' |
| 86 | + run: | |
| 87 | + sudo rm /usr/bin/clang |
| 88 | + sudo ln -s /usr/bin/clang-15 /usr/bin/clang |
| 89 | + sudo rm /usr/bin/clang++ |
| 90 | + sudo ln -s /usr/bin/clang++-15 /usr/bin/clang++ |
| 91 | + which clang++ |
| 92 | + clang++ --version |
| 93 | + - name: Make linux-arm64 |
| 94 | + run: | |
| 95 | + #make linux-arm64 |
| 96 | + bash -l -e chdb/build_linux_arm64.sh |
| 97 | + continue-on-error: false |
| 98 | + - name: Check ccache statistics |
| 99 | + run: | |
| 100 | + ccache -s |
| 101 | + ls -lh chdb |
| 102 | + df -h |
| 103 | + - name: Install patchelf from github |
| 104 | + run: | |
| 105 | + pyenv local "${{ matrix.python-version }}" |
| 106 | + wget https://github.com/NixOS/patchelf/releases/download/0.18.0/patchelf-0.18.0-aarch64.tar.gz -O patchelf.tar.gz |
| 107 | + tar -xvf patchelf.tar.gz |
| 108 | + sudo cp bin/patchelf /usr/bin/ |
| 109 | + sudo chmod +x /usr/bin/patchelf |
| 110 | + patchelf --version |
| 111 | + - name: Audit wheels |
| 112 | + run: | |
| 113 | + pyenv local "${{ matrix.python-version }}" |
| 114 | + python3 -m pip install auditwheel |
| 115 | + auditwheel -v repair -w dist/ --plat manylinux_2_17_aarch64 dist/*.whl |
| 116 | + continue-on-error: false |
| 117 | + - name: Show files |
| 118 | + run: | |
| 119 | + # e.g: remove chdb-0.11.4-cp310-cp310-linux_aarch64.whl, keep chdb-0.11.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
| 120 | + sudo rm -f dist/*linux_aarch64.whl |
| 121 | + ls -lh dist |
| 122 | + shell: bash |
| 123 | + continue-on-error: false |
| 124 | + - uses: actions/upload-artifact@v3 |
| 125 | + with: |
| 126 | + path: ./dist/*.whl |
| 127 | + - name: Upload pypi |
| 128 | + if: startsWith(github.ref, 'refs/tags/v') |
| 129 | + run: | |
| 130 | + pyenv local "${{ matrix.python-version }}" |
| 131 | + python3 -m pip install twine |
| 132 | + python3 -m twine upload wheelhouse/*.whl |
| 133 | + env: |
| 134 | + TWINE_USERNAME: __token__ |
| 135 | + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |
| 136 | + |
| 137 | + # #build for macos12 arm64(Apple Silicon) |
| 138 | + # build_wheels_macos_arm64: |
| 139 | + |
| 140 | + runner_cleanup_arm64: |
| 141 | + name: Wipe Caches on Self-Hosted Runners |
| 142 | + needs: [ build_wheels_linux_arm64 ] |
| 143 | + if: always() |
| 144 | + runs-on: |
| 145 | + - self-hosted |
| 146 | + - ARM64 |
| 147 | + steps: |
| 148 | + - name: Actions Cache Cleanup |
| 149 | + run: if [ "$(which action_cleanup)" != "" ]; then action_cleanup; else echo bypass; fi |
0 commit comments