2017.06.07 22:30 "[Tiff] [PATCH] Windows CI support for GitHub and AppVeyor", by Roger Leigh

2017.06.08 11:22 "Re: [Tiff] [PATCH] Unix/Linux CI support for GitHub and Travis", by

On 2017-06-07 23:30, Roger Leigh wrote:

> I'll follow up with another patch for Unix as well probably using > Travis CI; this is for the Windows side of things.

As promised, this patch does the same think for Unix/Linux as the previous ones did for Windows.

You can find the branch here:

   https://github.com/rleigh-codelibre/libtiff/commits/ci-travis

and follow the build link to here:

   https://travis-ci.org/rleigh-codelibre/libtiff

where it shows builds with Autoconf and CMake for both the GCC and Clang compilers. Autoconf is tested with Make; CMake is tested with Make and Ninja.

Together with the Windows patches, this provides pretty decent test

Regards,
Roger

From 00c78c791def5dea23cfb119e6cb2617d943cf6e Mon Sep 17 00:00:00 2001

From: Roger Leigh <rleigh@dundee.ac.uk>

Date: Thu, 8 Jun 2017 11:52:16 +0100 Subject: [PATCH] ci: Add Travis support for Linux builds with Autoconf and

 CMake

---

 .travis.yml     | 31 ++++++++++++++++++++
 build/travis-ci | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 2 files changed, 121 insertions(+)
 create mode 100644 .travis.yml
 create mode 100755 build/travis-ci

diff --git a/.travis.yml b/.travis.yml

new file mode 100644
index 00000000..9b371162
--- /dev/null

+++ b/.travis.yml
@@ -0,0 +1,31 @@
+language: c
+
+sudo: false
+dist: trusty
+
+cache:
+  directories:
+    - download
+
+addons:
+  apt_packages:
+    - libjpeg8-dev
+    - libjbig-dev
+    - liblzma-dev
+    - zlib1g-dev
+
+compiler:
+  - gcc
+  - clang
+
+env:
+  matrix:
+    - BUILD=autoconf
+    - BUILD=cmake TOOL="Unix Makefiles" TYPE=Release
+    - BUILD=cmake TOOL="Ninja" TYPE=Release
+
+matrix:
+  fast_finish: true
+
+script:
+  - ./build/travis-ci "$BUILD" "$TOOL" "$TYPE"
diff --git a/build/travis-ci b/build/travis-ci
new file mode 100755
index 00000000..c34791a1
--- /dev/null
+++ b/build/travis-ci
@@ -0,0 +1,90 @@
+#!/bin/sh
+# This script is used for testing the build, primarily for use
+# with travis, but may be used by hand as well.
+
+set -e
+set -x
+
+# Test autoconf build
+autoconf_build()
+{
+    mkdir autoconf-build
+    cd autoconf-build
+    ../configure --prefix=$(readlink -f ../autoconf-install)
+    make
+    make install
+    make check
+}
+
+# Install needed tools
+cmake_deps()
+{
+    mkdir -p download
+    mkdir -p tools
+
+    cmake_file="cmake-3.8.2-Linux-x86_64.tar.gz"
+    cmake_url="https://cmake.org/files/v3.8/${cmake_file}"
+    cmake_hash="574673d3f37b0be6a0813b894a8bce9c4af08c13f1ec25c030a69f42e0e4b349e0192385ef20c8a9271055b7c3b24c5b20fb5009762131a3fba3d17576e641f1"
+
+    ninja_file="ninja-linux.zip"
+    ninja_url="https://github.com/ninja-build/ninja/releases/download/v1.7.2/${ninja_file}"
+    ninja_hash="2dddc52750c5e6f841acd0d978b894c9a6562f12ddb4ba9e5118a213f54265f065682ffe1bc7bc2ac6146760145d17800a4b7373791cd1fbbaf0836faf050e19"
+
+    (
+        cd download
+        if [ ! -f "$cmake_file" ] || [ "$(sha512sum "$cmake_file")" != "$cmake_hash  $cmake_file" ]; then
+            wget "$cmake_url"
+            if [ "$(sha512sum "$cmake_file")" != "$cmake_hash  $cmake_file" ]; then
+                echo "Error: cmake download hash mismatch" >&2
+                exit 1
+            fi
+        fi
+        tar xf "$cmake_file"
+        cp -a ${cmake_file%.tar.gz}/* ../tools
+
+        if [ "$1" = "Ninja" ]; then
+            if [ ! -f "$ninja_file" ] || [ "$(sha512sum "$ninja_file")" != "$ninja_hash  $ninja_file" ]; then
+                wget "$ninja_url"
+                if [ "$(sha512sum "$ninja_file")" != "$ninja_hash  $ninja_file" ]; then
+                    echo "Error: ninja download hash mismatch" >&2
+                    exit 1
+