|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, master, feature/** ] |
| 6 | + pull_request: |
| 7 | + branches: [ main, master ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + lint-and-test: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Set up Python |
| 17 | + uses: actions/setup-python@v5 |
| 18 | + with: |
| 19 | + python-version: '3.12' |
| 20 | + |
| 21 | + - name: Install GDAL system dependencies |
| 22 | + run: | |
| 23 | + sudo apt-get update |
| 24 | + sudo apt-get install -y gdal-bin libgdal-dev |
| 25 | +
|
| 26 | + - name: Get GDAL version |
| 27 | + id: gdal-version |
| 28 | + run: | |
| 29 | + GDAL_VERSION=$(gdal-config --version) |
| 30 | + echo "GDAL version: $GDAL_VERSION" |
| 31 | + echo "version=$GDAL_VERSION" >> $GITHUB_OUTPUT |
| 32 | +
|
| 33 | + - name: Install Python dependencies |
| 34 | + env: |
| 35 | + GDAL_VERSION: ${{ steps.gdal-version.outputs.version }} |
| 36 | + run: | |
| 37 | + python -m pip install --upgrade pip |
| 38 | + # Install build dependencies first (numpy<2 needed for GDAL compatibility) |
| 39 | + pip install setuptools wheel "numpy<2" |
| 40 | + # Install GDAL Python bindings with --no-build-isolation |
| 41 | + # This allows GDAL to see the numpy we just installed |
| 42 | + pip install --no-build-isolation --no-cache-dir GDAL==$GDAL_VERSION |
| 43 | + # Install all other dependencies (excluding GDAL and numpy from requirements.txt) |
| 44 | + grep -v -e "^gdal" -e "^numpy" requirements.txt > requirements_no_gdal_numpy.txt |
| 45 | + pip install -r requirements_no_gdal_numpy.txt |
| 46 | + # Install test/dev dependencies |
| 47 | + pip install pytest pytest-cov ruff |
| 48 | +
|
| 49 | + - name: Verify GDAL installation |
| 50 | + run: | |
| 51 | + python -c "from osgeo import gdal; print(f'GDAL version: {gdal.__version__}')" |
| 52 | + python -c "from osgeo import gdal_array; print('GDAL array support: OK')" |
| 53 | +
|
| 54 | + - name: Run ruff (lint) |
| 55 | + run: | |
| 56 | + ruff check . --exit-zero |
| 57 | +
|
| 58 | + - name: Run tests |
| 59 | + run: | |
| 60 | + pytest -q -m "not earth_engine and not slow" |
0 commit comments