forked from scylladb/scylladb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
iwyu is short for "include what you use". this workflow is added to identify missing "#include" and extraneous "#include" in C++ source files. This workflow is triggered when a pull request is created targetting the "master" branch. It uses the clang-include-cleaner tool provided by clang-tools package to analyze all the ".cc" and ".hh" source files. Signed-off-by: Kefu Chai <[email protected]>
- Loading branch information
Showing
3 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: setup-build-env | ||
description: Setup Building Environment | ||
inputs: | ||
install_clang_tool: | ||
description: 'install clang-tool' | ||
required: false | ||
default: false | ||
type: boolean | ||
install_tidy: | ||
description: 'install clang-tidy' | ||
required: false | ||
default: false | ||
type: boolean | ||
|
||
runs: | ||
using: 'composite' | ||
# use the development branch | ||
env: | ||
CLANG_VERSION: 19 | ||
steps: | ||
- name: Add scylla-ppa repo | ||
env: | ||
scylla_ppa_key: 6B2BFD3660EF3F5B | ||
# "add-apt-repository ppa:scylladb/ppa" does not work, as jammy is not built in this ppa repo, | ||
# so, let's use xenial instead. it is the latest version provided by ppa:scylladb/ppa | ||
run: | | ||
# see https://apt.llvm.org | ||
gpg_home=$(mktemp -d) | ||
gpg --homedir $gpg_home --no-default-keyring --keyring ppa.key --keyserver keyserver.ubuntu.com --recv-key $scylla_ppa_key | ||
sudo gpg --homedir $gpg_home --keyring ppa.key --export --output /etc/apt/trusted.gpg.d/ubuntu-scylladb-ppa.gpg $scylla_ppa_key | ||
echo "deb http://ppa.launchpadcontent.net/scylladb/ppa/ubuntu xenial main" | sudo tee -a /etc/apt/sources.list.d/scylla-ppa.list | ||
- name: Add clang apt repo | ||
if: ${{ inputs.install_clang_tool || inputs.install_clang_tidy }} | ||
run: | | ||
sudo apt-get install -y curl | ||
curl -fsSL https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc >/dev/null | ||
# use the development branch | ||
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy main" | sudo tee -a /etc/apt/sources.list.d/llvm.list | ||
sudo apt-get update | ||
- name: Install clang-tools | ||
if: ${{ inputs.install_clang_tools }} | ||
run: | | ||
sudo apt-get install -y clang-tools-$CLANG_VERSION | ||
- name: Install clang-tidy | ||
if: ${{ inputs.install_clang_tidy }} | ||
run: | | ||
sudo apt-get install -y clang-tidy-$CLANG_VERSION | ||
- name: Install more build dependencies | ||
run: | | ||
# - do not install java dependencies, which is not only not necessary, | ||
# and they include "python", which is not EOL and not available. | ||
# - replace "scylla-libthrift010" with "libthrift-dev". because | ||
# scylla-libthrift010 : Depends: libssl1.0.0 (>= 1.0.1) but it is not installable | ||
# - we don't perform tests, so minio is not necessary. | ||
sed -i.orig \ | ||
-e '/tools\/.*\/install-dependencies.sh/d' \ | ||
-e 's/scylla-libthrift010-dev/libthrift-dev/' \ | ||
-e 's/(minio_download_jobs)/(true)/' \ | ||
./install-dependencies.sh | ||
sudo ./install-dependencies.sh | ||
mv ./install-dependencies.sh{.orig,} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"problemMatcher": [ | ||
{ | ||
"owner": "clang-tidy-warning", | ||
"pattern": [ | ||
{ | ||
"regexp": "^([^:]+):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*?)\\s+\\[(.*?)\\]$", | ||
"file": 1, | ||
"line": 2, | ||
"column": 3, | ||
"severity": 4, | ||
"message": 5, | ||
"code": 6 | ||
}, | ||
{ | ||
"regexp": "^([^:]+):(\\d+):(\\d+):\\s+note:\\s+(.+)$", | ||
"file": 1, | ||
"line": 2, | ||
"column": 3, | ||
"message": 4, | ||
"loop": true | ||
}, | ||
] | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: clang-tidy | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
schedule: | ||
# only at 5AM Saturday | ||
- cron: '0 5 * * SAT' | ||
workflow_dispatch: | ||
inputs: | ||
build_type: | ||
description: 'CMake build type' | ||
required: false | ||
default: 'RelWithDebInfo' | ||
type: choice | ||
options: | ||
- Debug | ||
- RelWithDebInfo | ||
- Dev | ||
- Sanitize | ||
- Coverage | ||
clang_tidy_checks: | ||
description: 'clang-tidy --checks options' | ||
required: false | ||
default: 'bugprone-use-after-move' | ||
type: string | ||
env: | ||
CLANG_VERSION: 19 | ||
BUILD_DIR: build | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
clang-tidy: | ||
name: "Run clang-tidy" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- uses: ./.github/actions/setup-build | ||
- name: Generate building system | ||
run: | | ||
cmake \ | ||
-DCMAKE_BUILD_TYPE=${{ inputs.build_type }} \ | ||
-DCMAKE_C_COMPILER=clang \ | ||
-DCMAKE_CXX_COMPILER=clang++ \ | ||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | ||
-DCMAKE_CXX_CLANG_TIDY="clang-tidy-$CLANG_VERSION;--checks=${{ inputs.clang_tidy_checks }}" \ | ||
-G Ninja \ | ||
-B $BUILD_DIR \ | ||
-S . | ||
- name: clang-tidy | ||
run: | | ||
# see https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md | ||
echo "::add-matcher::.github/clang-tidy-matcher.json | ||
cmake --build $BUILD_DIR --target scylla |