diff --git a/.github/workflows/apt.txt b/.github/workflows/apt.txt new file mode 100644 index 0000000..21281e1 --- /dev/null +++ b/.github/workflows/apt.txt @@ -0,0 +1,6 @@ +gdal-bin +grass +grass-dev +libgdal-dev +libpq-dev +pkg-config diff --git a/.github/workflows/build_ubuntu.sh b/.github/workflows/build_ubuntu.sh new file mode 100755 index 0000000..66fbebe --- /dev/null +++ b/.github/workflows/build_ubuntu.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +# fail on non-zero return code from a subprocess +set -e + +# print commands +set -x + +if [ -z "$1" ]; then + echo "Usage: $0 GDAL_AUTOLOAD_DIR" + exit 1 +fi + +# non-existent variables as an errors +set -u + +# versionless in future? +GRASS=grass$(pkg-config --modversion grass | cut -d. -f1,2 | sed 's+\.++g') + +export GDAL_AUTOLOAD_DIR=$1 + +./configure \ + --prefix=/usr \ + --with-autoload=${GDAL_AUTOLOAD_DIR} \ + --with-grass=/usr/lib/${GRASS} \ + --with-postgres-includes=$(pg_config --includedir) + +make +make install diff --git a/.github/workflows/test_simple.sh b/.github/workflows/test_simple.sh new file mode 100755 index 0000000..14091cb --- /dev/null +++ b/.github/workflows/test_simple.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +# fail on non-zero return code from a subprocess +set -e + +# print commands +set -x + +if [ -z "$1" ]; then + echo "Usage: $0 GDAL_AUTOLOAD_DIR" + exit 1 +fi + +# non-existent variables as an errors +set -u + +export GDAL_AUTOLOAD_DIR=$1 +export GDAL_DRIVER_PATH=${GDAL_AUTOLOAD_DIR} + +# add small GRASS GIS dataset for tests +(mkdir -p $HOME/grassdata && \ + cd $HOME/grassdata/ && \ + wget -c --quiet https://grass.osgeo.org/sampledata/north_carolina/nc_spm_08_micro.zip && \ + unzip nc_spm_08_micro.zip && \ + rm -f nc_spm_08_micro.zip ) + +# Using LD_LIBRARY_PATH workaround for GRASS GIS < 7.8.8 +export LD_LIBRARY_PATH=$(grass --config path)/lib + +# test GRASS GIS raster map +gdalinfo $HOME/grassdata/nc_spm_08_micro/PERMANENT/cellhd/elevation + +# test GRASS GIS vector map +ogrinfo -so -al $HOME/grassdata/nc_spm_08_micro/PERMANENT/vector/firestations/head diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml new file mode 100644 index 0000000..3459ee2 --- /dev/null +++ b/.github/workflows/ubuntu.yml @@ -0,0 +1,23 @@ +name: Build on Ubuntu +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - name: Get dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y wget git gawk findutils + xargs -a <(awk '! /^ *(#|$)/' ".github/workflows/apt.txt") -r -- \ + sudo apt-get install -y --no-install-recommends --no-install-suggests + - name: Create GDAL_AUTOLOAD directory + run: | + mkdir $HOME/gdalplugins + - name: Build + run: .github/workflows/build_ubuntu.sh $HOME/gdalplugins + - name: Test executing of GDAL with driver on GRASS maps + run: .github/workflows/test_simple.sh $HOME/gdalplugins +