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

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

Hi,

Attached are two patches to improve the Windows support for libtiff.

How does it work?

Take a look at my GitHub branch for the above two patches: https://github.com/rleigh-codelibre/libtiff/commits/ci-appveyor then click on the green tick mark and it will take you to https://ci.appveyor.com/project/rleigh-codelibre/libtiff/build/1.0.30 (at the time of writing). This contains the build logs and status for each combination of compiler and configuration options tested.

We can vary the number of combinations tested; more means it takes longer to test.

Why do this?

The Windows test jobs hosted here https://ci.openmicroscopy.org/view/Third-Party/job/TIFF-HEAD-win-cmake/ and https://ci.openmicroscopy.org/view/Third-Party/job/TIFF-HEAD-win-nmake/ are likely to disappear in the future--we're replacing this CI infrastructure entirely over the next few months, and most of the jobs here will disappear unless reimplemented on the replacement machines. I wanted to provide an alternative which was overall an improvement.

This is something which anyone hacking on libtiff can opt into using (or ignore). You can sign up for an AppVeyor account using your GitHub/BitBucket/GitLab credentials, and enable your libtiff git repository, and after that any branch you push will be automatically tested (it's free for open source projects). If the GitHub fork "vadz/libtiff" enabled it, then any CVS commit would also be automatically tested. The aim is to make it easy for anyone to get better automated testing of their changes.

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

Regards,
Roger

From 4cb0b53fbc12b202644427f386cf436fd309fcdd Mon Sep 17 00:00:00 2001 From: Roger Leigh <rleigh@codelibre.net> Date: Wed, 7 Jun 2017 23:04:04 +0100 Subject: [PATCH 1/2] cmake: Improve Cygwin and MingGW test support

---

 CMakeLists.txt            |  2 +-
 test/CMakeLists.txt       | 29 +++++++++++++++++------------
 test/TiffTestCommon.cmake |  5 +++++
 3 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1ee6fd46..52b5ae99 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -467,7 +467,7 @@ report_values(CMAKE_HOST_SYSTEM_PROCESSOR HOST_FILLORDER
               HOST_BIG_ENDIAN HAVE_IEEEFP)

 # Large file support
-if (UNIX)
+if (UNIX OR MINGW)

   # This might not catch every possibility catered for by
   # AC_SYS_LARGEFILE.

   add_definitions(-D_FILE_OFFSET_BITS=64)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index b9e373f9..731aa806 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -185,6 +185,18 @@ target_link_libraries(custom_dir tiff port)
 set(TEST_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/output")
 file(MAKE_DIRECTORY "${TEST_OUTPUT}")

+set(tiff_test_extra_args

+    "-DTIFFCP=$<TARGET_FILE:tiffcp>"
+    "-DTIFFINFO=$<TARGET_FILE:tiffinfo>"
+    "-DTIFFSPLIT=$<TARGET_FILE:tiffsplit>"
+    "-DLIBTIFF=$<TARGET_FILE:tiff>")

+if(WIN32)
+ list(APPEND tiff_test_extra_args "-DWIN32=${WIN32}")
+endif()
+if(CYGWIN)
+ list(APPEND tiff_test_extra_args "-DCYGWIN=${CYGWIN}")
+endif()
+
 macro(tiff_test_convert name command1 command2 command3 infile outfile validate)
   add_test(NAME "${name}"
            COMMAND "${CMAKE_COMMAND}"
@@ -193,9 +205,8 @@ macro(tiff_test_convert name command1 command2 command3 infile outfile validate)
            "-DCONVERT_COMMAND3=${command3}"
            "-DINFILE=${infile}"
            "-DOUTFILE=${outfile}"

            "-DVALIDATE=${validate}"
+ ${tiff_test_extra_args}
            -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake")
 endmacro()

@@ -205,8 +216,7 @@ macro(tiff_test_stdout name command infile outfile)
            "-DSTDOUT_COMMAND=${command}"
            "-DINFILE=${infile}"
            "-DOUTFILE=${outfile}"

+ ${tiff_test_extra_args}
            -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake")
 endmacro()

@@ -215,8 +225,7 @@ macro(tiff_test_reader name command infile)
            COMMAND "${CMAKE_COMMAND}"
            "-DREADER_COMMAND=${command}"
            "-DINFILE=${infile}"

+ ${tiff_test_extra_args}
            -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffTest.cmake")
 endmacro()

@@ -344,9 +353,7 @@ add_test(NAME "tiffcp-split"
          "-DTESTFILES=${ESCAPED_UNCOMPRESSED}"
          "-DCONJOINED=${TEST_OUTPUT}/tiffcp-split-conjoined.tif"
          "-DSPLITFILE=${TEST_OUTPUT}/tiffcp-split-split-"
- "-DTIFFCP=$<TARGET_FILE:tiffcp>"

+ ${tiff_test_extra_args}
          -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffSplitTest.cmake")
 add_test(NAME "tiffcp-split-join"
          COMMAND "${CMAKE_COMMAND}"
@@ -354,9 +361,7 @@ add_test(NAME "tiffcp-split-join"
          "-DCONJOINED=${TEST_OUTPUT}/tiffcp-split-join-conjoined.tif"
          "-DSPLITFILE=${TEST_OUTPUT}/tiffcp-split-join-split-"
          "-DRECONJOINED=${TEST_OUTPUT}/tiffcp-split-join-reconjoined.tif"

+ ${tiff_test_extra_args}
          -P "${CMAKE_CURRENT_SOURCE_DIR}/TiffSplitTest.cmake")

 # PDF
diff --git a/test/TiffTestCommon.cmake b/test/TiffTestCommon.cmake
index 50a4c34a..a0db6782 100644
--- a/test/TiffTestCommon.cmake
+++ b/test/TiffTestCommon.cmake
@@ -101,3 +101,8 @@ if(WIN32)
   file(TO_NATIVE_PATH "${LIBTIFF_DIR}" LIBTIFF_DIR)
   set(ENV{PATH} "${LIBTIFF_DIR};$ENV{PATH}")
 endif()
+if(CYGWIN)
+ get_filename_component(LIBTIFF_DIR "${LIBTIFF}" DIRECTORY)
+ file(TO_NATIVE_PATH "${LIBTIFF_DIR}" LIBTIFF_DIR)
+ set(ENV{PATH} "${LIBTIFF_DIR}:$ENV{PATH}")
+endif()
--
2.13.0

From a02069ab2ce13c07b92140267d620575edafef09 Mon Sep 17 00:00:00 2001 From: Roger Leigh <rleigh@dundee.ac.uk> Date: Wed, 7 Jun 2017 14:05:40 +0100 Subject: [PATCH 2/2] ci: Add AppVeyor support

---
 .appveyor.yml | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100644 .appveyor.yml

diff --git a/.appveyor.yml b/.appveyor.yml
new file mode 100644
index 00000000..0e117842
--- /dev/null

+++ b/.appveyor.yml
@@ -0,0 +1,85 @@
+environment:
+  AV_PROJECTS: 'c:\projects'
+  AV_TIFF_DOWNLOAD: 'c:\projects\download'
+  AV_TIFF_SOURCE: 'c:\projects\libtiff'
+  AV_TIFF_BUILD: 'c:\projects\build'
+  AV_TIFF_INSTALL: 'c:\projects\install'
+
+  matrix:
+    - compiler: cygwin
+      generator: Unix Makefiles
+      shared: ON
+    - compiler: cygwin
+      generator: Unix Makefiles
+      shared: OFF
+    - compiler: mingw
+      generator: Unix Makefiles
+      shared: ON
+    - compiler: mingw
+      generator: Unix Makefiles
+      shared: OFF
+    - compiler: vc14
+      generator: Visual Studio 14 2015 Win64
+      shared: ON
+    - compiler: vc14
+      generator: Visual Studio 14 2015 Win64
+      shared: OFF
+
+cache:
+  - 'c:\projects\download -> appveyor.yml'
+
+# Operating system (build VM template)
+os: 'Visual Studio 2015'
+
+# clone directory
+clone_folder: 'c:\projects\libtiff'
+clone_depth: 5
+
+platform: x64
+configuration: Release
+
+init:
+  - git config --global core.autocrlf input
+  - 'FOR /F "tokens=* USEBACKQ" %%F IN (`C:\cygwin64\bin\cygpath -u %AV_TIFF_SOURCE%`) DO SET AV_TIFF_CYG_SOURCE=%%F'
+  - 'FOR /F "tokens=* USEBACKQ" %%F IN (`C:\cygwin64\bin\cygpath -u %AV_TIFF_INSTALL%`) DO SET AV_TIFF_CYG_INSTALL=%%F'
+  - 'if %compiler%==cygwin C:\Cygwin64\setup-x86_64 -q -R C:\Cygwin64 -s http://cygwin.mirror.constant.com -l %AV_TIFF_DOWNLOAD%\cygwin -P cmake,libjpeg-devel,zlib-devel'
+  - 'if %compiler%==cygwin set "PATH=C:\Cygwin64\bin;%PATH%"'
+  - 'if %compiler%==mingw set "PATH=C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;%PATH%"'
+  - set "AV_CMAKE_ARGS=-DBUILD_SHARED_LIBS:BOOL=%shared%"
+  - 'if %compiler%==mingw set "PATH=C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin;%PATH%"'
+  - 'if %compiler%==mingw set "AV_CMAKE_ARGS=%AV_CMAKE_ARGS% -DCMAKE_MAKE_PROGRAM=C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin\mingw32-make"'
+  - set "AV_TIFF_CMAKE_SOURCE=%AV_TIFF_SOURCE%"
+  - set "AV_TIFF_CMAKE_INSTALL=%AV_TIFF_INSTALL%"
+  - 'if %compiler%==cygwin set "AV_TIFF_CMAKE_SOURCE=%AV_TIFF_CYG_SOURCE%'
+  - 'if %compiler%==cygwin set "AV_TIFF_CMAKE_INSTALL=%AV_TIFF_CYG_INSTALL%'
+
+before_build:
+  - mkdir %AV_TIFF_BUILD%
+  - cd %AV_TIFF_BUILD%
+  - echo Running cmake -G "%generator%" -DCMAKE_INSTALL_PREFIX=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_TIFF_CMAKE_SOURCE%
+  - 'if %compiler%==cygwin bash -c "cmake -G \"%generator%\" -DCMAKE_INSTALL_PREFIX:PATH=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_CMAKE_ARGS% %AV_TIFF_CMAKE_SOURCE%"'
+  - 'if NOT %compiler%==cygwin cmake -G "%generator%" -DCMAKE_INSTALL_PREFIX:PATH=%AV_TIFF_CMAKE_INSTALL% -DCMAKE_BUILD_TYPE=%configuration% %AV_CMAKE_ARGS% %AV_TIFF_CMAKE_SOURCE%'
+
+build_script:
+  - cd %AV_TIFF_BUILD%
+  - 'if %compiler%==cygwin bash -c "cmake --build . --config %configuration% --target install"'
+  - 'if NOT %compiler%==cygwin cmake --build . --config %configuration% --target install'
+
+# scripts to run after build
+after_build:
+  - cd %AV_TIFF_BUILD%
+  - '7z a %AV_TIFF_SOURCE%\libtiff-build.zip * -tzip'
+  - cd %AV_TIFF_INSTALL%
+  - '7z a %AV_TIFF_SOURCE%\libtiff.zip * -tzip'
+
+before_test:
+  - cd %AV_TIFF_BUILD%
+  - set
+  - 'if %compiler%==cygwin bash -c "ctest -V -C %configuration%"'
+  - 'if NOT %compiler%==cygwin ctest -V -C %configuration%'
+
+artifacts:
+  - path: libtiff.zip
+    name: libtiff.zip
+  - path: libtiff-build.zip
+    name: libtiff-build.zip

--
2.13.0