forked from libvips/libvips
-
Notifications
You must be signed in to change notification settings - Fork 1
138 lines (117 loc) · 5.41 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: CI
on: [ push, pull_request, workflow_dispatch ]
jobs:
CI:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: "Linux x64 (Ubuntu 22.04) - GCC 11"
os: ubuntu-22.04
build: { cc: gcc, cxx: g++, linker: ld }
shell: bash
- name: "Linux x64 (Ubuntu 22.04) - Clang 14 with ASan and UBSan"
os: ubuntu-22.04
build: { cc: clang-14, cxx: clang++-14, linker: ld.lld-14, sanitize: true }
shell: bash
- name: "macOS (12.6) - Xcode 14.2"
os: macos-12
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.shell }}
env:
CC: ${{ matrix.build.cc }}
CXX: ${{ matrix.build.cxx }}
LD: ${{ matrix.build.linker }}
CPPFLAGS: -Wall
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Update apt
if: runner.os == 'Linux'
run: sudo apt-get update -qq
- name: Install Ubuntu dependencies
if: runner.os == 'Linux'
run:
sudo apt-get install -fqq
meson
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 libhwy-dev
liblcms2-dev libpoppler-glib-dev librsvg2-dev
libopenexr-dev libpango1.0-dev libarchive-dev
libopenslide-dev libffi-dev libopenjp2-7-dev
libimagequant-dev libcgif-dev
liborc-0.4-dev # FIXME: Remove once libhwy 1.0.5 is available.
- name: Install macOS dependencies
if: runner.os == 'macOS'
run: |
brew install meson ninja fftw fontconfig glib libexif libarchive little-cms2 highway pango pkg-config
brew install cfitsio cgif jpeg-xl libheif libimagequant mozjpeg libmatio librsvg libspng libtiff openexr openjpeg openslide poppler webp
- name: Install Clang 14
if: runner.os == 'Linux' && matrix.build.cc == 'clang-14'
run:
sudo apt-get install -fqq
clang-14 libomp-14-dev lld-14 llvm-14
- name: Prepare macOS environment
if: runner.os == 'macOS'
run: |
echo "PKG_CONFIG_PATH=$(brew --prefix mozjpeg)/lib/pkgconfig:$(brew --prefix libarchive)/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV
- name: Prepare sanitizers
if: matrix.build.sanitize
env:
LLVM_PREFIX: /usr/lib/llvm-14
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
# Glib is built without -fno-omit-frame-pointer. We need
# to disable the fast unwinder to get full stacktraces.
# FIXME: remove `intercept_tls_get_addr=0`
# https://github.com/google/sanitizers/issues/1322
echo "ASAN_OPTIONS=suppressions=${{ github.workspace }}/suppressions/asan.supp:fast_unwind_on_malloc=0:allocator_may_return_null=1:intercept_tls_get_addr=0" >> $GITHUB_ENV
echo "LSAN_OPTIONS=suppressions=${{ github.workspace }}/suppressions/lsan.supp:fast_unwind_on_malloc=0" >> $GITHUB_ENV
echo "TSAN_OPTIONS=suppressions=${{ github.workspace }}/suppressions/tsan.supp" >> $GITHUB_ENV
# Ensure UBSan issues causes the program to abort.
echo "UBSAN_OPTIONS=suppressions=${{ github.workspace }}/suppressions/ubsan.supp:halt_on_error=1:abort_on_error=1: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:
meson setup build
-Ddebug=true
-Ddeprecated=false
|| (cat build/meson-logs/meson-log.txt && exit 1)
- name: Build libvips
run: ninja -C build
- name: Check libvips
run: ninja -C build test
- name: Install libvips
run: sudo ninja -C build install
- name: Rebuild the shared library cache
if: runner.os == 'Linux'
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