-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add clang-tidy (changes only) and docs PR jobs (#583)
* Add clang-tidy (changes only) PR job
- Loading branch information
1 parent
6ca1e93
commit 7ce70e9
Showing
2 changed files
with
65 additions
and
4 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
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 |
---|---|---|
|
@@ -30,7 +30,7 @@ jobs: | |
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
uses: actions/checkout@v4.1.0 | ||
|
||
# installs tools, ninja, installs llvm and sets up sccahe | ||
- name: setup-ubuntu | ||
|
@@ -75,7 +75,7 @@ jobs: | |
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
uses: actions/checkout@v4.1.0 | ||
|
||
# installs tools, ninja, installs llvm and sets up sccahe | ||
- name: setup-ubuntu | ||
|
@@ -96,14 +96,75 @@ jobs: | |
run: | ||
ninja -C build check-ock-UnitCL | ||
|
||
# build and run clang-tidy | ||
run_clang_tidy_changes: | ||
|
||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/[email protected] | ||
|
||
# installs tools, ninja, installs llvm and sets up sccahe | ||
- name: setup-ubuntu | ||
uses: ./.github/actions/setup_build | ||
with: | ||
llvm_version: 19 | ||
llvm_build_type: RelAssert | ||
|
||
- name: build initial config files | ||
uses: ./.github/actions/do_build_ock | ||
with: | ||
build_type: ReleaseAssert | ||
host_image: ON | ||
build_targets: build.ninja | ||
|
||
# Here we compute the set difference between the output of the two | ||
# temporary file descriptors using `awk`. Awk processes both files line by | ||
# line, going through the first file, then the second file. The NR==FNR | ||
# predicate executes its block only on the records of the first file, | ||
# ensuring to call `next` (equivalent to `return`) to avoid running the | ||
# second block on each line in the first file. | ||
# | ||
# The first input to `awk` lists all targets reported by ninja. | ||
# | ||
# The second input to awk collects all targets on which `tidy-` targets | ||
# depend. This may include targets which are guarded by if() statements in | ||
# CMake, hence why we need to compute a set difference with the targets that | ||
# ninja reports. | ||
- name: build actual targets needed | ||
run: | ||
ninja -C build | ||
$( | ||
awk -F':' 'NR==FNR { targets[$1] = 1; next } $1 in targets { print $1 }' | ||
<(ninja -C build -t targets) | ||
<( | ||
find modules source -type f -name CMakeLists.txt -exec | ||
awk -F"[()]" '/add_dependencies\(tidy-/ {sub(/[^ ]*/, "", $2);print $2}' | ||
{} \+ | tr ' ' '\n' | ||
) | ||
) | ||
|
||
- name: run clang-tidy | ||
run: | | ||
git fetch origin ${{ github.base_ref }} | ||
./scripts/compute-dependants.py \ | ||
--exclude-filter='(/build/.*\.s$)|(.*/(external|cookie)/.*)' \ | ||
--build-dir="$PWD/build" \ | ||
`git diff --name-only --diff-filter=d \ | ||
HEAD..origin/${{ github.base_ref }} | \ | ||
grep -P '\.(c|cc|cxx|cpp|h|hh|hpp|hxx)$'` | \ | ||
tee /dev/stderr | \ | ||
parallel --verbose -- clang-tidy --quiet -p "$PWD/build/" "{}" | ||
# run clang-format-diff on the repo | ||
run_clang_format: | ||
|
||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
uses: actions/checkout@v4.1.0 | ||
|
||
- name: setup-ubuntu-clang-format | ||
run: | ||
|