Skip to content

Commit aacfd2a

Browse files
authored
Merge pull request #267 from eseiler/infra/codechecker_codeql
[INFRA] Add CodeChecker and CodeQL
2 parents 48edfcb + e5f795b commit aacfd2a

File tree

10 files changed

+163
-15
lines changed

10 files changed

+163
-15
lines changed

.github/config/codechecker.skip

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# SPDX-FileCopyrightText: 2006-2025, Knut Reinert & Freie Universität Berlin
2+
# SPDX-FileCopyrightText: 2016-2025, Knut Reinert & MPI für molekulare Genetik
3+
# SPDX-License-Identifier: CC0-1.0
4+
5+
+${GITHUB_WORKSPACE}/*
6+
-*

.github/config/codechecker.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# SPDX-FileCopyrightText: 2006-2025, Knut Reinert & Freie Universität Berlin
2+
# SPDX-FileCopyrightText: 2016-2025, Knut Reinert & MPI für molekulare Genetik
3+
# SPDX-License-Identifier: CC0-1.0
4+
5+
analyze:
6+
- --enable=performance
7+
- --enable=bugprone
8+
- --enable=clang-diagnostic-shadow
9+
- --disable=bugprone-easily-swappable-parameters
10+
- --disable=clang-diagnostic-implicit-int-float-conversion
11+
- --disable=clang-diagnostic-float-conversion
12+
- --disable=clang-diagnostic-implicit-int-conversion
13+
- --disable=bugprone-exception-escape
14+
- --disable=bugprone-narrowing-conversions
15+
- --disable=deadcode.DeadStores
16+
- --skip=${GITHUB_WORKSPACE}/.github/config/codechecker.skip
17+
- --clean
18+
19+
parse:
20+
- --export=html
21+
- --output=./html
22+
- --skip=${GITHUB_WORKSPACE}/.github/config/codechecker.skip
23+
- --trim-path-prefix=${GITHUB_WORKSPACE}/

.github/workflows/ci_license.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ defaults:
2727
jobs:
2828
check:
2929
name: REUSE Compliance
30-
runs-on: ubuntu-22.04
30+
runs-on: ubuntu-latest
3131
timeout-minutes: 120
3232
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch' || github.event.label.name == 'lint'
3333
steps:
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# SPDX-FileCopyrightText: 2006-2025, Knut Reinert & Freie Universität Berlin
2+
# SPDX-FileCopyrightText: 2016-2025, Knut Reinert & MPI für molekulare Genetik
3+
# SPDX-License-Identifier: CC0-1.0
4+
5+
name: CodeChecker
6+
7+
on:
8+
schedule:
9+
- cron: "0 8 * * MON"
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: codechecker-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
env:
17+
SHARG_NO_VERSION_CHECK: 1
18+
TZ: Europe/Berlin
19+
20+
defaults:
21+
run:
22+
shell: bash -Eexuo pipefail {0}
23+
24+
jobs:
25+
build:
26+
name: CodeChecker
27+
runs-on: ubuntu-latest
28+
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch'
29+
container:
30+
image: ghcr.io/seqan/clang-19
31+
steps:
32+
- name: Run CodeChecker
33+
uses: seqan/actions/codechecker@main
34+
with:
35+
configure_path: ../test/analyse
36+
deploy_host: ${{ secrets.DEPLOY_HOST }}
37+
deploy_user: ${{ secrets.DEPLOY_USER }}
38+
deploy_ssh_key: ${{ secrets.DEPLOY_SSH_KEY }}
39+
deploy_path: ${{ secrets.DEPLOY_CODECHECKER_PATH }}

.github/workflows/cron_codeql.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
2+
# SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
3+
# SPDX-License-Identifier: CC0-1.0
4+
5+
name: CodeQL
6+
7+
on:
8+
schedule:
9+
- cron: "0 21 * * MON"
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: codeql-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
env:
17+
SHARG_NO_VERSION_CHECK: 1
18+
TZ: Europe/Berlin
19+
20+
defaults:
21+
run:
22+
shell: bash -Eeuxo pipefail {0}
23+
24+
jobs:
25+
codeql:
26+
name: CodeQL
27+
runs-on: ubuntu-latest
28+
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch'
29+
permissions:
30+
security-events: write
31+
container:
32+
image: ghcr.io/seqan/gcc-14
33+
volumes:
34+
- /home/runner:/home/runner
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
39+
- name: Initialize CodeQL
40+
uses: github/codeql-action/init@v3
41+
with:
42+
languages: cpp
43+
build-mode: manual
44+
trap-caching: false
45+
46+
- name: Build tests
47+
run: |
48+
cmake test/analyse -DCMAKE_BUILD_TYPE=Release \
49+
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
50+
make -k
51+
52+
- name: Perform CodeQL Analysis
53+
uses: github/codeql-action/analyze@v3
54+
with:
55+
category: "/language:cpp"

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
group: lint-${{ github.event.pull_request.number }}
3636
cancel-in-progress: true
3737
needs: cancel_running_workflows
38-
runs-on: ubuntu-22.04
38+
runs-on: ubuntu-latest
3939
timeout-minutes: 15
4040
steps:
4141
- name: Run lint

.github/workflows/readme_snippet.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
push:
99
branches:
1010
- 'main'
11+
workflow_dispatch:
12+
13+
concurrency:
14+
group: readme-snippet-${{ github.ref }}
15+
cancel-in-progress: true
1116

1217
env:
1318
TZ: Europe/Berlin
@@ -19,11 +24,9 @@ defaults:
1924
jobs:
2025
readme-snippet:
2126
name: Update README
22-
concurrency:
23-
group: readme-snippet-${{ github.ref }}
24-
cancel-in-progress: false
25-
runs-on: ubuntu-22.04
27+
runs-on: ubuntu-latest
2628
timeout-minutes: 15
29+
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch'
2730
steps:
2831
- name: Checkout Sharg
2932
uses: actions/checkout@v4

.github/workflows/update_cookbook.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@
22
# SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
33
# SPDX-License-Identifier: CC0-1.0
44

5-
name: Sharg lint
5+
name: Sharg Cookbook
66

77
on:
88
push:
99
branches:
1010
- 'main'
11+
workflow_dispatch:
12+
13+
concurrency:
14+
group: update-cookbook-${{ github.ref }}
15+
cancel-in-progress: true
1116

1217
env:
1318
TZ: Europe/Berlin
@@ -19,11 +24,9 @@ defaults:
1924
jobs:
2025
update-cookbook:
2126
name: Update Cookbook
22-
concurrency:
23-
group: update-cookbook-${{ github.ref }}
24-
cancel-in-progress: true
25-
runs-on: ubuntu-22.04
27+
runs-on: ubuntu-latest
2628
timeout-minutes: 15
29+
if: github.repository_owner == 'seqan' || github.event_name == 'workflow_dispatch'
2730
steps:
2831
- name: Checkout Sharg
2932
uses: actions/checkout@v4

test/analyse/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
2+
# SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
3+
# SPDX-License-Identifier: BSD-3-Clause
4+
5+
cmake_minimum_required (VERSION 3.20...3.31)
6+
project (sharg_test_analyze CXX)
7+
8+
include (../sharg-test.cmake)
9+
10+
enable_testing ()
11+
12+
add_subdirectory (../snippet snippet)
13+
add_subdirectory (../unit unit)

test/sharg-test.cmake

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,21 @@ if (NOT DEFINED CMAKE_CXX_EXTENSIONS)
2020
set (CMAKE_CXX_EXTENSIONS OFF)
2121
endif ()
2222

23+
set (SHARG_TEST_CPM_DIR
24+
"${CMAKE_CURRENT_LIST_DIR}/../cmake/"
25+
CACHE STRING "Path to directory containing CPM.cmake.")
26+
27+
set (CPM_INDENT "CMake Package Manager CPM: ")
28+
include ("${SHARG_TEST_CPM_DIR}/CPM.cmake")
29+
CPMUsePackageLock ("${SHARG_TEST_CPM_DIR}/package-lock.cmake")
30+
31+
include (${CMAKE_CURRENT_LIST_DIR}/cmake/sharg_require_ccache.cmake)
32+
2333
# require Sharg package
2434
find_package (Sharg REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../cmake)
2535

2636
enable_testing ()
2737

28-
set (CPM_INDENT "CMake Package Manager CPM: ")
29-
CPMUsePackageLock ("${CMAKE_CURRENT_LIST_DIR}/../cmake/package-lock.cmake")
30-
3138
include (CheckCXXSourceCompiles)
3239
include (FindPackageHandleStandardArgs)
3340
include (FindPackageMessage)
@@ -115,5 +122,4 @@ list (APPEND SHARG_EXTERNAL_PROJECT_CMAKE_ARGS "-DCMAKE_VERBOSE_MAKEFILE=${CMAKE
115122

116123
include (sharg_test_component)
117124
include (sharg_test_files)
118-
include (sharg_require_ccache)
119125
include (add_subdirectories)

0 commit comments

Comments
 (0)