Skip to content

chore: Add pre-commit and explicit compiler warnings #246

chore: Add pre-commit and explicit compiler warnings

chore: Add pre-commit and explicit compiler warnings #246

Workflow file for this run

name: test-python
on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- '.github/workflows/python.yaml'
- 'src/geoarrow/**'
- 'python/**'
jobs:
test-python:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install (geoarrow-c)
run: |
pushd python/geoarrow-c
pip install ".[test]"
- name: Run tests (geoarrow-c)
run: |
pytest python/geoarrow-c/tests -v -s
- name: Install coverage dependencies
run: |
sudo apt-get install -y lcov
pip install pytest-cov Cython
- name: Install editable
run: |
pip install -e python/geoarrow-c/
- name: Coverage (geoarrow-c)
if: success() && matrix.python-version == '3.12'
run: |
pip install setuptools Cython
pushd python/geoarrow-c
# Build with Cython + gcc coverage options
GEOARROW_COVERAGE=1 python setup.py build_ext --inplace
# Run tests
python -m pytest --cov ./src/geoarrow ..
# Generate xml Python coverage
python -m coverage xml
# Generate C coverage
lcov \
--capture --directory build \
--exclude "/usr/*" \
--exclude "/opt/*" \
--exclude "/Library/*" \
--exclude "*/_lib.cpp" \
--exclude "*/src/geoarrow/c/geoarrow/*" \
--output-file=coverage.info
lcov --list coverage.info
popd
- name: Upload coverage to codecov
if: success() && matrix.python-version == '3.12'
uses: codecov/codecov-action@v2
with:
files: 'python/geoarrow-c/coverage.info,python/geoarrow-c/coverage.xml'
- name: Run doctests
if: success() && matrix.python-version == '3.12'
run: |
pushd python/geoarrow-c
pytest --pyargs geoarrow.c --doctest-modules