build: tools workflow (first draft, to be tested)
This commit is contained in:
parent
4a1f1c6daa
commit
25feca605d
0
.clang-tidy
Normal file
0
.clang-tidy
Normal file
78
.github/workflows/tools.yml
vendored
Normal file
78
.github/workflows/tools.yml
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
name: tools
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- tools
|
||||
|
||||
jobs:
|
||||
|
||||
iwyu:
|
||||
timeout-minutes: 60
|
||||
|
||||
env:
|
||||
IWYU: "0.22"
|
||||
LLVM: "18"
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install llvm/clang
|
||||
# see: https://apt.llvm.org/
|
||||
run: |
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||
sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-$LLVM main"
|
||||
sudo apt update
|
||||
sudo apt remove -y "llvm*"
|
||||
sudo apt remove -y "libclang-dev*"
|
||||
sudo apt remove -y "clang*"
|
||||
sudo apt install -y llvm-$LLVM-dev
|
||||
sudo apt install -y libclang-$LLVM-dev
|
||||
sudo apt install -y clang-$LLVM
|
||||
- name: Compile iwyu
|
||||
# see: https://github.com/include-what-you-use/include-what-you-use
|
||||
working-directory: build
|
||||
run: |
|
||||
git clone https://github.com/include-what-you-use/include-what-you-use.git --branch $IWYU --depth 1
|
||||
mkdir include-what-you-use/build
|
||||
cd include-what-you-use/build
|
||||
cmake -DCMAKE_C_COMPILER=clang-$LLVM \
|
||||
-DCMAKE_CXX_COMPILER=clang++-$LLVM \
|
||||
-DCMAKE_INSTALL_PREFIX=./ \
|
||||
..
|
||||
make -j4
|
||||
bin/include-what-you-use --version
|
||||
- name: Compile tests
|
||||
working-directory: build
|
||||
run: |
|
||||
export PATH=$PATH:${GITHUB_WORKSPACE}/build/include-what-you-use/build/bin
|
||||
cmake -DBUILD_TESTING=ON
|
||||
-Dlibuv_buildtests=OFF
|
||||
-DCMAKE_C_COMPILER=clang-$LLVM \
|
||||
-DCMAKE_CXX_COMPILER=clang++-$LLVM \
|
||||
-DCMAKE_CXX_INCLUDE_WHAT_YOU_USE="include-what-you-use;-Xiwyu;--mapping_file=${GITHUB_WORKSPACE}/uwv.imp;-Xiwyu;--no_fwd_decls;-Xiwyu;--verbose=1" \
|
||||
..
|
||||
make -j4
|
||||
|
||||
clang-tidy:
|
||||
timeout-minutes: 60
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Compile tests
|
||||
working-directory: build
|
||||
env:
|
||||
CXX: clang++
|
||||
run: |
|
||||
cmake -DBUILD_TESTING=ON -Dlibuv_buildtests=OFF -DUSE_CLANG_TIDY=ON ..
|
||||
make -j4
|
||||
- name: Run tests
|
||||
working-directory: build
|
||||
env:
|
||||
CTEST_OUTPUT_ON_FAILURE: 1
|
||||
run: ctest -C Debug -j4
|
||||
@ -34,6 +34,7 @@ endif()
|
||||
option(USE_LIBCPP "Use libc++ by adding -stdlib=libc++ flag if available." ON)
|
||||
option(USE_ASAN "Use address sanitizer by adding -fsanitize=address -fno-omit-frame-pointer flags" OFF)
|
||||
option(USE_UBSAN "Use address sanitizer by adding -fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer flags" OFF)
|
||||
option(USE_CLANG_TIDY "Enable static analysis with clang-tidy" OFF)
|
||||
option(BUILD_UVW_LIBS "Prepare targets for static library rather than for a header-only library." OFF)
|
||||
option(BUILD_UVW_SHARED_LIB "Prepare targets for shared library rather than for a header-only library." OFF)
|
||||
option(FIND_LIBUV "Try finding libuv library development files in the system" OFF)
|
||||
@ -66,6 +67,13 @@ if(NOT WIN32 AND USE_LIBCPP)
|
||||
cmake_pop_check_state()
|
||||
endif()
|
||||
|
||||
if(USE_CLANG_TIDY)
|
||||
find_program(CLANG_TIDY_EXECUTABLE "clang-tidy")
|
||||
|
||||
if(NOT CLANG_TIDY_EXECUTABLE)
|
||||
message(VERBOSE "The option USE_CLANG_TIDY is set but clang-tidy executable is not available.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Required minimal libuv version
|
||||
set(LIBUV_VERSION 1.49.0)
|
||||
@ -157,6 +165,10 @@ else()
|
||||
target_link_libraries(uvw INTERFACE $<$<CONFIG:Debug>:-fsanitize=undefined>)
|
||||
endif()
|
||||
|
||||
if(CLANG_TIDY_EXECUTABLE)
|
||||
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE};--config-file=${uwv_SOURCE_DIR}/.clang-tidy;--header-filter=${uwv_SOURCE_DIR}/src/uvw/.*")
|
||||
endif()
|
||||
|
||||
if(HAS_LIBCPP)
|
||||
target_compile_options(uvw BEFORE INTERFACE -stdlib=libc++)
|
||||
endif()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user