Skip to content

Commit e886b9f

Browse files
authored
PR review suggestions (#33)
* exclude main.rs from coverage report to codecov * change dependabot checks to weekly * add test-clean recipe * add codecov config * post review comments * revamp test CI * add strictness to tests Exclude clang v7 and v8 on windows for PR review tests. Those versions do not have a consistent cross-platform output from clang-tidy.
1 parent 1d3522a commit e886b9f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2706
-826242
lines changed

.github/dependabot.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ updates:
1616
- package-ecosystem: pip
1717
directory: cpp-linter-py/
1818
schedule:
19-
interval: "daily"
19+
interval: "weekly"
2020
groups:
2121
pip:
2222
patterns:
2323
- "*"
2424
- package-ecosystem: cargo
2525
directory: /
2626
schedule:
27-
interval: "daily"
27+
interval: "weekly"
2828
ignore:
2929
- dependency-name: cpp-linter-lib
3030
groups:

.github/workflows/run-dev-tests.yml

+132-60
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,11 @@ env:
2222
RUST_BACKTRACE: 1
2323

2424
jobs:
25-
cache-deps:
26-
runs-on: ${{ matrix.os }}
27-
strategy:
28-
fail-fast: false
29-
matrix:
30-
os: [windows-latest, ubuntu-latest]
31-
steps:
32-
- run: rustup update --no-self-update
33-
- uses: actions/checkout@v4
34-
- name: Cache .cargo locked resources
35-
uses: actions/cache@v4
36-
with:
37-
path: ~/.cargo
38-
key: ${{ runner.os }}-test-cargo-${{ hashFiles('Cargo.lock') }}
39-
- run: cargo fetch
40-
4125
test:
42-
needs: [cache-deps]
43-
name: test ${{ matrix.os }} w/ clang v${{ matrix.version }}
4426
strategy:
4527
fail-fast: false
4628
matrix:
4729
os: ['windows-latest', ubuntu-latest]
48-
version: ['17', '16', '15', '14', '13', '12', '11', '10', '9', '8', '7']
4930

5031
runs-on: ${{ matrix.os }}
5132
steps:
@@ -87,61 +68,152 @@ jobs:
8768
if: runner.os == 'Windows'
8869
run: choco install ninja
8970

90-
- name: Install Linux clang dependencies
91-
if: runner.os == 'Linux'
92-
shell: bash
93-
run: |
94-
sudo apt-get update
95-
# First try installing from default Ubuntu repositories before trying LLVM script
96-
if ! sudo apt-get install -y clang-format-${{ matrix.version }} clang-tidy-${{ matrix.version }}; then
97-
# This LLVM script will add the relevant LLVM PPA: https://apt.llvm.org/
98-
wget https://apt.llvm.org/llvm.sh -O ${{ runner.temp }}/llvm_install.sh
99-
chmod +x ${{ runner.temp }}/llvm_install.sh
100-
if sudo ${{ runner.temp }}/llvm_install.sh ${{ matrix.version }}; then
101-
sudo apt-get install -y clang-format-${{ matrix.version }} clang-tidy-${{ matrix.version }}
102-
fi
103-
fi
104-
105-
- name: Install clang-tools
106-
run: |
107-
python -m pip install clang-tools
108-
clang-tools --install ${{ matrix.version }}
109-
110-
- name: Cache .cargo locked resources
111-
uses: actions/cache/restore@v4
112-
with:
113-
path: ~/.cargo
114-
key: ${{ runner.os }}-test-cargo-${{ hashFiles('Cargo.lock') }}
115-
116-
- name: Collect Coverage
117-
working-directory: cpp-linter-lib
71+
- name: Fetch .cargo locked resources
72+
run: cargo fetch
73+
74+
- if: runner.os == 'Linux'
75+
run: sudo apt-get update
76+
77+
- name: Install clang v7
78+
if: matrix.os == 'Linux'
79+
uses: cpp-linter/cpp_linter_rs/install-clang-action@pr-reviews
80+
with:
81+
version: '7'
82+
83+
- name: Collect Coverage for clang v7
84+
if: matrix.os == 'Linux'
11885
env:
119-
CLANG_VERSION: ${{ matrix.version }}
86+
CLANG_VERSION: '7'
12087
run: just test
12188

122-
- name: Generate Coverage HTML report
123-
working-directory: cpp-linter-lib
89+
- name: Install clang v8
90+
if: matrix.os == 'Linux'
91+
uses: cpp-linter/cpp_linter_rs/install-clang-action@pr-reviews
92+
with:
93+
version: '8'
94+
95+
- name: Collect Coverage for clang v8
96+
if: matrix.os == 'Linux'
97+
env:
98+
CLANG_VERSION: '8'
99+
run: just test
100+
101+
- name: Install clang v9
102+
uses: cpp-linter/cpp_linter_rs/install-clang-action@pr-reviews
103+
with:
104+
version: '9'
105+
106+
- name: Collect Coverage for clang v9
107+
env:
108+
CLANG_VERSION: '9'
109+
run: just test
110+
111+
- name: Install clang v10
112+
uses: cpp-linter/cpp_linter_rs/install-clang-action@pr-reviews
113+
with:
114+
version: '10'
115+
116+
- name: Collect Coverage for clang v10
117+
env:
118+
CLANG_VERSION: '10'
119+
run: just test
120+
121+
- name: Install clang 11
122+
uses: cpp-linter/cpp_linter_rs/install-clang-action@pr-reviews
123+
with:
124+
version: '11'
125+
126+
- name: Collect Coverage for clang v11
127+
env:
128+
CLANG_VERSION: '11'
129+
run: just test
130+
131+
- name: Install clang 12
132+
uses: cpp-linter/cpp_linter_rs/install-clang-action@pr-reviews
133+
with:
134+
version: '12'
135+
136+
- name: Collect Coverage for clang v12
124137
env:
125-
CLANG_VERSION: ${{ matrix.version }}
138+
CLANG_VERSION: '12'
139+
run: just test
140+
141+
- name: Install clang 13
142+
uses: cpp-linter/cpp_linter_rs/install-clang-action@pr-reviews
143+
with:
144+
version: '13'
145+
146+
- name: Collect Coverage for clang v13
147+
env:
148+
CLANG_VERSION: '13'
149+
run: just test
150+
151+
- name: Install clang 14
152+
uses: cpp-linter/cpp_linter_rs/install-clang-action@pr-reviews
153+
with:
154+
version: '14'
155+
156+
- name: Collect Coverage for clang v14
157+
env:
158+
CLANG_VERSION: '14'
159+
run: just test
160+
161+
- name: Install clang 15
162+
uses: cpp-linter/cpp_linter_rs/install-clang-action@pr-reviews
163+
with:
164+
version: '15'
165+
166+
- name: Collect Coverage for clang v15
167+
env:
168+
CLANG_VERSION: '15'
169+
run: just test
170+
171+
- name: Install clang 16
172+
uses: cpp-linter/cpp_linter_rs/install-clang-action@pr-reviews
173+
with:
174+
version: '16'
175+
176+
- name: Collect Coverage for clang v16
177+
env:
178+
CLANG_VERSION: '16'
179+
run: just test
180+
181+
- name: Install clang 17
182+
uses: cpp-linter/cpp_linter_rs/install-clang-action@pr-reviews
183+
with:
184+
version: '17'
185+
186+
- name: Collect Coverage for clang v17
187+
env:
188+
CLANG_VERSION: '17'
189+
run: just test
190+
191+
- name: Install clang 18
192+
uses: cpp-linter/cpp_linter_rs/install-clang-action@pr-reviews
193+
with:
194+
version: '18'
195+
196+
- name: Collect Coverage for clang v18
197+
env:
198+
CLANG_VERSION: '18'
199+
run: just test --run-ignored=all
200+
201+
- name: Generate Coverage HTML report
126202
run: just pretty-cov
127203

128204
- name: Upload coverage data
129205
uses: actions/upload-artifact@v4
130206
with:
131-
name: HTML_report-${{ runner.os }}-clang_v${{ matrix.version }}
207+
name: HTML_report-${{ runner.os }}
132208
path: target/llvm-cov-pretty
133209

134210
- name: Generate Coverage lcov report
135-
if: matrix.version == '16' && runner.os == 'Linux'
136-
working-directory: cpp-linter-lib
137-
env:
138-
CLANG_VERSION: ${{ matrix.version }}
139-
run: |
140-
cargo llvm-cov report --lcov --output-path lcov.info
211+
if: runner.os == 'Linux'
212+
run: just lcov
141213

142214
- uses: codecov/codecov-action@v4
143-
if: matrix.version == '16' && runner.os == 'Linux'
215+
if: runner.os == 'Linux'
144216
with:
145217
token: ${{secrets.CODECOV_TOKEN}}
146-
files: cpp-linter-lib/lcov.info
218+
files: lcov.info
147219
fail_ci_if_error: true # optional (default = false)

codecov.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
coverage:
2+
status:
3+
patch:
4+
default:
5+
informational: true
6+
project:
7+
default:
8+
target: auto
9+
# adjust accordingly based on how flaky your tests are
10+
# this allows a 2% drop from the previous base commit coverage
11+
threshold: 2%

cpp-linter-lib/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ log = "0.4.22"
1818
openssl = { version = "0.10", features = ["vendored"], optional = true }
1919
openssl-probe = { version = "0.1", optional = true }
2020
regex = "1.10.6"
21-
reqwest = { version = "0.12.7", features = ["json"]}
21+
reqwest = "0.12.7"
2222
semver = "1.0.23"
2323
serde = { version = "1.0.209", features = ["derive"] }
2424
serde-xml-rs = "0.6.0"

0 commit comments

Comments
 (0)