This repository has been archived by the owner on Jul 29, 2022. It is now read-only.
forked from eclipse-ecal/ecal
-
Notifications
You must be signed in to change notification settings - Fork 3
72 lines (61 loc) · 2.47 KB
/
run-clang-tidy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Run clang-tidy
on:
workflow_call:
jobs:
clang-tidy-scan:
runs-on: ubuntu-20.04
continue-on-error: true
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install ninja-build doxygen graphviz libcurl4-openssl-dev libprotobuf-dev libprotoc-dev protobuf-compiler libhdf5-dev qt5-default
sudo apt-get install clang-tidy
- name: Display version info
run: |
echo $(g++ --version)
echo $(clang --version)
echo $(cmake --version)
echo $(clang-tidy --version)
# https://github.com/actions/download-artifact
- name: Download the built directory
uses: actions/download-artifact@v3
with:
name: ecal-dir
# replace the working directory
- name: Extract the tarball archive
run: mv ecal.tar.gz ../. && cd .. && rm -rf ecal && tar -xzf ecal.tar.gz && cd ecal
# https://github.com/Ana06/get-changed-files
- name: Detect the changeset
id: changed_files
uses: Ana06/get-changed-files@v2.1.0
# see: ./build.sh --help
- name: Run clang-tidy on the changeset
id: suffix
run: |
build_linux/clang-tidy/build.sh -a -b ../../../_build -f ${{ steps.changed_files.outputs.added_modified }}
# https://github.com/actions/upload-artifact
# If make or clang-tidy is never called, artifact upload will fail (no log files) with just a warning.
- name: Archive logs as artifact
uses: actions/upload-artifact@v3
with:
name: clang_tidy_log_${{ steps.suffix.outputs.timestamp }}
path: ~/work/ecal/_build/clang_tidy_log_*.txt
if-no-files-found: warn
- name: Detect number of clang-tidy warnings
id: num_warnings
run: |
NUM_WARNINGS=0
NUM_LOG_FILES=$(ls ~/work/ecal/_build/clang_tidy_log_*.txt 2> /dev/null | wc -l)
if [[ ${NUM_LOG_FILES} -gt 0 ]]
then
NUM_WARNINGS=$(grep -oE "\w+\.\w+:\w+:\w+:\s?warning:\s?.*" -- ~/work/ecal/_build/clang_tidy_log_*.txt | wc -l)
fi
echo "::set-output name=value::${NUM_WARNINGS}"
# https://github.com/actions/github-script
- name: Check clang-tidy warnings
if: ${{ steps.num_warnings.outputs.value > 0 }}
uses: actions/github-script@v6
with:
script: |
core.setFailed('number of clang-tidy warnings: ${{ steps.num_warnings.outputs.value}}')