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

Build GMT on TravisCI #5

Merged
merged 15 commits into from
Aug 13, 2018
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