Skip to content

Commit 8212731

Browse files
committed
Meta: add codeql analisys
1 parent d2e268c commit 8212731

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: CodeQL + Test Coverage
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build-test-codeql:
11+
runs-on: ubuntu-24.04
12+
13+
permissions:
14+
security-events: write
15+
contents: read
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Install CMake
22+
uses: lukka/get-cmake@latest
23+
with:
24+
cmakeVersion: "~3.31.0"
25+
26+
- name: Install Qt 6.9.2
27+
uses: jurplel/[email protected]
28+
with:
29+
version: 6.9.2
30+
cache: true
31+
32+
- name: Install dependencies
33+
run: |
34+
sudo apt update
35+
sudo apt install -y ninja-build lcov
36+
37+
- name: Initialize CodeQL
38+
uses: github/codeql-action/init@v3
39+
with:
40+
languages: cpp
41+
42+
- name: Configure project
43+
run: |
44+
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
45+
46+
- name: Build project
47+
run: |
48+
cmake --build build
49+
50+
- name: Run tests
51+
run: |
52+
cd build
53+
ctest --output-on-failure || true
54+
55+
- name: Collect coverage
56+
run: |
57+
lcov --directory build --capture --output-file coverage.info
58+
lcov --remove coverage.info '/usr/*' --output-file coverage.info
59+
lcov --list coverage.info
60+
61+
- name: Upload coverage artifact
62+
uses: actions/upload-artifact@v3
63+
with:
64+
name: coverage-report
65+
path: coverage.info
66+
67+
- name: Report coverage in PR
68+
uses: zyborg/code-coverage-report-action@v3
69+
with:
70+
coverage-files: coverage.info
71+
artifact-name: coverage-report
72+
minimum-coverage: 50
73+
publish-summary: true
74+
publish-comment: true
75+
fail-build: false
76+
77+
- name: Run CodeQL Analysis
78+
uses: github/codeql-action/analyze@v3
79+

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
![Code spell](https://github.com/diegoiast/qtedit4/actions/workflows/codespell.yml/badge.svg)
88
![Activity](https://img.shields.io/github/commit-activity/m/diegoiast/qtedit4)
99
![Open Issues](https://img.shields.io/github/issues-raw/diegoiast/qtedit4)
10+
![CodeQL + Coverage](https://github.com/diegoiast/qtedit4/actions/workflows/codeql-coverage.yml/badge.svg)
1011

1112
<!-- Community
1213
![Contributors](https://img.shields.io/github/contributors/diegoiast/qtedit4)

0 commit comments

Comments
 (0)