diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..2e614077 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,144 @@ +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 + + - name: Install macOS dependencies + if: contains(matrix.os, 'macos') + run: + brew install + autoconf automake libtool + gtk-doc gobject-introspection + cfitsio fftw giflib + glib libexif libgsf + libheif libjpeg-turbo libmatio + librsvg libspng libtiff + little-cms2 openexr openslide + orc pango 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" >> $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 "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 + echo "DLCLOSE_PRELOAD=${{ github.workspace }}/dlclose.so" >> $GITHUB_ENV + echo -e '#include \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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 89843490..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: Test - -# to-do: -# - add a macos test with brew etc. -# - build with clang/asan/etc. and run the fuzz tests - -on: - - push - - pull_request - - workflow_dispatch # manually triggered workflow - -jobs: - build: - runs-on: ubuntu-20.04 - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Update apt - env: - DEBIAN_FRONTEND: noninteractive - run: - sudo apt-get update -qq -o Acquire::Retries=3 - - - name: Add libheif PPA - run: | - sudo add-apt-repository ppa:strukturag/libde265 - sudo add-apt-repository ppa:strukturag/libheif - - - name: Install platform dependencies - env: - DEBIAN_FRONTEND: noninteractive - run: - sudo 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 - libgsl-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 - - - name: Configure libvips - run: CFLAGS=-Wall CXXFLAGS=-Wall ./autogen.sh - --disable-dependency-tracking - --disable-deprecated - - - name: Build libvips - run: make V=0 -j$(nproc) - - - name: Check libvips - run: make V=0 check - - - name: Install libvips - run: | - sudo make V=0 install - sudo ldconfig - - - name: Install pyvips - run: pip3 install pyvips pytest - - - name: Run test suite - run: VIPS_LEAK=1 python3 -m pytest diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index bebdeff5..00000000 --- a/.travis.yml +++ /dev/null @@ -1,163 +0,0 @@ -language: cpp - -env: - global: - - PYTHON=python3 - - PYVIPS_VERSION=master - -addons: - apt: - update: true - sources: &common_sources - # add support for AVIF files - - sourceline: 'ppa:strukturag/libheif' - - sourceline: 'ppa:strukturag/libde265' - packages: &common_packages - - 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 - - libgsl-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 - homebrew: - update: true - packages: - - ccache - - cfitsio - - fftw - - giflib - - glib - - gobject-introspection - - gtk-doc - - libexif - - libgsf - - libheif - - libjpeg-turbo - - libmatio - - librsvg - - libspng - - libtiff - - little-cms2 - - openexr - - openslide - - orc - - pango - - poppler - - webp - -jobs: - allow_failures: - - os: osx - fast_finish: true - include: - - os: linux - dist: bionic - compiler: gcc - name: "Linux x64 (Ubuntu 18.04) - GCC 10" - addons: - apt: - sources: - - *common_sources - - ubuntu-toolchain-r-test - packages: - - *common_packages - - libmagick++-dev - - g++-10 - env: - - JPEG=/usr - - JOBS=`nproc` - - WITH_MAGICK=yes - - CC="gcc-10" - - CXX="g++-10" - - LDSHARED="$CC -shared" - - CFLAGS="-Wcast-function-type" - cache: ccache - - os: linux - dist: bionic - compiler: clang - name: "Linux x64 (Ubuntu 18.04) - Clang 10 with ASan and UBSan" - addons: - apt: - sources: - - *common_sources - - sourceline: deb https://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main - key_url: https://apt.llvm.org/llvm-snapshot.gpg.key - packages: - - *common_packages - - clang-10 - - libomp-10-dev - env: - - JPEG=/usr - - JOBS=`nproc` - - WITH_MAGICK=no - - CC="clang-10" - - CXX="clang++-10" - - LDSHARED="$CC -shared" - - CFLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer -fopenmp -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION" - - CXXFLAGS="$CFLAGS" - - LDFLAGS="-fsanitize=address,undefined -shared-libasan -fopenmp=libomp" - - ASAN_DSO=`$CC -print-file-name=libclang_rt.asan-x86_64.so` - - ASAN_SYMBOLIZER_PATH=`which llvm-symbolizer-10` - - ASAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/suppressions/asan.supp" - - LSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/suppressions/lsan.supp" - - UBSAN_OPTIONS="suppressions=$TRAVIS_BUILD_DIR/suppressions/ubsan.supp:print_stacktrace=1" - - LD_LIBRARY_PATH="/usr/lib/llvm-10/lib:`dirname $ASAN_DSO`" - - DLCLOSE_PRELOAD="$TRAVIS_BUILD_DIR/dlclose.so" - before_script: - # workaround for https://github.com/google/sanitizers/issues/89 - # otherwise libIlmImf-2_2.so ends up as - - echo -e '#include \nint dlclose(void*handle){return 0;}' | $CC -shared -xc -odlclose.so - - cache: ccache - - os: osx - osx_image: xcode11 - name: "macOS (10.14.6) - Xcode 11" - env: - - JPEG=/usr/local/opt/jpeg-turbo - - JOBS="`sysctl -n hw.ncpu`" - - WITH_MAGICK=no - - PATH="/usr/local/opt/ccache/libexec:$PATH" - - PKG_CONFIG_PATH="/usr/local/opt/jpeg-turbo/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig:$PKG_CONFIG_PATH" - - HOMEBREW_NO_AUTO_UPDATE=1 - - CC="clang" - - CXX="clang++" - cache: ccache - -install: - - $PYTHON -m pip download --no-deps https://github.com/libvips/pyvips/archive/$PYVIPS_VERSION.tar.gz - - tar xf $PYVIPS_VERSION.tar.gz - - $PYTHON -m pip install --user --upgrade pyvips-$PYVIPS_VERSION/[test] - - ./autogen.sh - --disable-dependency-tracking - --disable-deprecated - --with-jpeg-includes=$JPEG/include - --with-jpeg-libraries=$JPEG/lib - --with-magick=$WITH_MAGICK - - make -j$JOBS -s - -script: - - make -j$JOBS -s -k V=0 VERBOSE=1 check - - LD_LIBRARY_PATH="$PWD/libvips/.libs:$LD_LIBRARY_PATH" - DYLD_LIBRARY_PATH=$PWD/libvips/.libs - LD_PRELOAD="$ASAN_DSO $DLCLOSE_PRELOAD" - $PYTHON -m pytest -sv --log-cli-level=WARNING test/test-suite diff --git a/README.md b/README.md index 80d2bbaa..8d362ff7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # libvips : an image processing library -[![Test](https://github.com/libvips/libvips/workflows/Test/badge.svg)](https://github.com/libvips/libvips/actions?query=workflow%3ATest) +[![CI](https://github.com/libvips/libvips/workflows/CI/badge.svg)](https://github.com/libvips/libvips/actions) [![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/libvips.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=2&q=proj:libvips) [![Coverity Status](https://scan.coverity.com/projects/6503/badge.svg)](https://scan.coverity.com/projects/jcupitt-libvips) [![Gitter](https://badges.gitter.im/libvips/devchat.svg)](https://gitter.im/libvips/devchat?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) diff --git a/suppressions/lsan.supp b/suppressions/lsan.supp index ec44e871..47d8282e 100644 --- a/suppressions/lsan.supp +++ b/suppressions/lsan.supp @@ -3,5 +3,6 @@ leak:python3 leak:bash leak:libfontconfig.so leak:libglib-2.0.so -leak:libIlmImf-2_2.so +leak:libIlmImf-2_3.so +leak:libIlmThread-2_3.so leak:libstdc++.so