Skip to content

Commit bd049d0

Browse files
committed
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 bd049d0

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

+2713
-826239
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

+133-56
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,157 @@ 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-
11071
- name: Cache .cargo locked resources
111-
uses: actions/cache/restore@v4
72+
uses: actions/cache@v4
11273
with:
11374
path: ~/.cargo
114-
key: ${{ runner.os }}-test-cargo-${{ hashFiles('Cargo.lock') }}
75+
key: ${{ runner.os }}-tests-cargo-${{ hashFiles('Cargo.lock') }}
76+
- name: Fetch .cargo locked resources
77+
run: cargo fetch
78+
79+
- if: runner.os == 'Linux'
80+
run: sudo apt-get update
11581

116-
- name: Collect Coverage
117-
working-directory: cpp-linter-lib
82+
- name: Install clang v7
83+
if: matrix.os == 'Linux'
84+
uses: cpp-linter/cpp_linter_rs/install-clang-action@main
85+
with:
86+
version: '7'
87+
88+
- name: Collect Coverage for clang v7
89+
if: matrix.os == 'Linux'
11890
env:
119-
CLANG_VERSION: ${{ matrix.version }}
91+
CLANG_VERSION: '7'
12092
run: just test
12193

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

128209
- name: Upload coverage data
129210
uses: actions/upload-artifact@v4
130211
with:
131-
name: HTML_report-${{ runner.os }}-clang_v${{ matrix.version }}
212+
name: HTML_report-${{ runner.os }}
132213
path: target/llvm-cov-pretty
133214

134215
- 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
216+
if: runner.os == 'Linux'
217+
run: just lcov
141218

142219
- uses: codecov/codecov-action@v4
143-
if: matrix.version == '16' && runner.os == 'Linux'
220+
if: runner.os == 'Linux'
144221
with:
145222
token: ${{secrets.CODECOV_TOKEN}}
146-
files: cpp-linter-lib/lcov.info
223+
files: lcov.info
147224
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)