Skip to content

Commit

Permalink
Merge pull request #26 from martelkr/17-add-clang-tidy
Browse files Browse the repository at this point in the history
update clang-tidy and fix findings
  • Loading branch information
martelkr authored Sep 8, 2023
2 parents 0a9d5da + 564f0fd commit 0906cb8
Show file tree
Hide file tree
Showing 8 changed files with 1,010 additions and 919 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ jobs:
- name: Run clang-tidy
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON |
clang-tidy -p ${{github.workspace}}/build inc/cppsocket.hpp
cmake -B ${{github.workspace}}/build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
clang-tidy -p ${{github.workspace}}/build inc/cppsocket.hpp test/TestCppSocket.cpp
40 changes: 32 additions & 8 deletions .github/workflows/clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,36 @@ on:
pull_request:
branches: [ "main" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
Clang:
Clang-Debug:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install gtest manually
run: sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake CMakeLists.txt && sudo make && sudo cp lib/*.a /usr/lib && sudo ln -s /usr/lib/libgtest.a /usr/local/lib/libgtest.a && sudo ln -s /usr/lib/libgtest_main.a /usr/local/lib/libgtest_main.a

- name: Write files
env:
FILE_ONE: ${{ secrets.KRM_MAIN_FILE }}
FILE_TWO: ${{ secrets.KRM_SCND_FILE }}
run: |
echo "${FILE_ONE}" | base64 --decode > ${HOME}/key.pem |
echo "${FILE_TWO}" | base64 --decode > ${HOME}/scert.crt
- name: Build and Test
run: |
cmake . -B ${{github.workspace}}/build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug
cmake --build ${{github.workspace}}/build --config Debug
ctest -VV --test-dir ${{github.workspace}}/build -C Debug
- name: Generate a code coverage report
uses: threeal/gcovr-action@latest
with:
gcov-executable: llvm-cov gcov

Clang-Release:
runs-on: ubuntu-latest

steps:
Expand All @@ -30,9 +54,9 @@ jobs:
- name: Build and Test
run: |
cmake . -B ${{github.workspace}}/build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
cmake --build ${{github.workspace}}/build
ctest -VV --test-dir ${{github.workspace}}/build
cmake . -B ${{github.workspace}}/build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release
cmake --build ${{github.workspace}}/build --config Release
ctest -VV --test-dir ${{github.workspace}}/build -C Release
- name: Generate a code coverage report
uses: threeal/gcovr-action@latest
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/cppcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
platform: unix64
other_options: --bug-hunting -I inc --verbose --suppress=missingIncludeSystem --enable=warning

#- name: publish report
# uses: mikeal/publish-to-github-action@master
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# BRANCH_NAME: 'main'
- name: publish report
uses: mikeal/publish-to-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH_NAME: 'main'
35 changes: 27 additions & 8 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,31 @@ on:
pull_request:
branches: [ "main" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
Linux:
Linux-Debug:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install gtest
run: sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake CMakeLists.txt && sudo make && sudo cp lib/*.a /usr/lib && sudo ln -s /usr/lib/libgtest.a /usr/local/lib/libgtest.a && sudo ln -s /usr/lib/libgtest_main.a /usr/local/lib/libgtest_main.a

- name: Write files
env:
FILE_ONE: ${{ secrets.KRM_MAIN_FILE }}
FILE_TWO: ${{ secrets.KRM_SCND_FILE }}
run: |
echo "${FILE_ONE}" | base64 --decode > ${HOME}/key.pem |
echo "${FILE_TWO}" | base64 --decode > ${HOME}/scert.crt
- name: Build and test
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Debug
cmake --build ${{github.workspace}}/build --config Debug
ctest -VV --test-dir ${{github.workspace}}/build -C Debug
Linux-Release:
runs-on: ubuntu-latest

steps:
Expand All @@ -30,6 +49,6 @@ jobs:
- name: Build and test
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
ctest -VV --test-dir ${{github.workspace}}/build -C ${{env.BUILD_TYPE}}
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release
cmake --build ${{github.workspace}}/build --config Release
ctest -VV --test-dir ${{github.workspace}}/build -C Release
39 changes: 33 additions & 6 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ on:

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
BUILD_TYPE:

jobs:
Windows:
Windows-Debug:
runs-on: windows-latest

steps:
Expand All @@ -32,9 +32,36 @@ jobs:
- name: Install gtest
uses: MarkusJx/[email protected]

- name: Build and Test
- name: Build
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
ctest -VV --test-dir ${{github.workspace}}/build -C ${{env.BUILD_TYPE}}
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Debug
cmake --build ${{github.workspace}}/build --config Debug
ctest -VV --test-dir ${{github.workspace}}/build -C Debug
Windows-Release:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3

- name: Write files
env:
FILE_ONE: ${{ secrets.KRM_WIN_MAIN_FILE }}
FILE_TWO: ${{ secrets.KRM_WIN_SCND_FILE }}
shell: bash
run: |
echo "${FILE_ONE}" | openssl base64 -d > ${HOME}/privatekey.key |
echo "${FILE_TWO}" | openssl base64 -d > ${HOME}/certificate.crt
- name: Install OpenSSL
run: choco install openssl

- name: Install gtest
uses: MarkusJx/[email protected]

- name: Build
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release
cmake --build ${{github.workspace}}/build --config Release
ctest -VV --test-dir ${{github.workspace}}/build -C Release
Loading

0 comments on commit 0906cb8

Please sign in to comment.