Add Linux ASAN GitHub Action

This commit is contained in:
James McCoy 2020-11-12 13:22:14 -05:00
parent d0714e87d6
commit eb2aaed5cc
No known key found for this signature in database
GPG Key ID: DFE691AE331BA3DB
4 changed files with 80 additions and 3 deletions

77
.github/workflows/linux.yml vendored Normal file
View File

@ -0,0 +1,77 @@
name: Linux CI
on: [push, pull_request]
env:
# Set "false" to force rebuild of third-party dependencies.
CACHE_ENABLE: true
DEPS_CMAKE_FLAGS: "-DUSE_BUNDLED_GPERF=OFF"
# default target name for functional tests
FUNCTIONALTEST: functionaltest
CI_TARGET: tests
# Environment variables for ccache
CCACHE_COMPRESS: 1
CCACHE_SLOPPINESS: "time_macros,file_macro"
# Default since 3.3; required with newer gcc/clang.
CCACHE_CPP2: 1
jobs:
ASAN:
runs-on: ubuntu-latest
env:
CC: clang-11
steps:
- uses: actions/checkout@v2
- name: Setup commom environment variables
run: |
echo "CI_BUILD_DIR=$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "BUILD_DIR=$GITHUB_WORKSPACE/build" >> $GITHUB_ENV
echo "DEPS_BUILD_DIR=$HOME/nvim-deps" >> $GITHUB_ENV
echo "INSTALL_PREFIX=$HOME/nvim-install" >> $GITHUB_ENV
echo "LOG_DIR=$GITHUB_WORKSPACE/build/log" >> $GITHUB_ENV
echo "NVIM_LOG_FILE=$GITHUB_WORKSPACE/build/.nvimlog" >> $GITHUB_ENV
echo "CMAKE_FLAGS=-DCI_BUILD=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=$HOME/nvim-install -DBUSTED_OUTPUT_TYPE=nvim -DDEPS_PREFIX=$HOME/nvim-deps/usr -DMIN_LOG_LEVEL=3" >> $GITHUB_ENV
echo "ASAN_OPTIONS=detect_leaks=1:check_initialization_order=1:log_path=$GITHUB_WORKSPACE/build/log/asan" >> $GITHUB_ENV
echo "TSAN_OPTIONS=log_path=$GITHUB_WORKSPACE/build/log/tsan" >> $GITHUB_ENV
echo "UBSAN_OPTIONS=print_stacktrace=1 log_path=$GITHUB_WORKSPACE/build/log/ubsan" >> $GITHUB_ENV
echo "VALGRIND_LOG=$GITHUB_WORKSPACE/build/log/valgrind-%p.log" >> $GITHUB_ENV
echo "CACHE_NVIM_DEPS_DIR=$HOME/.cache/nvim-deps" >> $GITHUB_ENV
echo "CACHE_MARKER=$HOME/.cache/nvim-deps/.ci_cache_marker" >> $GITHUB_ENV
echo "CCACHE_BASEDIR=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Setup clang repository
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo add-apt-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-11 main'
- name: Install apt packages
run: |
sudo apt-get update
sudo apt-get install -y autoconf automake build-essential ccache cmake cpanminus cscope gcc-multilib gdb gettext gperf language-pack-tr libtool-bin locales ninja-build pkg-config python python-pip python-setuptools python3 python3-pip python3-setuptools unzip valgrind xclip
- name: Install new clang
run: sudo apt-get install -y clang-11
- name: Set ASAN env vars
run: |
echo "CLANG_SANITIZER=ASAN_UBSAN" >> $GITHUB_ENV
echo "CMAKE_FLAGS=-DCI_BUILD=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=$HOME/nvim-install -DBUSTED_OUTPUT_TYPE=nvim -DDEPS_PREFIX=$HOME/nvim-deps/usr -DMIN_LOG_LEVEL=3 -DPREFER_LUA=ON" >> $GITHUB_ENV
echo "SYMBOLIZER=asan_symbolize-11" >> $GITHUB_ENV
- name: Setup interpreter packages
run: |
./ci/before_install.sh
./ci/install.sh
- name: Cache dependencies
uses: actions/cache@v2
env:
cache-name: asan-deps
with:
path: env.CACHE_NVIM_DEPS_DIR
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.base_ref }}
- name: Build third-party
run: ./ci/before_script.sh
- name: Build and test
run: ./ci/script.sh

View File

@ -45,7 +45,7 @@ env:
- VALGRIND_LOG="$LOG_DIR/valgrind-%p.log"
- CACHE_NVIM_DEPS_DIR="$HOME/.cache/nvim-deps"
# If this file exists, the cache is valid (compile was successful).
- CACHE_MARKER="$CACHE_NVIM_DEPS_DIR/.travis_cache_marker"
- CACHE_MARKER="$CACHE_NVIM_DEPS_DIR/.ci_cache_marker"
# default target name for functional tests
- FUNCTIONALTEST=functionaltest
- CI_TARGET=tests

View File

@ -29,7 +29,7 @@ build_deps() {
if test "${CACHE_ENABLE}" = "false" ; then
export CCACHE_RECACHE=1
elif test -f "${CACHE_MARKER}" ; then
echo "Using third-party dependencies from Travis cache (last update: $(_stat "${CACHE_MARKER}"))."
echo "Using third-party dependencies from cache (last update: $(_stat "${CACHE_MARKER}"))."
cp -a "${CACHE_NVIM_DEPS_DIR}"/. "${DEPS_BUILD_DIR}"
fi

View File

@ -19,7 +19,7 @@ echo "Install neovim module for Python 2."
CC=cc python2 -m pip -q install --user --upgrade pynvim
echo "Install neovim RubyGem."
gem install --no-document --pre neovim
gem install --no-document --user-install --pre neovim
echo "Install neovim npm package"
source ~/.nvm/nvm.sh