Add ASAN tests to github CI ##build

This commit is contained in:
Riccardo Schirone 2020-09-01 11:22:51 +02:00 committed by Riccardo Schirone
parent b8e90511c6
commit 8de4315fa3
2 changed files with 28 additions and 11 deletions

View File

@ -21,11 +21,13 @@ jobs:
build-and-test:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 35
continue-on-error: ${{ matrix.ignore_error }}
timeout-minutes: ${{ matrix.timeout }}
strategy:
fail-fast: false
matrix:
name: [linux-acr-gcc-tests, linux-acr-clang-build, linux-acr-clang-tests, linux-meson-gcc-build, linux-meson-gcc-tests, linux-meson-gcc-newshell-tests, macos-clang-tests]
name: [linux-acr-gcc-tests, linux-acr-clang-build, linux-acr-clang-tests, linux-meson-gcc-build, linux-meson-gcc-tests, linux-meson-gcc-newshell-tests, macos-clang-tests, linux-gcc-tests-asan]
ignore_error: [false]
include:
- name: linux-acr-gcc-tests
os: ubuntu-latest
@ -33,12 +35,14 @@ jobs:
compiler: gcc
run_tests: true
enabled: true
timeout: 35
- name: linux-acr-clang-tests
os: ubuntu-latest
build_system: acr
compiler: clang
run_tests: true
enabled: ${{ github.event_name != 'pull_request' }}
timeout: 35
- name: linux-meson-gcc-tests
os: ubuntu-latest
build_system: meson
@ -47,11 +51,13 @@ jobs:
coverage: true
run_tests: true
enabled: ${{ github.event_name != 'pull_request' }}
timeout: 35
- name: linux-acr-clang-build
os: ubuntu-latest
build_system: acr
compiler: clang
enabled: ${{ github.event_name == 'pull_request' }}
timeout: 35
- name: linux-meson-gcc-build
os: ubuntu-latest
build_system: meson
@ -59,6 +65,7 @@ jobs:
meson_options: -Db_coverage=true
coverage: true
enabled: ${{ github.event_name == 'pull_request' }}
timeout: 35
- name: linux-meson-gcc-newshell-tests
os: ubuntu-latest
build_system: meson
@ -66,12 +73,26 @@ jobs:
newshell: true
run_tests: true
enabled: true
timeout: 35
- name: macos-clang-tests
os: macos-latest
build_system: acr
compiler: clang
run_tests: true
enabled: true
timeout: 35
- name: linux-gcc-tests-asan
os: ubuntu-latest
build_system: meson
compiler: gcc
cflags: '-DR2_ASSERT_STDOUT=1'
meson_options: -Db_sanitize=address,undefined
asan_options: 'detect_leaks=0,detect_odr_violation=0'
run_tests: true
enabled: ${{ github.event_name != 'pull_request' || contains(github.head_ref, 'asan') }}
timeout: 100
# NOTE: asan errors ignored for release- branch for now, because there are too many issues that would block the release
ignore_error: ${{ github.event_name == 'push' && contains(github.ref, 'release-') }}
steps:
- uses: actions/checkout@v2
@ -102,13 +123,15 @@ jobs:
run: ./configure --prefix=${HOME} && make
env:
CC: ${{ matrix.compiler }}
CFLAGS: ${{ matrix.cflags }}
- name: Build with Meson
if: matrix.build_system == 'meson' && matrix.enabled
run: |
export PATH=${HOME}/.local/bin:${PATH}
meson --prefix=${HOME} build && ninja -C build
meson --prefix=${HOME} ${{ matrix.meson_options }} build && ninja -C build
env:
CC: ${{ matrix.compiler }}
CFLAGS: ${{ matrix.cflags }}
- name: Install with make
if: matrix.build_system == 'acr' && matrix.enabled
run: |
@ -140,6 +163,7 @@ jobs:
make
env:
NEWSHELL: ${{ matrix.newshell }}
ASAN_OPTIONS: ${{ matrix.asan_options }}
- name: Run fuzz tests
if: matrix.run_tests && matrix.enabled && (github.event_name != 'pull_request' || contains(github.event.pull_request.head.ref, 'fuzz'))
run: |
@ -153,6 +177,7 @@ jobs:
make fuzz-tests
env:
NEWSHELL: ${{ matrix.newshell }}
ASAN_OPTIONS: ${{ matrix.asan_options }}
- name: Upload coverage info
uses: codecov/codecov-action@v1
if: matrix.coverage == '1' && matrix.enabled

View File

@ -51,18 +51,10 @@ jobs:
#- os: linux
# env: COMPILER_NAME=clang CXX=clang++ CC=clang R2_TESTS_DISABLE=1 FUZZIT=0 INSTALL_SYSTEM=static CXXFLAGS="-fsanitize=fuzzer"
# TODO: move this as new GitHub workflows
# ASAN as a best effort on every push
- if: (not head_branch =~ ^release-* AND not head_branch =~ ^prerelease-* AND not branch =~ ^release-* AND not branch =~ ^prerelease-*) AND (head_branch =~ ^asan-* OR type = push)
os: linux
env: COMPILER_NAME=gcc INSTALL_SYSTEM=meson ASAN=1 ASAN_OPTIONS=detect_odr_violation=0 LSAN_OPTIONS=detect_leaks=0 CFLAGS="-DR2_ASSERT_STDOUT=1"
# release-only: meson build with system libraries
- if: head_branch =~ ^release-* OR head_branch =~ ^prerelease-* OR branch =~ ^release-* OR branch =~ ^prerelease-*
os: linux
env: COMPILER_NAME=gcc CXX=g++ CC=gcc INSTALL_SYSTEM=meson R2_SYS_MAGIC=true R2_SYS_ZIP=true R2_SYS_LZ4=true R2_SYS_ZLIB=true R2_SYS_OPENSSL=true
# release-only: meson build with ASAN and R2_ASSERT_STDOUT
- if: head_branch =~ ^release-* OR head_branch =~ ^prerelease-* OR branch =~ ^release-* OR branch =~ ^prerelease-*
os: linux
env: COMPILER_NAME=gcc CFLAGS="-DR2_ASSERT_STDOUT=1" INSTALL_SYSTEM=meson ASAN=1 ASAN_OPTIONS=detect_odr_violation=0 LSAN_OPTIONS=detect_leaks=0 RELEASE=1
# release-only: nogpl plugins file, just test if it builds
- if: head_branch =~ ^release-* OR head_branch =~ ^prerelease-* OR branch =~ ^release-* OR branch =~ ^prerelease-*
os: linux