Skip to content

Commit 3aa2c83

Browse files
authored
perf: seperate cppcheck of ci (#213)
Signed-off-by: msclock <msclock@qq.com>
1 parent bf3265c commit 3aa2c83

File tree

6 files changed

+100
-26
lines changed

6 files changed

+100
-26
lines changed

.github/workflows/ci.yml

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ jobs:
114114
cmake: true
115115
ninja: true
116116
ccache: true
117-
cppcheck: true
118117

119118
- name: Prepare for lcov
120119
if: contains(matrix.compiler, 'gcc')
@@ -195,7 +194,6 @@ jobs:
195194
cmake: true
196195
ninja: true
197196
ccache: true
198-
cppcheck: true
199197

200198
- name: Install llvm through brew
201199
if: contains(matrix.compiler, 'llvm')
@@ -415,7 +413,6 @@ jobs:
415413
cmake: true
416414
ninja: true
417415
ccache: true
418-
cppcheck: true
419416

420417
- name: Configure CMake
421418
run: >
@@ -465,7 +462,6 @@ jobs:
465462
cmake: true
466463
ninja: true
467464
ccache: true
468-
cppcheck: true
469465

470466
- name: Install valgrind
471467
run: sudo apt-get install valgrind
@@ -489,6 +485,51 @@ jobs:
489485
run: cmake --build --preset=default --target ExperimentalMemCheck
490486

491487

488+
cppcheck:
489+
runs-on: macos-12
490+
needs: [pre-commit, consistency]
491+
timeout-minutes: 15
492+
493+
steps:
494+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
495+
with:
496+
fetch-depth: 0
497+
498+
- name: Cache
499+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
500+
with:
501+
path: |
502+
~/vcpkg
503+
~/.cache/vcpkg
504+
key: x64-osx-gcc-13-${{ hashFiles('vcpkg.json') }}
505+
restore-keys: x64-osx-gcc-13-${{ hashFiles('vcpkg.json') }}
506+
507+
- uses: aminya/setup-cpp@v1
508+
with:
509+
compiler: gcc-13
510+
cmake: true
511+
ninja: true
512+
ccache: true
513+
cppcheck: true # use cppcheck of macos, it's newest version
514+
515+
- name: Configure CMake
516+
run: >
517+
cmake -S . --preset=default
518+
-DCMAKE_BUILD_TYPE=Debug
519+
-DCMAKE_CXX_STANDARD=20
520+
-DCMAKE_C_COMPILER="${CC}"
521+
-DCMAKE_CXX_COMPILER="${CXX}"
522+
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON
523+
-DVCPKG_TARGET_TRIPLET=x64-osx
524+
-DUSE_CPPCHECK_WARNINGS_AS_ERRORS=ON
525+
-DUSE_SANITIZER=OFF
526+
-DCODE_COVERAGE=OFF
527+
-DBUILD_TESTING=ON
528+
529+
- name: Build
530+
run: cmake --build --preset=default --target all
531+
532+
492533
check-docs:
493534
name: Docs build and checks
494535
runs-on: ubuntu-22.04
@@ -570,7 +611,6 @@ jobs:
570611
cmake: true
571612
ninja: true
572613
ccache: true
573-
cppcheck: true
574614

575615
- name: Prepare for lcov
576616
run: |
@@ -629,7 +669,6 @@ jobs:
629669
cmake: true
630670
ninja: true
631671
ccache: true
632-
cppcheck: true
633672

634673
- name: Configure CMake
635674
run: >
@@ -681,7 +720,6 @@ jobs:
681720
cmake: true
682721
ninja: true
683722
ccache: true
684-
cppcheck: true
685723

686724
- name: Disable preinstalled vcpkg in the runner to test vcpkg automatic installation
687725
run: echo "VCPKG_INSTALLATION_ROOT=" >> $GITHUB_ENV
@@ -735,7 +773,6 @@ jobs:
735773
cmake: true
736774
ninja: true
737775
ccache: true
738-
cppcheck: true
739776

740777
- name: Configure CMake
741778
run: >
@@ -785,7 +822,6 @@ jobs:
785822
cmake: true
786823
ninja: true
787824
ccache: true
788-
cppcheck: true
789825

790826
- name: Configure CMake
791827
run: >
@@ -819,6 +855,7 @@ jobs:
819855
- check-docs
820856
- check-sanitizers
821857
- check-valgrind
858+
- cppcheck
822859
- codecov
823860
- check-export-mode
824861
- check-auto-vcpkg-install

src/exe/include/distribution.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#pragma once
22

3-
#include <spdlog/spdlog.h>
4-
53
namespace exe {
64
namespace distribution {
75
inline bool is_debug() noexcept {

template/[% if repo_host_type == 'github.com' %].github[% endif %]/workflows/ci.yml.jinja

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ jobs:
118118
cmake: true
119119
ninja: true
120120
ccache: true
121-
cppcheck: true
122121

123122
- name: Prepare for lcov
124123
if: contains(matrix.compiler, 'gcc')
@@ -203,7 +202,6 @@ jobs:
203202
cmake: true
204203
ninja: true
205204
ccache: true
206-
cppcheck: true
207205

208206
- name: Install llvm through brew
209207
if: contains(matrix.compiler, 'llvm')
@@ -435,7 +433,6 @@ jobs:
435433
cmake: true
436434
ninja: true
437435
ccache: true
438-
cppcheck: true
439436

440437
- name: Configure CMake
441438
run: >
@@ -489,7 +486,6 @@ jobs:
489486
cmake: true
490487
ninja: true
491488
ccache: true
492-
cppcheck: true
493489

494490
- name: Install valgrind
495491
run: sudo apt-get install valgrind
@@ -513,6 +509,55 @@ jobs:
513509
run: cmake --build --preset=default --target ExperimentalMemCheck
514510

515511

512+
cppcheck:
513+
runs-on: macos-12
514+
needs: [pre-commit
515+
[%- if repo_name == 'ss-cpp' -%]
516+
, consistency
517+
[%- endif -%]
518+
]
519+
timeout-minutes: 15
520+
521+
steps:
522+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
523+
with:
524+
fetch-depth: 0
525+
526+
- name: Cache
527+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
528+
with:
529+
path: |
530+
~/vcpkg
531+
~/.cache/vcpkg
532+
key: x64-osx-gcc-13-{{ '${{ hashFiles(\'vcpkg.json\') }}' }}
533+
restore-keys: x64-osx-gcc-13-{{ '${{ hashFiles(\'vcpkg.json\') }}' }}
534+
535+
- uses: aminya/setup-cpp@v1
536+
with:
537+
compiler: gcc-13
538+
cmake: true
539+
ninja: true
540+
ccache: true
541+
cppcheck: true # use cppcheck of macos, it's newest version
542+
543+
- name: Configure CMake
544+
run: >
545+
cmake -S . --preset=default
546+
-DCMAKE_BUILD_TYPE=Debug
547+
-DCMAKE_CXX_STANDARD=20
548+
-DCMAKE_C_COMPILER="${CC}"
549+
-DCMAKE_CXX_COMPILER="${CXX}"
550+
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON
551+
-DVCPKG_TARGET_TRIPLET=x64-osx
552+
-DUSE_CPPCHECK_WARNINGS_AS_ERRORS=ON
553+
-DUSE_SANITIZER=OFF
554+
-DCODE_COVERAGE=OFF
555+
-DBUILD_TESTING=ON
556+
557+
- name: Build
558+
run: cmake --build --preset=default --target all
559+
560+
516561
check-docs:
517562
name: Docs build and checks
518563
runs-on: ubuntu-22.04
@@ -602,7 +647,6 @@ jobs:
602647
cmake: true
603648
ninja: true
604649
ccache: true
605-
cppcheck: true
606650

607651
- name: Prepare for lcov
608652
run: |
@@ -661,7 +705,6 @@ jobs:
661705
cmake: true
662706
ninja: true
663707
ccache: true
664-
cppcheck: true
665708

666709
- name: Configure CMake
667710
run: >
@@ -713,7 +756,6 @@ jobs:
713756
cmake: true
714757
ninja: true
715758
ccache: true
716-
cppcheck: true
717759

718760
- name: Disable preinstalled vcpkg in the runner to test vcpkg automatic installation
719761
run: echo "VCPKG_INSTALLATION_ROOT=" >> $GITHUB_ENV
@@ -767,7 +809,6 @@ jobs:
767809
cmake: true
768810
ninja: true
769811
ccache: true
770-
cppcheck: true
771812

772813
- name: Configure CMake
773814
run: >
@@ -817,7 +858,6 @@ jobs:
817858
cmake: true
818859
ninja: true
819860
ccache: true
820-
cppcheck: true
821861

822862
- name: Configure CMake
823863
run: >
@@ -851,6 +891,7 @@ jobs:
851891
- check-docs
852892
- check-sanitizers
853893
- check-valgrind
894+
- cppcheck
854895
[%- if use_codecov == true %]
855896
- codecov
856897
[%- endif %]

template/src/[% if exe_target != '' %]{{ exe_target }}[% endif %]/include/distribution.hpp.jinja

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#pragma once
22

3-
#include <spdlog/spdlog.h>
4-
53
namespace {{ exe_target }} {
64
namespace distribution {
75
inline bool is_debug() noexcept {

template/vcpkg.json.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
[%- endif %]
4040
{
4141
"name": "cmake-modules",
42-
"version": "1.4.32"
42+
"version": "1.4.35"
4343
},
4444
{
4545
"name": "robotology-cmake-ycm",
@@ -61,7 +61,7 @@
6161
"registries": [
6262
{
6363
"kind": "git",
64-
"baseline": "0343f5b696db112fc93e3f2c306d726fd548f4f6",
64+
"baseline": "f09077e2e4df1b730cb2c0768298f4eaaf10afa9",
6565
"repository": "https://github.com/msclock/cmake-registry",
6666
"packages": [
6767
[%- if use_conan == true %]

vcpkg.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
{
1818
"name": "cmake-modules",
19-
"version": "1.4.32"
19+
"version": "1.4.35"
2020
},
2121
{
2222
"name": "robotology-cmake-ycm",
@@ -38,7 +38,7 @@
3838
"registries": [
3939
{
4040
"kind": "git",
41-
"baseline": "0343f5b696db112fc93e3f2c306d726fd548f4f6",
41+
"baseline": "f09077e2e4df1b730cb2c0768298f4eaaf10afa9",
4242
"repository": "https://github.com/msclock/cmake-registry",
4343
"packages": [
4444
"cmake-modules",

0 commit comments

Comments
 (0)