From f2e5b7e9da3bc3022e4f9bca11c9f026f1c83959 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Tue, 7 Sep 2021 12:14:45 +0200 Subject: [PATCH] CI: resolve failures and various improvements (#2426) * Simplify CI workflow * CI: upgrade Ubuntu's Clang version to 12 * CI: upgrade macOS runner to version 11 (Big Sur) * CI: temporarily disable the M1 runner * CI: output test suite log upon failure * CI: avoid brew update/upgrade steps Since it may take a long time. * CI: all jobs are supposed to succeed * Fix test_descriptors.c failure after f8c2a36 Use a RANDOM image to create many crops from one source. --- .github/workflows/ci.yml | 89 +++++++++++++++++++--------------------- test/test_descriptors.c | 4 +- 2 files changed, 44 insertions(+), 49 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 83d0bcb3..a13df2fc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,54 +6,60 @@ 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, shell: bash } include: - - name: "Linux x64 (Ubuntu 20.04) - Clang 10 with ASan and UBSan" + - name: "Linux x64 (Ubuntu 20.04) - GCC 10" os: ubuntu-20.04 - sanitize: true - build: { cc: clang-10, cxx: clang++-10, linker: ld.lld-10, shell: bash } - - name: "macOS (10.15) - Xcode 12.3" - os: macos-10.15 - sanitize: false - build: { cc: clang, cxx: clang++, linker: ld.lld, shell: bash } - - name: "macOS (10.15) - Xcode 12.3 - M1" - os: macos-m1 - sanitize: false - build: { cc: clang, cxx: clang++, linker: ld.lld, shell: "/usr/bin/arch -arch arm64e /bin/bash -l {0}" } + build: { cc: gcc, cxx: g++, linker: ld } + shell: bash + + - name: "Linux x64 (Ubuntu 20.04) - Clang 12 with ASan and UBSan" + os: ubuntu-20.04 + build: { cc: clang-12, cxx: clang++-12, linker: ld.lld-12, sanitize: true } + shell: bash + + - name: "macOS (11.5) - Xcode 12.5.1" + os: macos-11 + build: { cc: clang, cxx: clang++, linker: ld.lld } + shell: bash + + # TODO: Re-enable self-hosted M1 runner provided by MacStadium + #- name: "macOS (10.15) - Xcode 12.4 - M1" + # os: macos-m1 + # build: { cc: clang, cxx: clang++, linker: ld.lld } + # shell: "/usr/bin/arch -arch arm64e /bin/bash -l {0}" defaults: run: - shell: ${{ matrix.build.shell }} + shell: ${{ matrix.shell }} + + env: + CC: ${{ matrix.build.cc }} + CXX: ${{ matrix.build.cxx }} + LD: ${{ matrix.build.linker }} + CPPFLAGS: -Wall + DEBIAN_FRONTEND: noninteractive + HOMEBREW_NO_AUTO_UPDATE: 1 steps: - name: Checkout code uses: actions/checkout@v2 - name: Update apt - if: contains(matrix.os, 'ubuntu') - env: - DEBIAN_FRONTEND: noninteractive + if: runner.os == 'Linux' run: sudo -E apt-get update -qq -o Acquire::Retries=3 - name: Add Ubuntu PPAs - if: contains(matrix.os, 'ubuntu') + if: runner.os == 'Linux' run: | sudo add-apt-repository ppa:strukturag/libde265 sudo add-apt-repository ppa:strukturag/libheif sudo add-apt-repository ppa:lovell/cgif - name: Install Ubuntu dependencies - if: contains(matrix.os, 'ubuntu') - env: - DEBIAN_FRONTEND: noninteractive + if: runner.os == 'Linux' run: sudo -E apt-get install --fix-missing -qq -o Acquire::Retries=3 gtk-doc-tools gobject-introspection @@ -68,44 +74,33 @@ jobs: libopenjp2-7-dev libimagequant-dev libcgif-dev - name: Install macOS dependencies - if: contains(matrix.os, 'macos') + if: runner.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 libimagequant libjpeg-turbo libmatio librsvg libspng libtiff openexr openjpeg openslide poppler webp brew tap lovell/cgif-packaging https://github.com/lovell/cgif-packaging.git brew install --build-bottle lovell/cgif-packaging/cgif - - name: Install Clang 10 - env: - DEBIAN_FRONTEND: noninteractive - if: contains(matrix.os, 'ubuntu') && matrix.build.cc == 'clang-10' + - name: Install Clang 12 + if: runner.os == 'Linux' && matrix.build.cc == 'clang-12' 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 + clang-12 libomp-12-dev lld-12 llvm-12 - name: Prepare Ubuntu environment - if: contains(matrix.os, 'ubuntu') + if: runner.os == 'Linux' run: echo "JOBS=$(nproc)" >> $GITHUB_ENV - name: Prepare macOS environment - if: contains(matrix.os, 'macos') + if: runner.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 + echo "PKG_CONFIG_PATH=$(brew --prefix jpeg-turbo)/lib/pkgconfig:$(brew --prefix libxml2)/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV - name: Prepare sanitizers - if: matrix.sanitize + if: matrix.build.sanitize env: - LLVM_PREFIX: /usr/lib/llvm-10 + LLVM_PREFIX: /usr/lib/llvm-12 run: | ASAN_DSO=`$CC -print-file-name=libclang_rt.asan-x86_64.so` echo "LDSHARED=$CC -shared" >> $GITHUB_ENV @@ -133,13 +128,13 @@ jobs: run: make V=0 -j$JOBS - name: Check libvips - run: make V=0 check + run: make V=0 check || (cat test/test-suite.log && exit 1) - name: Install libvips run: sudo make V=0 install - name: Rebuild the shared library cache - if: contains(matrix.os, 'ubuntu') + if: runner.os == 'Linux' run: sudo ldconfig - name: Install pyvips diff --git a/test/test_descriptors.c b/test/test_descriptors.c index 64c3cda4..cc989b62 100644 --- a/test/test_descriptors.c +++ b/test/test_descriptors.c @@ -56,11 +56,11 @@ main( int argc, char **argv ) /* Opening an image should read the header, then close the fd. */ - printf( "** seq open ..\n" ); + printf( "** rand open ..\n" ); if( !(source = vips_source_new_from_file( argv[1] )) ) vips_error_exit( NULL ); if( !(image = vips_image_new_from_source( source, "", - "access", VIPS_ACCESS_SEQUENTIAL, + "access", VIPS_ACCESS_RANDOM, NULL )) ) vips_error_exit( NULL ); if( count_files( fd_dir ) != n_files )