|
| 1 | +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions |
| 2 | +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python |
| 3 | + |
| 4 | +name: Python Pull Request CI |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: ["main"] |
| 9 | + pull_request: |
| 10 | + branches: ["main"] |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + container: ghcr.io/osgeo/gdal:ubuntu-small-3.11.0 |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + python-version: ["3.10"] |
| 20 | + |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v5 |
| 23 | + |
| 24 | + - name: Set up Python ${{ matrix.python-version }} |
| 25 | + uses: actions/setup-python@v5 |
| 26 | + with: |
| 27 | + python-version: ${{ matrix.python-version }} |
| 28 | + |
| 29 | + - name: Install system dependencies |
| 30 | + run: | |
| 31 | + apt-get update -qqy |
| 32 | + apt-get install -y git python3-pip r-base libtirpc-dev |
| 33 | +
|
| 34 | + - name: Install R dependencies |
| 35 | + run: R -e "install.packages(c('lme4', 'lmerTest'), repos='https://cran.rstudio.com/')" || true |
| 36 | + |
| 37 | + - name: Install Python dependencies |
| 38 | + run: | |
| 39 | + python -m pip install --upgrade pip |
| 40 | + python -m pip install 'gdal[numpy]==3.11.0' |
| 41 | + python -m pip install -e .[dev,validation] |
| 42 | +
|
| 43 | + - name: Lint with pylint |
| 44 | + run: python3 -m pylint . |
| 45 | + |
| 46 | + - name: Type checking |
| 47 | + run: python3 -m mypy . |
| 48 | + |
| 49 | + - name: Test with pytest |
| 50 | + run: python3 -m pytest --cov=aoh -vv |
| 51 | + |
| 52 | + - name: Test CLI tools |
| 53 | + run: | |
| 54 | + aoh-calc --help |
| 55 | + aoh-habitat-process --help |
| 56 | + aoh-species-richness --help |
| 57 | + aoh-endemism --help |
| 58 | + aoh-collate-data --help |
| 59 | + aoh-validate-prevalence --help |
| 60 | +
|
| 61 | + - name: Test package imports |
| 62 | + run: | |
| 63 | + python3 -c "import aoh; print('✅ Package imports work')" |
| 64 | + python3 -c "from aoh import tidy_data; print('✅ Core functions work')" |
| 65 | + python3 -c "from aoh.summaries import species_richness; print('✅ Summaries work')" |
| 66 | + python3 -c "from aoh.validation import collate_data; print('✅ Validation works')" |
| 67 | +
|
| 68 | + - name: Build pip package |
| 69 | + run: python3 -m build |
| 70 | + |
| 71 | + - name: Check with twine |
| 72 | + run: twine check dist/* |
0 commit comments