Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub actions: compile driver on Ubuntu #1

Merged
merged 20 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/apt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
gdal-bin
grass
grass-dev
libgdal-dev
libpq-dev
pkg-config
29 changes: 29 additions & 0 deletions .github/workflows/build_ubuntu.sh
Original file line number Diff line number Diff line change
@@ -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
34 changes: 34 additions & 0 deletions .github/workflows/test_simple.sh
Original file line number Diff line number Diff line change
@@ -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
neteler marked this conversation as resolved.
Show resolved Hide resolved

# test GRASS GIS vector map
ogrinfo -so -al $HOME/grassdata/nc_spm_08_micro/PERMANENT/vector/firestations/head
23 changes: 23 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -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