-
Notifications
You must be signed in to change notification settings - Fork 401
Add OSX builds and refactor TravisCI build config #317
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
Changes from all commits
f38d4c9
37c33b3
a50f2e2
691ec85
25f92a5
5c421fa
ec7cdf9
a5a3637
fa67c91
0c13922
c4de614
c765dde
a6db749
956480c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,52 +1,123 @@ | ||
| language: c | ||
| # Configuration file for TravisCI | ||
|
|
||
| # Use the container builds so we don't need sudo priviledges | ||
| sudo: false | ||
|
|
||
| sudo: required | ||
| language: c | ||
|
|
||
| # Only build pushes to select branches and tags. This avoids the double | ||
| # builds than happen when working on a branch instead of a fork. | ||
| branches: | ||
| only: | ||
| - master | ||
| - 5.4 | ||
| # Regex to build tagged commits with version numbers | ||
| - /\d+\.\d+(\.\d+)?(\S*)?$/ | ||
|
|
||
| os: | ||
| - linux | ||
| #- osx | ||
| # Set the Ubuntu version for the Linux builds | ||
| dist: xenial | ||
|
|
||
| # Dependencies for the Linux and OSX builds | ||
| addons: | ||
| apt: | ||
| packages: | ||
| - cmake | ||
| - build-essential | ||
| - libcurl4-gnutls-dev | ||
| - libnetcdf-dev | ||
| - libgdal1-dev | ||
| - libfftw3-dev | ||
| - libpcre3-dev | ||
| - liblapack-dev | ||
| - ghostscript | ||
| - curl | ||
| - graphicsmagick | ||
| - python | ||
| - python-pip | ||
| homebrew: | ||
| packages: | ||
| - cmake | ||
| - curl | ||
| - netcdf | ||
| - gdal | ||
| - fftw | ||
| - pcre2 | ||
| - ghostscript | ||
| - curl | ||
| - graphicsmagick | ||
| - python | ||
|
|
||
| # Define environment variables and set build actions | ||
| 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" | ||
| - if [ "$TRAVIS_EVENT_TYPE" == "cron" ]; then | ||
| export PYTHON=3.6 | ||
| export CONDA_INSTALL_EXTRA="sphinx" | ||
| export COVERAGE=true | ||
| fi | ||
| - BUILD_DOCS=false | ||
| - TEST=false | ||
|
|
||
| # Create the build matrix with different jobs for each platform and cron jobs | ||
| matrix: | ||
| include: | ||
| - name: "Linux (compile only)" | ||
| os: linux | ||
| if: type != cron | ||
| - name: "Linux (cron)" | ||
| os: linux | ||
| if: type = cron | ||
| env: | ||
| - TEST="true" | ||
| - name: "Mac (compile only)" | ||
| os: osx | ||
| if: type != cron | ||
| - name: "Mac (cron)" | ||
| os: osx | ||
| if: type = cron | ||
| env: | ||
| - TEST="true" | ||
| # Only build the docs on Linux cron jobs | ||
| - name: "Linux (cron - build docs)" | ||
| os: linux | ||
| if: type = cron | ||
| env: | ||
| - BUILD_DOCS=true | ||
|
|
||
| # Setup the build environment | ||
| before_install: | ||
| # Install GMT dependencies | ||
| - bash ci/travis-setup.sh | ||
| - mkdir "$INSTALLDIR" | ||
| - mkdir "$COASTLINEDIR" | ||
| - bash ci/download-coastlines.sh | ||
| # Install GMT documentation dependencies | ||
| - if [ "$TRAVIS_EVENT_TYPE" == "cron" ]; then | ||
| git clone https://github.com/fatiando/continuous-integration.git; | ||
| source continuous-integration/travis/setup-miniconda.sh; | ||
| - if [ "$BUILD_DOCS" == "true" ]; then | ||
| pip install --user sphinx; | ||
| fi | ||
|
|
||
| # Install the package that we want to test | ||
| install: | ||
| # Build and install GMT | ||
| - bash ci/travis-build.sh; | ||
| - bash ci/build-gmt.sh; | ||
|
|
||
| # Run the actual tests and checks | ||
| script: | ||
| - cd build | ||
| - gmt defaults -Vd | ||
| - gmt pscoast -R0/10/0/10 -JM6i -Ba -Ggray -P -Vd > test.ps | ||
| # Build documentations, tests and coverage reports | ||
| - if [ "$TRAVIS_EVENT_TYPE" == "cron" ]; then | ||
| cd build; make -j docs_html; cd ..; | ||
| cd build; make -j check; cd ..; | ||
| - if [ "$TEST" == "true" ]; then | ||
| make -j check; | ||
| fi | ||
| # Upload test coverage even if build fails. Keep separate to make sure this task | ||
| # fails if the tests fail. | ||
| - if [ "$TEST" == "true" ]; then | ||
| bash <(curl -s https://codecov.io/bash); | ||
| fi | ||
| - if [ "$BUILD_DOCS" == "true" ]; then | ||
| make -j docs_html; | ||
| fi | ||
| - cd .. | ||
|
|
||
| # Things to do if the build is successful | ||
| #after_success: | ||
|
|
||
| notifications: | ||
| email: false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| #!/usr/bin/env bash | ||
| # Build and install GMT | ||
|
|
||
| # To return a failure if any commands inside fail | ||
| set -e | ||
|
|
||
| cat > cmake/ConfigUser.cmake << 'EOF' | ||
| set (CMAKE_INSTALL_PREFIX "$ENV{INSTALLDIR}") | ||
| set (GMT_LIBDIR "$ENV{INSTALLDIR}/lib") | ||
| set (DCW_ROOT "$ENV{COASTLINEDIR}") | ||
| set (GSHHG_ROOT "$ENV{COASTLINEDIR}") | ||
| EOF | ||
|
|
||
| if [ "$TEST" == "true" ]; then | ||
| cat >> cmake/ConfigUser.cmake << 'EOF' | ||
| set (CMAKE_BUILD_TYPE Debug) | ||
| enable_testing() | ||
| set (DO_EXAMPLES TRUE) | ||
| set (DO_TESTS TRUE) | ||
| set (DO_ANIMATIONS TRUE) | ||
| set (N_TEST_JOBS 2) | ||
| set (CMAKE_C_FLAGS "-Wall -Wdeclaration-after-statement -coverage -O0") | ||
| EOF | ||
| fi | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need to enable the tests in compile-only jobs, so we can change it to:
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are any of those required for building the docs?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Never mind, already found it. |
||
|
|
||
| echo "" | ||
| echo "Using the following cmake configuration:" | ||
| cat cmake/ConfigUser.cmake | ||
| echo "" | ||
|
|
||
| mkdir build && cd build | ||
|
|
||
| cmake .. | ||
|
|
||
| make -j | ||
| make install | ||
|
|
||
| # We are fixing the paths to dynamic library files inside library and binary | ||
| # files because something in 'make install' is doubling up the path to the | ||
| # library files. This only happens on OSX. Anyone who knows how to solve that | ||
| # problem is free to contact the maintainers. | ||
| if [[ "$TRAVIS_OS_NAME" == "osx" ]];then | ||
| install_name_tool -id $INSTALLDIR/lib/libgmt.6.dylib $INSTALLDIR/lib/libgmt.6.dylib | ||
| install_name_tool -id $INSTALLDIR/lib/libpostscriptlight.6.dylib $INSTALLDIR/lib/libpostscriptlight.6.dylib | ||
| install_name_tool -change $INSTALLDIR/$INSTALLDIR/lib/libgmt.6.dylib $INSTALLDIR/lib/libgmt.6.dylib $INSTALLDIR/lib/gmt/plugins/supplements.so | ||
| install_name_tool -change $INSTALLDIR/$INSTALLDIR/lib/libpostscriptlight.6.dylib $INSTALLDIR/lib/libpostscriptlight.6.dylib $INSTALLDIR/lib/gmt/plugins/supplements.so | ||
| install_name_tool -change $INSTALLDIR/$INSTALLDIR/lib/libgmt.6.dylib $INSTALLDIR/lib/libgmt.6.dylib $INSTALLDIR/bin/gmt | ||
| install_name_tool -change $INSTALLDIR/$INSTALLDIR/lib/libpostscriptlight.6.dylib $INSTALLDIR/lib/libpostscriptlight.6.dylib $INSTALLDIR/bin/gmt | ||
| install_name_tool -change $INSTALLDIR/$INSTALLDIR/lib/libpostscriptlight.6.dylib $INSTALLDIR/lib/libpostscriptlight.6.dylib $INSTALLDIR/lib/libgmt.6.dylib | ||
| fi | ||
|
|
||
| # Turn off exit on failure. | ||
| set +e | ||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate CMAKE_BUILD_TYPE if "COVERAGE" == "true".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 removed the one inside the if block