Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ Checks: >

CheckOptions:
- {key: readability-identifier-naming.TypeTemplateParameterIgnoredRegexp, value: expr-type}

HeaderFilterRegex: 'inc/.*'
110 changes: 87 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,71 @@
name: CI

on: [push, pull_request]

jobs:
tests:
asan:
runs-on: ${{matrix.os}}
name: AddressSanitization
strategy:
matrix:
os: ["ubuntu-latest"]

steps:
- name: Checkout repository
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_asan
run: |
cmake . -B ${{github.workspace}}/asanbuild -DCMAKE_BUILD_TYPE=ASAN
cmake --build ${{github.workspace}}/asanbuild --config ASAN

codeql:
runs-on: ubuntu-latest
name: CodeQL
strategy:
matrix:
language: ["cpp"]
fail-fast: false

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- 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: Build
run: |
echo "Run, Build Application using script"
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release
cmake --build ${{github.workspace}}/build --config Release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"

pipeline:
name: Pipeline
runs-on: ${{matrix.os}}
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
os: ["ubuntu-latest", "windows-latest"]
BUILDTYPE: ["Debug", "Release"]
include:
- os: "ubuntu-latest"
Expand All @@ -29,6 +87,14 @@ jobs:
- os: "ubuntu-latest"
cppstd: "20"
deps: "lcov"
cc: gcc
cxx: g++
coverage: "-DCOVERAGE=ON"
- os: "ubuntu-latest"
cppstd: "20"
deps: "lcov"
cc: clang
cxx: clang++
coverage: "-DCOVERAGE=ON"
- os: "windows-latest"
cppstd: "20"
Expand All @@ -38,36 +104,34 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: install_ubuntu_deps
- name: build_ubuntu
env:
FILE_ONE: ${{ secrets.KRM_MAIN_FILE }}
FILE_TWO: ${{ secrets.KRM_SCND_FILE }}
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get install libgtest-dev openssl clang-tidy && 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 |
echo "${FILE_ONE}" | base64 --decode > ${HOME}/key.pem |
sudo apt-get install libgtest-dev openssl clang-tidy && 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
echo "${FILE_ONE}" | base64 --decode > ${HOME}/key.pem
echo "${FILE_TWO}" | base64 --decode > ${HOME}/scert.crt
cmake . -B ${{github.workspace}}/build -DCMAKE_C_COMPILER=${{ matrix.cc }} \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} -DCMAKE_BUILD_TYPE=${{ matrix.BUILDTYPE }} \
-DCMAKE_CXX_STANDARD=${{ matrix.cppstd }}
cmake --build ${{github.workspace}}/build --config ${{ matrix.BUILDTYPE }}
ctest -VV --test-dir ${{github.workspace}}/build -C ${{ matrix.BUILDTYPE}}

- name: install_windows_deps
- name: windows_uses
if: ${{ matrix.os == 'windows-latest' }}
uses: MarkusJx/googletest-installer@v1.1

- name: build_windows
env:
FILE_ONE: ${{ secrets.KRM_WIN_MAIN_FILE }}
FILE_TWO: ${{ secrets.KRM_WIN_SCND_FILE }}
if: ${{ matrix.os == 'windows-latest' && matrix.BUILDTYPE == 'Release' }} # windows debug isn't working with gtest
run: |
echo "${FILE_ONE}" | openssl base64 -d > ${HOME}/privatekey.key |
echo "${FILE_TWO}" | openssl base64 -d > ${HOME}/certificate.crt |
echo "${FILE_ONE}" | openssl base64 -d > ${HOME}/privatekey.key
echo "${FILE_TWO}" | openssl base64 -d > ${HOME}/certificate.crt
choco install openssl

- name: windows_uses
if: ${{ matrix.os == 'windows-latest' }}
uses: MarkusJx/googletest-installer@v1.1.1

- name: build
run: |
cmake . -B ${{github.workspace}}/build -DCMAKE_C_COMPILER=${{ matrix.cc }} \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} -DCMAKE_BUILD_TYPE=${{ matrix.BUILDTYPE }} \
-DCMAKE_CXX_STANDARD=${{ matrix.cppstd }}
cmake . -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{ matrix.BUILDTYPE }}
cmake --build ${{github.workspace}}/build --config ${{ matrix.BUILDTYPE }}

- name: test
run: ctest -VV --test-dir ${{github.workspace}}/build -C ${{ matrix.BUILDTYPE}}
ctest -VV --test-dir ${{github.workspace}}/build -C ${{ matrix.BUILDTYPE}}
4 changes: 2 additions & 2 deletions .github/workflows/clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
ctest -VV --test-dir ${{github.workspace}}/build -C Debug

- name: Generate a code coverage report
uses: threeal/gcovr-action@latest
uses: threeal/gcovr-action@v1.1.0
with:
gcov-executable: llvm-cov gcov

Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
ctest -VV --test-dir ${{github.workspace}}/build -C Release

- name: Generate a code coverage report
uses: threeal/gcovr-action@latest
uses: threeal/gcovr-action@v1.1.0
with:
gcov-executable: llvm-cov gcov

2 changes: 1 addition & 1 deletion .github/workflows/cppcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
verbose: true

- name: Upload report
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: report
path: output
2 changes: 1 addition & 1 deletion .github/workflows/profile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: ctest -VV -C Coverage

- name: Generate Test Report
uses: threeal/gcovr-action@latest
uses: threeal/gcovr-action@v1.1.0
with:
coveralls-send: true
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
DESTINATION ${CPPSOCKET_CMAKECONFIG_INSTALL_DIR})

option(BUILD_TESTS "Whether or not to build the tests" OFF)
option(BUILD_TESTS "Whether or not to build the tests" ON)

if (BUILD_TESTS)
enable_testing()
Expand Down
8 changes: 5 additions & 3 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ if(CMAKE_COMPILER_IS_GNUCXX)
find_package(OpenSSL REQUIRED)
find_package(GTest REQUIRED)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "debug")
set(CMAKE_CXX_FLAGS "-Wall /O0 -g /std:c++20")
set(CMAKE_CXX_FLAGS "-Wall /MDd /std:c++20")
elseif(CMAKE_BUILD_TYPE STREQUAL "ASAN")
message(STATUS "Address sanitization")
set(CMAKE_CXX_FLAGS "-Wall /MDd /fsanitize=address /std:c++20")
else()
set(CMAKE_CXX_FLAGS "-Wall /O2 -g /std:c++20")
set(CMAKE_CXX_FLAGS "-Wall /MD /std:c++20")
endif()
if(DEFINED ENV{CI})
message(STATUS "MSVC Action")
Expand Down
Loading