# GitHub Actions for PostGIS # # Paul Ramsey name: "CI" on: push: branches-ignore: - 'main' pull_request: ~ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: linux: name: "CI" strategy: fail-fast: false matrix: ci: # Use the last stable releases to run more tests - { tag: pg18-geosmain-gdal311-proj96, mode: tests } - { tag: pg17-geos313-gdal39-proj94, mode: coverage } # - { tag: pg17-geos313-gdal39-proj94, mode: garden } - { tag: pg16-geos312-gdal37-proj921, mode: coverage } - { tag: pg15-geos311-gdal35-proj90, mode: coverage } - { tag: pg15-clang-geos311-gdal35-proj90, mode: usan_clang } # - { tag: pg13-geos39-gdal31-proj71, mode: garden } #- { tag: pg14-geos39-gdal33-proj71, mode: tests } - { tag: pg14-geos310-gdal33-proj71, mode: tests } # - { tag: pg14-clang-geos39-gdal33-proj71, mode: usan_clang } #- { tag: pg13-geos39-gdal31-proj71, mode: tests } #- { tag: pg13-geos39-gdal31-proj71, mode: coverage } #- { tag: pg13-geos39-gdal31-proj71, mode: usan_gcc } #- { tag: pg14-clang-geos39-gdal31-proj71, mode: usan_clang } # Run tests with different dependency combinations - { tag: pg19-geosmain-gdalmaster-proj98, mode: tests } - { tag: pg18-geosmain-gdal311-proj96, mode: standard_conforming_strings_off } - { tag: pg19-geosmain-gdalmaster-proj98, mode: garden } runs-on: ubuntu-latest steps: # - name: 'Install Docker' # run: | # curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - # sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" # sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce - name: 'Check Out' uses: actions/checkout@v6 with: fetch-depth: 50 - name: Check changed surface id: changed-surface run: | set +e python3 ci/ci_need_suite.py github-ci gate_status=$? set -e if test "${gate_status}" = 78; then echo "skip=true" >> "${GITHUB_OUTPUT}" exit 0 fi exit "${gate_status}" - name: 'Prepare Image' if: steps.changed-surface.outputs.skip != 'true' run: | set -e retry() { max_attempts="$1" delay="$2" max_delay="$3" shift 3 attempt=1 while true; do "$@" && return 0 status="$?" if test "$attempt" -ge "$max_attempts"; then echo "Command failed after ${attempt} attempts: $*" return "$status" fi echo "Command failed with exit code ${status}; retrying in ${delay}s (${attempt}/${max_attempts}): $*" sleep "$delay" attempt=$((attempt + 1)) delay=$((delay * 2)) if test "$delay" -gt "$max_delay"; then delay="$max_delay" fi done } uname -a build_image="postgis/postgis-build-env:${{ matrix.ci.tag }}" retry 6 20 180 docker pull "${build_image}" echo "FROM ${build_image}" > Dockerfile if test "${{ matrix.ci.mode }}" = "garden"; then echo "USER root" >> Dockerfile echo "RUN apt-get update && apt-get install -y --no-install-recommends python3 proj-bin && rm -rf /var/lib/apt/lists/*" >> Dockerfile echo "RUN projsync --system-directory --file au_icsm_GDA94_GDA2020_conformal_and_distortion.tif" >> Dockerfile echo "USER postgres" >> Dockerfile fi echo "ADD --chown=postgres:postgres . /src/postgis" >> Dockerfile echo "CMD bash ci/github/run_${{ matrix.ci.mode }}.sh" >> Dockerfile docker build --pull=false -t pgtest . - name: 'Build & Test' if: steps.changed-surface.outputs.skip != 'true' run: | echo "/tmp/logbt-coredumps/core.%p.%E" | sudo tee /proc/sys/kernel/core_pattern ci_env=`bash .github/codecov_env.bash` docker run -e RUNTESTFLAGS=-v $ci_env --name pgtest-${GITHUB_RUN_NUMBER} pgtest - name: 'Clean Up Image' if: ${{ success() && steps.changed-surface.outputs.skip != 'true' }} run: | docker rm pgtest-${GITHUB_RUN_NUMBER} docs-check: name: "DocBook QA" runs-on: ubuntu-latest steps: - name: 'Check Out' uses: actions/checkout@v6 - name: 'Install dependencies' run: | sudo apt-get update sudo apt-get install -y --no-install-recommends \ libxml2-utils python3 - name: 'DocBook QA unit tests' run: | python3 utils/docs/tests/test_docbook_qa.py - name: 'DocBook source lint' run: | xmllint --xinclude --noent doc/postgis.xml > postgis-out.xml 2>/dev/null python3 utils/docs/docbook_qa.py lint-source --fail-on warning --max-warnings 0 postgis-out.xml