improve testing support and the CI #21
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: cmake-win64 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: [push, pull_request, workflow_dispatch] | |
defaults: | |
run: | |
shell: bash --noprofile --norc -xeo pipefail {0} | |
env: | |
ILOC: d:/a/local | |
# Note: retry on all errors to avoid transient SEC_E_ILLEGAL_MESSAGE issues… | |
CURL: curl --location --retry 5 --retry-all-errors --silent --show-error | |
jobs: | |
build: | |
name: cmake-win64 | |
runs-on: windows-latest | |
steps: | |
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Fetch tags | |
run: git fetch --prune --unshallow --tags | |
- name: Setup environment | |
run: | | |
mkdir ${{env.ILOC}} | |
git_info="$(git describe --tags HEAD)" | |
echo "version=${git_info}" >>$GITHUB_OUTPUT | |
echo d:/a/gnuplot/bin >>$GITHUB_PATH | |
echo ${{env.ILOC}}/bin >>$GITHUB_PATH | |
# Nuke Strawberry Perl's installation as it contains various | |
# MinGW headers, libraries and binaries that can get picked up | |
# by configure/CMake and don't necessarily behave correctly when | |
# not using a MinGW environment. | |
- name: Nuke Strawberry Perl | |
run: rm -rf C:/Strawberry | |
- name: Install nasm | |
uses: ilammy/setup-nasm@v1 | |
- name: Install gnuplot | |
run: | | |
${{env.CURL}} https://sourceforge.net/projects/gnuplot/files/gnuplot/5.4.8/gp548-win64-mingw.zip/download -o gp548-win64-mingw.zip | |
unzip -d d:/a -qq gp548-win64-mingw.zip | |
gnuplot --version | |
- name: Build and Install zlib-ng | |
run: | | |
git clone --depth 1 https://github.com/zlib-ng/zlib-ng.git | |
cd zlib-ng | |
cmake -B build -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DBUILD_SHARED_LIBS=OFF -DZLIB_COMPAT=ON -DZLIB_ENABLE_TESTS=OFF -DINSTALL_UTILS=OFF | |
cmake --build build --config Release --target install | |
- name: Build and Install libpng | |
run: | | |
${{env.CURL}} https://download.sourceforge.net/libpng/lpng1639.zip -o lpng1639.zip | |
unzip -qq lpng1639.zip | |
cd lpng1639 | |
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DPNG_TESTS=OFF -DPNG_SHARED=OFF | |
cmake --build build --config Release --target install | |
- name: Build and Install giflib | |
run: | | |
${{env.CURL}} https://sourceforge.net/projects/giflib/files/giflib-5.2.1.tar.gz/download -o giflib-5.2.1.tar.gz | |
tar xaf giflib-5.2.1.tar.gz | |
cd giflib-5.2.1 | |
patch -p1 <<\EOF | |
diff --git c/CMakeLists.txt i/CMakeLists.txt | |
new file mode 100644 | |
--- /dev/null | |
+++ i/CMakeLists.txt | |
@@ -0,0 +1,32 @@ | |
+cmake_minimum_required(VERSION 3.5) | |
+ | |
+project(giflib VERSION 5.2.1 LANGUAGES C) | |
+ | |
+if(MSVC) | |
+ set(CMAKE_DEBUG_POSTFIX "d") | |
+endif() | |
+ | |
+add_library(giflib | |
+ dgif_lib.c | |
+ egif_lib.c | |
+ gif_err.c | |
+ gif_font.c | |
+ gif_hash.c | |
+ gif_hash.h | |
+ gif_lib.h | |
+ gif_lib_private.h | |
+ gifalloc.c | |
+ openbsd-reallocarray.c | |
+ quantize.c | |
+) | |
+ | |
+install(TARGETS giflib EXPORT giflib | |
+ RUNTIME DESTINATION bin | |
+ ARCHIVE DESTINATION lib | |
+ LIBRARY DESTINATION lib | |
+) | |
+ | |
+install(FILES | |
+ ${CMAKE_CURRENT_SOURCE_DIR}/gif_lib.h | |
+ DESTINATION include | |
+) | |
diff --git c/gif_hash.h i/gif_hash.h | |
--- c/gif_hash.h | |
+++ i/gif_hash.h | |
@@ -9,7 +9,9 @@ SPDX-License-Identifier: MIT | |
#ifndef _GIF_HASH_H_ | |
#define _GIF_HASH_H_ | |
+#if !defined(_MSC_VER) | |
#include <unistd.h> | |
+#endif | |
#include <stdint.h> | |
#define HT_SIZE 8192 /* 12bits = 4096 or twice as big! */ | |
EOF | |
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} | |
cmake --build build --config Release --target install | |
- name: Build and Install libjpeg | |
run: | | |
git clone --depth 1 https://github.com/libjpeg-turbo/libjpeg-turbo.git | |
cd libjpeg-turbo | |
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DWITH_TURBOJPEG=OFF | |
cmake --build build --config Release --target install | |
- name: Build and Install openjpeg | |
run: | | |
git clone --depth 1 https://github.com/uclouvain/openjpeg.git | |
cd openjpeg | |
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} | |
cmake --build build --config Release --target install | |
- name: Build and Install webp | |
run: | | |
git clone --depth 1 https://chromium.googlesource.com/webm/libwebp | |
cd libwebp | |
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DWEBP_BUILD_WEBP_JS=OFF -DWEBP_BUILD_ANIM_UTILS=OFF -DWEBP_BUILD_CWEBP=OFF -DWEBP_BUILD_DWEBP=OFF -DWEBP_BUILD_GIF2WEBP=OFF -DWEBP_BUILD_IMG2WEBP=OFF -DWEBP_BUILD_VWEBP=OFF -DWEBP_BUILD_WEBPMUX=OFF -DWEBP_BUILD_EXTRAS=OFF -DWEBP_BUILD_WEBP_JS=OFF | |
cmake --build build --config Release --target install | |
- name: Build and Install jbigkit | |
run: | | |
git clone --depth 1 https://github.com/zdenop/jbigkit.git | |
cd jbigkit | |
cmake -B build -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DBUILD_PROGRAMS=OFF -DBUILD_TOOLS=OFF -DCMAKE_WARN_DEPRECATED=OFF | |
cmake --build build --config Release --target install | |
- name: Build and Install zstd | |
run: | | |
git clone --depth 1 https://github.com/facebook/zstd.git | |
cd zstd/build/cmake | |
cmake -B build -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} | |
cmake --build build --config Release --target install | |
# FIXME: skip lzma build (libtiff lzma build failure) | |
- name: Build and Install lzma | |
if: false | |
run: | | |
${{env.CURL}} https://sourceforge.net/projects/lzmautils/files/xz-5.4.3.tar.zst/download -o xz-5.4.3.tar.zst | |
tar xaf xz-5.4.3.tar.zst | |
cd xz-5.4.3 | |
cmake -B build -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DBUILD_TESTING=OFF | |
cmake --build build --config Release --target install | |
# FIXME: disable lzma support (build failure) | |
- name: Build and Install libtiff | |
run: | | |
git clone --depth 1 https://gitlab.com/libtiff/libtiff.git | |
cd libtiff | |
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -Dlzma=OFF -Dtiff-tools=OFF -Dtiff-tests=OFF -Dtiff-contrib=OFF -Dtiff-docs=OFF | |
cmake --build build --config Release --target install | |
- name: Configure | |
run: cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${{env.ILOC}} -DCMAKE_INSTALL_PREFIX=${{env.ILOC}} -DSW_BUILD=OFF -DBUILD_PROG=ON -DBUILD_SHARED_LIBS=ON -DBUILD_TEST=ON | |
- name: Build | |
run: cmake --build build --config Release | |
# FIXME: skip `string_reg` test (libtiff lzma build failure) | |
- name: Test | |
run: ctest --test-dir build --build-config Release --output-on-failure --parallel 3 --exclude-regex '^string_reg$' | |
- name: Install | |
run: cmake --build build --config Release --target install | |
- name: Test install | |
run: fileinfo prog/test-rgb.png | |
- name: Remove not needed tools | |
run: rm -f ${{env.ILOC}}/bin/*.exe | |
- name: Upload Build Results | |
uses: actions/[email protected] | |
with: | |
name: leptonica-${{ steps.get_version.outputs.version }}-VS2019_win64 | |
path: ${{env.ILOC}} | |
retention-days: 5 |