Skip to content

Commit

Permalink
Build GMT on TravisCI (#5)
Browse files Browse the repository at this point in the history
For now, only tries to compile and run a simple `pscoast`.
Adds build scripts in the `ci` folder and the configuration for Travis on `.travis.yml`.
The scripts download GSHHG and DCW as well.
  • Loading branch information
leouieda committed Aug 13, 2018
1 parent 5e6fd74 commit 2187a86
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
language: c

sudo: required

branches:
only:
- master
- 5.4
# Regex to build tagged commits with version numbers
- /\d+\.\d+(\.\d+)?(\S*)?$/

os:
- linux
#- osx

env:
global:
- INSTALLDIR="$HOME/gmt-install-dir"
- COASTLINEDIR="$HOME/gmt-install-dir/coast"
- PATH="$INSTALLDIR/bin:$PATH"
- LD_LIBRARY_PATH="$INSTALLDIR/lib:$LD_LIBRARY_PATH"

before_install:
# Install GMT dependencies
- bash ci/travis-setup.sh

install:
# Build and install GMT
- bash ci/travis-build.sh;

script:
- gmt defaults -Vd
- gmt pscoast -R0/10/0/10 -JM6i -Ba -Ggray -P -Vd > test.ps


notifications:
email: false
20 changes: 20 additions & 0 deletions ci/travis-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
# Build and install GMT

# To return a failure if any commands inside fail
set -e

mkdir build && cd build

cmake -D CMAKE_INSTALL_PREFIX=$INSTALLDIR \
-D GMT_LIBDIR=$INSTALLDIR/lib \
-D DCW_ROOT=$COASTLINEDIR \
-D GSHHG_ROOT=$COASTLINEDIR \
..

make -j
make check
make install

# Turn off exit on failure.
set +e
43 changes: 43 additions & 0 deletions ci/travis-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
# Setup TravisCI to be able to build and test GMT

# To return a failure if any commands inside fail
set -e

# Install dependencies
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
sudo apt-get update
sudo apt-get install -y build-essential cmake libcurl4-gnutls-dev libnetcdf-dev \
libgdal1-dev libfftw3-dev libpcre3-dev liblapack-dev ghostscript curl
else
echo "OSX not supported yet";
fi

# Get the coastlines and country polygons
EXT="tar.gz"
GSHHG="gshhg-gmt-2.3.7"
DCW="dcw-gmt-1.1.4"

mkdir $INSTALLDIR
mkdir $COASTLINEDIR

# GSHHG (coastlines, rivers, and political boundaries):
echo ""
echo "Downloading and unpacking GSHHG"
echo "================================================================================"
curl "http:https://www.soest.hawaii.edu/pwessel/gshhg/$GSHHG.$EXT" > $GSHHG.$EXT
tar xzf $GSHHG.$EXT
cp $GSHHG/* $COASTLINEDIR/

# DCW (country polygons):
echo ""
echo "Downloading and unpacking DCW"
echo "================================================================================"
curl "http:https://www.soest.hawaii.edu/pwessel/dcw/$DCW.$EXT" > $DCW.$EXT
tar xzf $DCW.$EXT
cp $DCW/* $COASTLINEDIR

ls $COASTLINEDIR

# Turn off exit on failure.
set +e

0 comments on commit 2187a86

Please sign in to comment.