Skip to content

Commit

Permalink
CI: add test for CMake build
Browse files Browse the repository at this point in the history
  • Loading branch information
nilason committed Jul 27, 2023
1 parent b5bad8c commit 5b72508
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 9 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/build_ubuntu_cmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/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

mkdir build && cd build

cmake .. -DAUTOLOAD_DIR=${GDAL_AUTOLOAD_DIR}
cmake --build .
cmake --install .
10 changes: 1 addition & 9 deletions .github/workflows/test_simple.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,7 @@ 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 )
export GDAL_DRIVER_PATH=$1

# Using LD_LIBRARY_PATH workaround for GRASS GIS < 7.8.8
export LD_LIBRARY_PATH=$(grass --config path)/lib
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,18 @@ jobs:
- name: Create GDAL_AUTOLOAD directory
run: |
mkdir $HOME/gdalplugins
- name: Setup test data
run: |
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
- 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
- name: Build with CMake
run: .github/workflows/build_ubuntu_cmake.sh $HOME/gdalplugins_cmake
- name: Test executing of GDAL with driver on GRASS maps (CMake)
run: .github/workflows/test_simple.sh $HOME/gdalplugins_cmake

0 comments on commit 5b72508

Please sign in to comment.