| # 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 |
| |
| on: |
| push: |
| branches: |
| - main |
| pull_request: |
| branches: |
| - main |
| paths: |
| - '.github/workflows/python.yaml' |
| - 'src/nanoarrow/**' |
| - 'python/**' |
| |
| jobs: |
| test-python: |
| |
| runs-on: ${{ matrix.os }} |
| strategy: |
| matrix: |
| os: [ubuntu-latest] |
| python-version: ['3.10'] |
| |
| steps: |
| - uses: actions/checkout@v3 |
| |
| - name: Set up Python ${{ matrix.python-version }} |
| uses: actions/setup-python@v4 |
| with: |
| python-version: ${{ matrix.python-version }} |
| cache: 'pip' |
| |
| - name: Install nanoarrow |
| run: | |
| pushd python |
| pip install .[test] |
| popd |
| pip list |
| |
| - name: Run tests |
| run: | |
| pytest python/tests -v -s |
| |
| - name: Run doctests |
| if: success() && matrix.python-version == '3.10' |
| run: | |
| pip install pytest-cython |
| pytest --pyargs nanoarrow --doctest-cython |
| |
| - name: Coverage |
| if: success() && matrix.python-version == '3.10' |
| run: | |
| pip uninstall --yes nanoarrow |
| pip install pytest-cov Cython |
| pushd python |
| |
| # Build with Cython + gcc coverage options |
| pip install -e . |
| NANOARROW_PYTHON_COVERAGE=1 python setup.py build_ext --inplace |
| |
| # Run tests + coverage.py (generates .coverage + coverage.xml files) |
| python -m pytest --cov ./src/nanoarrow |
| python -m coverage xml |
| |
| - name: Upload coverage to codecov |
| if: success() && matrix.python-version == '3.10' |
| uses: codecov/codecov-action@v2 |
| with: |
| files: 'python/coverage.xml' |