| # |
| # 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: PR validation |
| on: |
| pull_request: |
| branches: ['main'] |
| |
| concurrency: |
| group: ${{ github.workflow }}-${{ github.ref }} |
| cancel-in-progress: true |
| |
| jobs: |
| |
| unit-tests: |
| name: Run unit tests |
| runs-on: ubuntu-22.04 |
| timeout-minutes: 120 |
| |
| steps: |
| - name: checkout |
| uses: actions/checkout@v3 |
| |
| - name: Install deps |
| run: sudo apt-get install -y libboost-python-dev |
| |
| - name: Install Pulsar C++ client |
| run: build-support/install-cpp-client.sh |
| |
| - name: CMake |
| run: cmake . |
| |
| - name: Build |
| run: make -j8 |
| |
| - name: Python install |
| run: | |
| ./setup.py bdist_wheel |
| WHEEL=$(find dist -name '*.whl') |
| pip3 install ${WHEEL}[avro] |
| |
| - name: Start Pulsar service |
| run: ./build-support/pulsar-test-service-start.sh |
| |
| - name: Run unit tests |
| run: ./tests/run-unit-tests.sh |
| |
| - name: Stop Pulsar service |
| run: ./build-support/pulsar-test-service-stop.sh |
| |
| |
| 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.10', spec: 'cp310-cp310'} |
| cpu: |
| - {arch: 'x86_64', platform: 'x86_64'} |
| |
| 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 python:${{matrix.python.version}}${{matrix.image.py_suffix}} \ |
| /pulsar-client-python/pkg/test-wheel.sh |
| |
| mac-wheels: |
| name: Wheel MacOS Universal2 - Py ${{matrix.py.version}} |
| runs-on: macos-12 |
| timeout-minutes: 300 |
| |
| strategy: |
| matrix: |
| py: |
| - {version: '3.10', version_long: '3.10.7'} |
| |
| 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}} |