name: GeoDjango Tests on: pull_request: types: [labeled, synchronize, opened, reopened] paths-ignore: - 'docs/**' concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true permissions: contents: read jobs: postgis: if: contains(github.event.pull_request.labels.*.name, 'geodjango') runs-on: ubuntu-latest defaults: run: # Use Conda shell in all steps. See https://github.com/marketplace/actions/setup-miniconda#use-a-default-shell shell: bash -el {0} strategy: fail-fast: false matrix: include: - conda-environment-file: ".github/workflows/data/conda/geolibs-pg17-gil.yml" pg_major: "17" python: "3.14" - conda-environment-file: ".github/workflows/data/conda/geolibs-pg17-freethreading.yml" pg_major: "17" python: "3.14t" - conda-environment-file: ".github/workflows/data/conda/geolibs-pg18-gil.yml" pg_major: "18" python: "3.14" - conda-environment-file: ".github/workflows/data/conda/geolibs-pg18-freethreading.yml" pg_major: "18" python: "3.14t" name: PostgreSQL ${{ matrix.pg_major }}, Python ${{ matrix.python }} steps: - name: Checkout uses: actions/checkout@v7 with: persist-credentials: false - name: Install system packages run: | sudo apt update xargs -a .github/workflows/data/apt-packages.txt sudo apt install -y --no-install-recommends - name: Setup Miniforge # Pinned to v4.0.1 uses: conda-incubator/setup-miniconda@8ee1f361103df19b6f8c8655fd3967a8ecb162d5 with: activate-environment: geodjango environment-file: ${{ matrix.conda-environment-file }} channel-priority: strict - name: Create PostgreSQL settings file run: mv ./.github/workflows/data/test_postgis.py.tpl ./tests/test_postgis.py - name: Initialize and start local PostgreSQL env: PGPASSWORD: postgres run: | initdb -D "$GITHUB_WORKSPACE/.tmp/pgdata" --username="user" --auth=scram-sha-256 --pwfile=<(echo "$PGPASSWORD") pg_ctl -D "$GITHUB_WORKSPACE/.tmp/pgdata" -w start psql -U user -d postgres -c "CREATE EXTENSION IF NOT EXISTS postgis;" psql -U user -d postgres -c "SELECT PostGIS_full_version();" - name: Show GIL status run: python -c "import sys; print('GIL enabled:', sys._is_gil_enabled())" - name: Print geospatial versions run: | python -c "from django.contrib.gis import gdal, geos; print(f'GDAL: {gdal.gdal_version()}'); print(f'GEOS: {geos.geos_version()}')" - name: Run PostGIS tests run: python -Wall tests/runtests.py -v2 --settings=test_postgis