| # 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: Test - python client |
| on: |
| pull_request: |
| branches: |
| - master |
| - 'v[0-9]+.*' # release branch |
| - ci-test # testing branch for github action |
| - '*dev' # developing branch |
| paths: |
| - .github/workflows/test_python-client.yml |
| - python-client/** |
| |
| workflow_dispatch: |
| |
| defaults: |
| run: |
| shell: bash |
| |
| env: |
| ARTIFACT_NAME: release_for_python_client |
| |
| jobs: |
| build_server: |
| name: Build server |
| runs-on: ubuntu-latest |
| env: |
| USE_JEMALLOC: OFF |
| BUILD_OPTIONS: -t release |
| container: |
| image: apache/pegasus:thirdparties-bin-test-ubuntu2204-${{ github.base_ref }} |
| steps: |
| - uses: actions/checkout@v4 |
| - uses: "./.github/actions/rebuild_thirdparty_if_needed" |
| - uses: "./.github/actions/build_pegasus" |
| - uses: "./.github/actions/upload_artifact" |
| |
| test: |
| name: Test Python client |
| needs: build_server |
| runs-on: ubuntu-latest |
| container: |
| image: apache/pegasus:thirdparties-bin-test-ubuntu2204-${{ github.base_ref }} |
| steps: |
| - uses: actions/checkout@v4 |
| - uses: actions/setup-python@v5 |
| with: |
| python-version: '3.11' |
| # python-client imports thrift package of 0.13.0, so we must use thrift-compiler 0.13.0 |
| # to generate code as well. The thrift-compiler version on ubuntu-22.04 is 0.16.0, so |
| # build and install thrift-compiler 0.13.0 manually. |
| - name: Install thrift |
| run: | |
| export THRIFT_VERSION=0.13.0 |
| wget --progress=dot:giga https://github.com/apache/thrift/archive/refs/tags/v${THRIFT_VERSION}.tar.gz |
| tar -xzf v${THRIFT_VERSION}.tar.gz |
| cd thrift-${THRIFT_VERSION} |
| ./bootstrap.sh |
| ./configure --enable-libs=no |
| make -j $(nproc) |
| make install |
| cd - && rm -rf thrift-${THRIFT_VERSION} v${THRIFT_VERSION}.tar.gz |
| - name: Download artifact |
| uses: "./.github/actions/download_artifact" |
| - name: Start Pegasus cluster |
| run: | |
| export LD_LIBRARY_PATH=$(pwd)/thirdparty/output/lib:${JAVA_HOME}/jre/lib/amd64/server |
| ulimit -s unlimited |
| ./run.sh start_onebox |
| - name: Run Python client tests |
| working-directory: ./python-client |
| run: | |
| python -m pip install -r requirement.txt |
| thrift -v --gen py -out . ../idl/dsn.layer2.thrift |
| thrift -v --gen py -out . ../idl/rrdb.thrift |
| python setup.py install |
| python sample.py |
| cd tests |
| python -m unittest -v test_basics.TestBasics |