Add LLVM 17 support #1807
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: build | |
on: [push] | |
env: | |
DEFAULT_COMPILER: gcc | |
DEFAULT_SANITIZE_ADDRESS: OFF | |
DEFAULT_SANITIZE_THREAD: OFF | |
DEFAULT_SANITIZE_UB: OFF | |
DEFAULT_STATIC_ANALYSIS: OFF | |
DEFAULT_COVERAGE: OFF | |
DEFAULT_AVX2: ON | |
jobs: | |
build: | |
runs-on: ${{matrix.os}} | |
env: | |
BUILD_TYPE: ${{matrix.BUILD_TYPE}} | |
SANITIZE_ADDRESS: ${{matrix.SANITIZE_ADDRESS}} | |
SANITIZE_THREAD: ${{matrix.SANITIZE_THREAD}} | |
SANITIZE_UB: ${{matrix.SANITIZE_UB}} | |
STATIC_ANALYSIS: ${{matrix.STATIC_ANALYSIS}} | |
COVERAGE: ${{matrix.COVERAGE}} | |
COMPILER: ${{matrix.COMPILER}} | |
CPPLINT: ${{matrix.CPPLINT}} | |
CPPCHECK: ${{matrix.CPPCHECK}} | |
AVX2: ${{matrix.AVX2}} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: GCC 12 Release | |
os: ubuntu-22.04 | |
BUILD_TYPE: Release | |
COMPILER: gcc | |
- name: GCC 12 Release with ASan | |
os: ubuntu-22.04 | |
BUILD_TYPE: Release | |
COMPILER: gcc | |
SANITIZE_ADDRESS: ON | |
- name: GCC 12 Release with TSan | |
os: ubuntu-22.04 | |
BUILD_TYPE: Release | |
COMPILER: gcc | |
SANITIZE_THREAD: ON | |
- name: GCC 12 Release with UBSan | |
os: ubuntu-22.04 | |
BUILD_TYPE: Release | |
COMPILER: gcc | |
SANITIZE_UB: ON | |
- name: GCC 12 Debug | |
os: ubuntu-22.04 | |
BUILD_TYPE: Debug | |
COMPILER: gcc | |
- name: GCC 12 Debug with ASan | |
os: ubuntu-22.04 | |
BUILD_TYPE: Debug | |
COMPILER: gcc | |
SANITIZE_ADDRESS: ON | |
- name: GCC 12 Debug with TSan | |
os: ubuntu-22.04 | |
BUILD_TYPE: Debug | |
COMPILER: gcc | |
SANITIZE_THREAD: ON | |
- name: GCC 12 Debug with UBSan | |
os: ubuntu-22.04 | |
BUILD_TYPE: Debug | |
COMPILER: gcc | |
SANITIZE_UB: ON | |
- name: GCC 12 Debug without AVX2 | |
os: ubuntu-22.04 | |
BUILD_TYPE: Debug | |
COMPILER: gcc | |
AVX2: OFF | |
- name: GCC 12 Release static analysis & cpplint | |
os: ubuntu-22.04 | |
BUILD_TYPE: Release | |
COMPILER: gcc | |
STATIC_ANALYSIS: ON | |
CPPLINT: ON | |
- name: GCC 12 default CMake configuration | |
os: ubuntu-22.04 | |
COMPILER: gcc | |
- name: clang 17 Release | |
os: ubuntu-22.04 | |
BUILD_TYPE: Release | |
COMPILER: clang | |
- name: clang 17 Release with ASan | |
os: ubuntu-22.04 | |
BUILD_TYPE: Release | |
SANITIZE_ADDRESS: ON | |
COMPILER: clang | |
- name: clang 17 Release with TSan | |
os: ubuntu-22.04 | |
BUILD_TYPE: Release | |
SANITIZE_THREAD: ON | |
COMPILER: clang | |
- name: clang 17 Release with UBSan | |
os: ubuntu-22.04 | |
BUILD_TYPE: Release | |
SANITIZE_UB: ON | |
COMPILER: clang | |
- name: clang 17 Debug | |
os: ubuntu-22.04 | |
BUILD_TYPE: Debug | |
COMPILER: clang | |
- name: clang 17 Debug with ASan | |
os: ubuntu-22.04 | |
BUILD_TYPE: Debug | |
SANITIZE_ADDRESS: ON | |
COMPILER: clang | |
- name: clang 17 Debug with TSan | |
os: ubuntu-22.04 | |
BUILD_TYPE: Debug | |
SANITIZE_THREAD: ON | |
COMPILER: clang | |
- name: clang 17 Debug with UBSan | |
os: ubuntu-22.04 | |
BUILD_TYPE: Debug | |
SANITIZE_UB: ON | |
COMPILER: clang | |
- name: clang 17 Release static analysis | |
os: ubuntu-22.04 | |
BUILD_TYPE: Release | |
COMPILER: clang | |
STATIC_ANALYSIS: ON | |
- name: clang 17 Debug static analysis | |
os: ubuntu-22.04 | |
BUILD_TYPE: Debug | |
COMPILER: clang | |
STATIC_ANALYSIS: ON | |
- name: XCode Release | |
os: macos-latest | |
BUILD_TYPE: Release | |
COMPILER: macos-clang | |
AVX2: OFF | |
- name: XCode Release with ASan | |
os: macos-latest | |
BUILD_TYPE: Release | |
COMPILER: macos-clang | |
SANITIZE_ADDRESS: ON | |
AVX2: OFF | |
- name: XCode Release with TSan | |
os: macos-latest | |
BUILD_TYPE: Release | |
COMPILER: macos-clang | |
SANITIZE_THREAD: ON | |
AVX2: OFF | |
- name: XCode Release with UBSan | |
os: macos-latest | |
BUILD_TYPE: Release | |
COMPILER: macos-clang | |
SANITIZE_UB: ON | |
AVX2: OFF | |
- name: XCode Debug with cppcheck | |
os: macos-latest | |
BUILD_TYPE: Debug | |
COMPILER: macos-clang | |
CPPCHECK: ON | |
AVX2: OFF | |
- name: XCode Debug with ASan | |
os: macos-latest | |
BUILD_TYPE: Debug | |
COMPILER: macos-clang | |
SANITIZE_ADDRESS: ON | |
AVX2: OFF | |
- name: XCode Debug with TSan | |
os: macos-latest | |
BUILD_TYPE: Debug | |
COMPILER: macos-clang | |
SANITIZE_THREAD: ON | |
AVX2: OFF | |
- name: XCode Debug with UBSan | |
os: macos-latest | |
BUILD_TYPE: Debug | |
COMPILER: macos-clang | |
SANITIZE_UB: ON | |
AVX2: OFF | |
- name: Debug coverage | |
os: ubuntu-22.04 | |
BUILD_TYPE: Debug | |
COMPILER: gcc | |
COVERAGE: ON | |
AVX2: OFF | |
- name: Release coverage | |
os: ubuntu-22.04 | |
BUILD_TYPE: Release | |
COMPILER: gcc | |
COVERAGE: ON | |
AVX2: OFF | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Setup common dependencies for Linux | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libboost-dev libc6-dev-i386 | |
sudo apt-get remove clang-tidy-11 | |
if: runner.os == 'Linux' | |
- name: Setup dependencies for cpplint | |
run: pip install cpplint | |
if: env.CPPLINT == 'ON' | |
- name: Setup dependencies for GCC | |
run: | | |
sudo apt-get install -y g++-12 | |
if: runner.os == 'Linux' && env.COMPILER == 'gcc' | |
- name: Setup dependencies for Linux LLVM (common) | |
run: | | |
curl 'https://apt.llvm.org/llvm-snapshot.gpg.key' \ | |
| sudo apt-key add - | |
echo 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main' \ | |
| sudo tee -a /etc/apt/sources.list | |
sudo apt-get update | |
sudo apt-get install -y clang-17 iwyu | |
if: runner.os == 'Linux' && env.COMPILER == 'clang' | |
- name: Setup dependencies for Linux LLVM (Release) | |
run: sudo apt-get install -y libomp5-17 llvm-17 lld-17 | |
if: > | |
runner.os == 'Linux' && env.COMPILER == 'clang' | |
&& env.BUILD_TYPE == 'Release' | |
- name: Setup dependencies for Linux LLVM (static analysis) | |
run: sudo apt-get install -y clang-tools-17 | |
if: > | |
runner.os == 'Linux' && env.COMPILER == 'clang' | |
&& env.STATIC_ANALYSIS == 'ON' | |
- name: Setup dependencies for Linux LLVM (not static analysis) | |
run: sudo apt-get install -y clang-tidy-17 | |
if: > | |
runner.os == 'Linux' && env.COMPILER == 'clang' | |
&& env.STATIC_ANALYSIS != 'ON' | |
- name: Set up dependencies for Linux (coverage) | |
run: | | |
sudo apt-get install lcov cpanminus | |
sudo cpanm install JSON | |
if: runner.os == 'Linux' && env.COVERAGE == 'ON' | |
- name: Set up dependencies for macOS (common) | |
run: | | |
brew install boost include-what-you-use | |
if: runner.os == 'macOS' | |
- name: Set up dependencies for macOS (cppcheck) | |
run: brew install cppcheck | |
if: runner.os == 'macOS' && env.CPPCHECK == 'ON' | |
- name: Create build environment | |
run: mkdir ${{github.workspace}}/build | |
- name: Configure CMake | |
# Use a bash shell so we can use the same syntax for environment | |
# variable access regardless of the host operating system | |
shell: bash | |
working-directory: ${{github.workspace}}/build | |
run: | | |
COMPILER="${COMPILER:-$DEFAULT_COMPILER}" | |
SANITIZE_ADDRESS="${SANITIZE_ADDRESS:-$DEFAULT_SANITIZE_ADDRESS}" | |
SANITIZE_THREAD="${SANITIZE_THREAD:-$DEFAULT_SANITIZE_THREAD}" | |
SANITIZE_UB="${SANITIZE_UB:-$DEFAULT_SANITIZE_UB}" | |
STATIC_ANALYSIS="${STATIC_ANALYSIS:-$DEFAULT_STATIC_ANALYSIS}" | |
COVERAGE="${COVERAGE:-$DEFAULT_COVERAGE}" | |
AVX2="${AVX2:-$DEFAULT_AVX2}" | |
export PATH="$HOME/.local/bin:$PATH" | |
if [[ -n "$BUILD_TYPE" ]]; then | |
CBT="-DCMAKE_BUILD_TYPE=$BUILD_TYPE" | |
else | |
CBT="" | |
fi | |
if [[ $COMPILER == "gcc" ]]; then | |
V=12 | |
if [[ $COVERAGE == "ON" ]]; then | |
EXTRA_CMAKE_ARGS=("-DGCOV_PATH=/usr/bin/gcov-$V") | |
else | |
EXTRA_CMAKE_ARGS=() | |
fi | |
export CC=gcc-$V | |
export CXX=g++-$V | |
elif [[ $COMPILER == "clang" ]]; then | |
V=17 | |
export CC=clang-$V | |
export CXX=clang++-$V | |
if [[ $BUILD_TYPE == "Release" ]]; then | |
EXTRA_CMAKE_ARGS=(\ | |
"-DLLVMAR_EXECUTABLE=/usr/bin/llvm-ar-$V" \ | |
"-DLLVMNM_EXECUTABLE=/usr/bin/llvm-nm-$V" \ | |
"-DLLVMRANLIB_EXECUTABLE=/usr/bin/llvm-ranlib-$V") | |
else | |
EXTRA_CMAKE_ARGS=() | |
fi | |
# LLVM static analysis wart | |
if [[ $STATIC_ANALYSIS == "ON" ]]; then | |
STATIC_ANALYSIS=OFF | |
# Workaround https://github.com/llvm/llvm-project/issues/61576 | |
# scan-build defaults to -std=c++14 | |
EXTRA_CMAKE_ARGS=("${EXTRA_CMAKE_ARGS[@]}" \ | |
"-DCMAKE_CXX_FLAGS=-std=c++17") | |
else | |
EXTRA_CMAKE_ARGS=("${EXTRA_CMAKE_ARGS[@]}" \ | |
"-DCLANG_TIDY_EXE=/usr/bin/clang-tidy-$V") | |
fi | |
elif [[ $COMPILER == "macos-clang" ]]; then | |
export CC=clang | |
export CXX=clang++ | |
fi | |
cmake "$GITHUB_WORKSPACE" "$CBT" -DSTANDALONE=ON -DMAINTAINER_MODE=ON \ | |
"-DSANITIZE_ADDRESS=${SANITIZE_ADDRESS}" \ | |
"-DSANITIZE_THREAD=${SANITIZE_THREAD}" \ | |
"-DSANITIZE_UB=${SANITIZE_UB}" \ | |
"-DSTATIC_ANALYSIS=${STATIC_ANALYSIS}" "-DCOVERAGE=${COVERAGE}" \ | |
"-DAVX2=${AVX2}" "${EXTRA_CMAKE_ARGS[@]}" | |
- name: Build | |
working-directory: ${{github.workspace}}/build | |
run: make -j3 | |
if: env.STATIC_ANALYSIS != 'ON' || env.COMPILER != 'clang' | |
- name: clang static analysis | |
working-directory: ${{github.workspace}}/build | |
run: | | |
/usr/bin/scan-build-17 --status-bugs -stats -analyze-headers \ | |
--force-analyze-debug-code make -j3; | |
if: env.STATIC_ANALYSIS == 'ON' && env.COMPILER == 'clang' | |
- name: Correctness test | |
working-directory: ${{github.workspace}}/build | |
run: ctest -j3 -V | |
if: env.STATIC_ANALYSIS != 'ON' && env.COVERAGE != 'ON' | |
- name: Benchmark correctness test | |
working-directory: ${{github.workspace}}/build | |
run: make quick_benchmarks | |
if: env.STATIC_ANALYSIS != 'ON' && env.COVERAGE != 'ON' | |
- name: DeepState 1 minute fuzzing | |
working-directory: ${{github.workspace}}/build | |
run: make -j2 deepstate_1m | |
if: > | |
env.STATIC_ANALYSIS != 'ON' && env.COVERAGE != 'ON' | |
&& (runner.os != 'macOS' | |
|| (env.SANITIZE_ADDRESS == 'OFF' && env.SANITIZE_THREAD == 'OFF')) | |
- name: DeepState libfuzzer 1 minute fuzzing | |
working-directory: ${{github.workspace}}/build | |
run: make -j2 deepstate_lf_1m | |
if: > | |
env.STATIC_ANALYSIS != 'ON' && env.COVERAGE != 'ON' | |
&& env.COMPILER == 'clang' && env.BUILD_TYPE != 'Release' | |
&& env.SANITIZE_THREAD != 'ON' | |
- name: Valgrind test | |
working-directory: ${{github.workspace}}/build | |
run: | | |
sudo apt-get install -y libc6-dbg | |
sudo snap install --classic valgrind | |
make valgrind | |
if: > | |
env.SANITIZE_ADDRESS != 'ON' && env.SANITIZE_THREAD != 'ON' | |
&& env.SANITIZE_UB != 'ON' && env.STATIC_ANALYSIS != 'ON' | |
&& runner.os == 'Linux' && env.COVERAGE != 'ON' | |
- name: Gather coverage data | |
working-directory: ${{github.workspace}}/build | |
run: | | |
make -j3 coverage | |
if: env.COVERAGE == 'ON' | |
- name: Upload coverage data | |
uses: codecov/codecov-action@v2 | |
with: | |
flags: ${{matrix.BUILD_TYPE}} | |
fail_ci_if_error: true | |
directory: ${{github.workspace}}/build | |
functionalities: gcov | |
if: env.COVERAGE == 'ON' |