libvips/.github/workflows/ci.yml
2021-05-03 13:21:45 +02:00

142 lines
5.5 KiB
YAML

name: CI
on: [ push, pull_request, workflow_dispatch ]
jobs:
CI:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ contains(matrix.os, 'macos') }}
strategy:
fail-fast: false
matrix:
name: [ "Linux x64 (Ubuntu 20.04) - GCC 10" ]
os: [ ubuntu-20.04 ]
sanitize: [ false ]
build:
- { cc: gcc, cxx: g++, linker: ld }
include:
- name: "Linux x64 (Ubuntu 20.04) - Clang 10 with ASan and UBSan"
os: ubuntu-20.04
sanitize: true
build: { cc: clang-10, cxx: clang++-10, linker: ld.lld-10 }
- name: "macOS (10.15) - Xcode 12.3"
os: macos-10.15
sanitize: false
build: { cc: clang, cxx: clang++, linker: ld.lld }
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Update apt
if: contains(matrix.os, 'ubuntu')
env:
DEBIAN_FRONTEND: noninteractive
run: sudo -E apt-get update -qq -o Acquire::Retries=3
- name: Add libheif PPA
if: contains(matrix.os, 'ubuntu')
run: |
sudo add-apt-repository ppa:strukturag/libde265
sudo add-apt-repository ppa:strukturag/libheif
- name: Install Ubuntu dependencies
if: contains(matrix.os, 'ubuntu')
env:
DEBIAN_FRONTEND: noninteractive
run:
sudo -E apt-get install --fix-missing -qq -o Acquire::Retries=3
gtk-doc-tools gobject-introspection
python3-pip python3-setuptools python3-wheel
libfftw3-dev libexif-dev libjpeg-turbo8-dev
libpng-dev libwebp-dev libtiff5-dev
libheif-dev libexpat1-dev libcfitsio-dev
libmatio-dev libnifti-dev liborc-0.4-dev
liblcms2-dev libpoppler-glib-dev librsvg2-dev
libgif-dev libopenexr-dev libpango1.0-dev
libgsf-1-dev libopenslide-dev libffi-dev
libopenjp2-7-dev
- name: Install macOS dependencies
if: contains(matrix.os, 'macos')
run: |
brew update
brew upgrade
brew install autoconf automake libtool fftw fontconfig gtk-doc gobject-introspection glib libexif libgsf little-cms2 orc pango
brew install cfitsio libheif libjpeg-turbo libmatio librsvg libspng libtiff openexr openjpeg openslide poppler webp
- name: Install Clang 10
env:
DEBIAN_FRONTEND: noninteractive
if: contains(matrix.os, 'ubuntu') && matrix.build.cc == 'clang-10'
run:
sudo -E apt-get install --fix-missing -qq -o Acquire::Retries=3
clang-10 libomp-10-dev lld-10 llvm-10
- name: Prepare build environment
run: |
echo "CC=${{ matrix.build.cc }}" >> $GITHUB_ENV
echo "CXX=${{ matrix.build.cxx }}" >> $GITHUB_ENV
echo "LD=${{ matrix.build.linker }}" >> $GITHUB_ENV
echo "CPPFLAGS=-Wall" >> $GITHUB_ENV
- name: Prepare Ubuntu environment
if: contains(matrix.os, 'ubuntu')
run: echo "JOBS=$(nproc)" >> $GITHUB_ENV
- name: Prepare macOS environment
if: contains(matrix.os, 'macos')
run: |
echo "JOBS=$(sysctl -n hw.logicalcpu)" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=/usr/local/opt/jpeg-turbo/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig:/usr/local/opt/imagemagick@6/lib/pkgconfig" >> $GITHUB_ENV
- name: Prepare sanitizers
if: matrix.sanitize
env:
LLVM_PREFIX: /usr/lib/llvm-10
run: |
ASAN_DSO=`$CC -print-file-name=libclang_rt.asan-x86_64.so`
echo "LDSHARED=$CC -shared" >> $GITHUB_ENV
echo "CPPFLAGS=-g -fsanitize=address,undefined -fno-omit-frame-pointer -fopenmp -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION" >> $GITHUB_ENV
echo "LDFLAGS=-g -fsanitize=address,undefined -shared-libasan -fopenmp=libomp" >> $GITHUB_ENV
echo "ASAN_DSO=$ASAN_DSO" >> $GITHUB_ENV
echo "ASAN_OPTIONS=suppressions=${{ github.workspace }}/suppressions/asan.supp" >> $GITHUB_ENV
echo "LSAN_OPTIONS=suppressions=${{ github.workspace }}/suppressions/lsan.supp" >> $GITHUB_ENV
echo "TSAN_OPTIONS=suppressions=${{ github.workspace }}/suppressions/tsan.supp" >> $GITHUB_ENV
echo "UBSAN_OPTIONS=suppressions=${{ github.workspace }}/suppressions/ubsan.supp:print_stacktrace=1" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$LLVM_PREFIX/lib:`dirname $ASAN_DSO`" >> $GITHUB_ENV
echo "$LLVM_PREFIX/bin" >> $GITHUB_PATH
# workaround for https://github.com/google/sanitizers/issues/89
# otherwise libIlmImf-2_3.so ends up as <unknown module>
echo "DLCLOSE_PRELOAD=${{ github.workspace }}/dlclose.so" >> $GITHUB_ENV
echo -e '#include <stdio.h>\nint dlclose(void*handle){return 0;}' | $CC -shared -xc -odlclose.so -
- name: Configure libvips
run:
./autogen.sh
--disable-dependency-tracking
--disable-deprecated || (cat config.log && exit 1)
- name: Build libvips
run: make V=0 -j$JOBS
- name: Check libvips
run: make V=0 check
- name: Install libvips
run: sudo make V=0 install
- name: Rebuild the shared library cache
if: contains(matrix.os, 'ubuntu')
run: sudo ldconfig
- name: Install pyvips
run: pip3 install pyvips[test]
- name: Run test suite
env:
VIPS_LEAK: 1
LD_PRELOAD: ${{ env.ASAN_DSO }} ${{ env.DLCLOSE_PRELOAD }}
run: python3 -m pytest -sv --log-cli-level=WARNING test/test-suite