-
Notifications
You must be signed in to change notification settings - Fork 7
130 lines (122 loc) · 4.37 KB
/
codecheck.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Code Quality Checks
concurrency:
group: pr-code_quality_${{ github.event.pull_request.number }}
cancel-in-progress: true
on:
pull_request:
permissions:
contents: read
pull-requests: write
actions: read
jobs:
scan-build:
if: needs.check-for-pr.outputs.skip != 'true'
runs-on: ubuntu-latest
env:
HEAD_REF: ${{ github.head_ref }}
steps:
- uses: actions/checkout@v3
- name: System setup
run: |
sudo apt-get update
sudo apt install -y clang clang-tools openjdk-11-jdk
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install beautifulsoup4
- name: Scan Build
run: |
./gradlew scanBuild --no-daemon
- name: Upload logs
uses: actions/upload-artifact@v3
if: always()
with:
name: scan-build-reports
path: |
ddprof-lib/build/reports/scan-build
- name: Read Report
id: read-report
run: |
find ddprof-lib/build/reports/scan-build -name 'index.html' | xargs -I {} python .github/scripts/python_utils.py scanbuild_cleanup {} ${HEAD_REF} > comment.html
- name: Post or update PR comment
uses: ./.github/actions/pr_comment
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-id: "scan-build"
commenter: "pr-comment-scanbuild"
comment-file: 'comment.html'
cppcheck:
if: needs.check-for-pr.outputs.skip != 'true'
runs-on: ubuntu-latest
env:
HEAD_REF: ${{ github.head_ref }}
steps:
- uses: actions/checkout@v3
- name: System setup
run: |
sudo apt-get update
sudo apt install -y cppcheck xsltproc
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install beautifulsoup4
- name: Run Cppcheck
id: run-cppcheck
run: |
cppcheck --quiet --force --enable=all --std=c++11 --language=c++ --inline-suppr --suppressions-list=.github/scripts/cppcheck-suppressions.txt --xml --output-file=report.xml ddprof-lib/src/main/cpp/*
xsltproc --output report.html .github/scripts/cppcheck-html.xslt report.xml
xsltproc --output report-gh.html .github/scripts/cppcheck-gh.xslt report.xml
sed -i "s#target_branch#${HEAD_REF}#g" report.html
sed -i "s#target_branch#${HEAD_REF}#g" report-gh.html
python .github/scripts/python_utils.py cppcheck_cleanup report-gh.html >> comment.html
- name: Upload logs
uses: actions/upload-artifact@v3
if: always()
with:
name: cppcheck-report
path: |
report.html
report.xml
- name: Post or update PR comment
uses: ./.github/actions/pr_comment
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
comment-id: "cppcheck"
commenter: "pr-comment-cppcheck"
comment-file: 'comment.html'
codeql:
if: needs.check-for-pr.outputs.skip != 'true'
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp', 'java' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
- run: ./gradlew -x test assembleReleaseJar
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2