| # |
| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| # |
| |
| name: Build release wheels |
| on: |
| push: |
| tags: |
| - '*' |
| |
| concurrency: |
| group: ${{ github.workflow }}-${{ github.ref }} |
| cancel-in-progress: true |
| |
| jobs: |
| |
| linux-wheel: |
| name: Wheel ${{matrix.image.name}} - Py ${{matrix.python.version}} - ${{matrix.cpu.platform}} |
| runs-on: ubuntu-22.04 |
| timeout-minutes: 300 |
| |
| strategy: |
| fail-fast: false |
| matrix: |
| image: |
| - {name: 'manylinux2014', py_suffix: ''} |
| - {name: 'manylinux_musl', py_suffix: '-alpine'} |
| python: |
| - {version: '3.8', spec: 'cp38-cp38'} |
| - {version: '3.9', spec: 'cp39-cp39'} |
| - {version: '3.10', spec: 'cp310-cp310'} |
| - {version: '3.11', spec: 'cp311-cp311'} |
| - {version: '3.12', spec: 'cp312-cp312'} |
| cpu: |
| - {arch: 'x86_64', platform: 'x86_64'} |
| - {arch: 'aarch64', platform: 'arm64'} |
| |
| steps: |
| - name: checkout |
| uses: actions/checkout@v3 |
| |
| - name: Set up QEMU |
| uses: docker/setup-qemu-action@v2 |
| |
| - uses: docker/setup-buildx-action@v2 |
| - run: build-support/copy-deps-versionfile.sh |
| |
| - name: Build Manylinux Docker image |
| uses: docker/build-push-action@v3 |
| with: |
| context: ./pkg/${{matrix.image.name}} |
| load: true |
| tags: build:latest |
| platforms: linux/${{matrix.cpu.arch}} |
| build-args: | |
| PLATFORM=${{matrix.cpu.platform}} |
| ARCH=${{matrix.cpu.arch}} |
| PYTHON_VERSION=${{matrix.python.version}} |
| PYTHON_SPEC=${{matrix.python.spec}} |
| cache-from: type=gha |
| cache-to: type=gha,mode=max |
| |
| - name: Build wheel file |
| run: | |
| docker run -i -v $PWD:/pulsar-client-python build:latest \ |
| /pulsar-client-python/pkg/build-wheel-inside-docker.sh |
| |
| - name: Test wheel file |
| run: | |
| docker run -i -v $PWD:/pulsar-client-python \ |
| --platform linux/${{matrix.cpu.arch}} \ |
| python:${{matrix.python.version}}${{matrix.image.py_suffix}} \ |
| /pulsar-client-python/pkg/test-wheel.sh |
| |
| - name: Upload artifacts |
| uses: actions/upload-artifact@v3 |
| with: |
| name: wheel-${{matrix.image.name}}-py${{matrix.python.version}}-${{matrix.cpu.platform}} |
| path: wheelhouse/*.whl |
| |
| mac-wheels: |
| name: Wheel MacOS Universal2 - Py ${{matrix.py.version}} |
| runs-on: macos-12 |
| timeout-minutes: 300 |
| |
| strategy: |
| fail-fast: false |
| matrix: |
| py: |
| - {version: '3.8', version_long: '3.8.13'} |
| - {version: '3.9', version_long: '3.9.14'} |
| - {version: '3.10', version_long: '3.10.7'} |
| - {version: '3.11', version_long: '3.11.1'} |
| - {version: '3.12', version_long: '3.12.0'} |
| |
| steps: |
| - name: checkout |
| uses: actions/checkout@v3 |
| |
| - name: Dependencies cache |
| uses: actions/cache@v3 |
| id: cache-deps |
| with: |
| path: .pulsar-mac-build/deps/install |
| key: ${{matrix.py.version_long}}-${{ hashFiles('dependencies.yaml') }}-${{ hashFiles('pkg/mac/*') }} |
| |
| - name: Build dependencies |
| if: steps.cache-deps.outputs.cache-hit != 'true' |
| run: pkg/mac/build-dependencies.sh ${{matrix.py.version}} ${{matrix.py.version_long}} |
| |
| - name: Pulsar C++ cache |
| uses: actions/cache@v3 |
| id: cache-cpp |
| with: |
| path: .pulsar-mac-build/cpp/install |
| key: ${{ hashFiles('dependencies.yaml') }}-${{ hashFiles('pulsar-client-cpp-version.txt') }}-${{ hashFiles('pkg/mac/*') }} |
| |
| - name: Build Pulsar C++ client |
| if: steps.cache-cpp.outputs.cache-hit != 'true' |
| run: pkg/mac/build-pulsar-cpp.sh |
| |
| - name: Build and test Mac wheels |
| run: pkg/mac/build-mac-wheels.sh ${{matrix.py.version}} |
| |
| - name: Upload artifacts |
| uses: actions/upload-artifact@v3 |
| with: |
| name: wheel-mac-py${{matrix.py.version}} |
| path: dist/*.whl |
| |
| windows-wheels: |
| name: Wheel Windows - Py ${{matrix.python.version}} |
| runs-on: windows-2019 |
| env: |
| PULSAR_CPP_DIR: 'C:\\pulsar-cpp' |
| timeout-minutes: 300 |
| |
| strategy: |
| fail-fast: false |
| matrix: |
| python: |
| - {version: '3.8'} |
| - {version: '3.9'} |
| - {version: '3.10'} |
| - {version: '3.11'} |
| - {version: '3.12'} |
| |
| steps: |
| - uses: actions/checkout@v3 |
| |
| - uses: actions/setup-python@v4 |
| with: |
| python-version: ${{ matrix.python.version }} |
| |
| - name: Download Pulsar C++ client on Windows |
| shell: bash |
| run: | |
| source ./build-support/dep-url.sh |
| BASE_URL=$(pulsar_cpp_base_url $(grep pulsar-cpp dependencies.yaml | awk '{print $2}')) |
| mkdir -p ${{ env.PULSAR_CPP_DIR }} |
| cd ${{ env.PULSAR_CPP_DIR }} |
| curl -O -L ${BASE_URL}/x64-windows-static.tar.gz |
| tar zxf x64-windows-static.tar.gz |
| mv x64-windows-static/* . |
| ls -l ${{ env.PULSAR_CPP_DIR }} |
| |
| - name: Configure CMake |
| shell: bash |
| run: | |
| pip3 install pyyaml |
| export PYBIND11_VERSION=$(./build-support/dep-version.py pybind11) |
| curl -L -O https://github.com/pybind/pybind11/archive/refs/tags/v${PYBIND11_VERSION}.tar.gz |
| tar zxf v${PYBIND11_VERSION}.tar.gz |
| rm -rf pybind11 |
| mv pybind11-${PYBIND11_VERSION} pybind11 |
| cmake -B build -A x64 \ |
| -DCMAKE_PREFIX_PATH=${{ env.PULSAR_CPP_DIR }} \ |
| -DLINK_STATIC=ON |
| |
| - name: Build Python wheel |
| shell: bash |
| run: | |
| cmake --build build --config Release --target install |
| python -m pip install wheel setuptools |
| python setup.py bdist_wheel |
| python -m pip install ./dist/*.whl |
| python -c 'import pulsar; c = pulsar.Client("pulsar://localhost:6650"); c.close()' |
| |
| - name: Upload artifacts |
| uses: actions/upload-artifact@v3 |
| with: |
| name: wheel-windows-py${{matrix.python.version}} |
| path: dist/*.whl |