Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianReimold committed Jan 12, 2024
0 parents commit 655bbf1
Show file tree
Hide file tree
Showing 48 changed files with 5,025 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
# Resons why specific warnings have been turned off:
#
# -clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling
# This warns about memcpy and wants us to use memcpy_s, which is not available in our gcc setup.
#
# -cppcoreguidelines-pro-type-vararg
# This forbids using functions like printf, snprintf etc. We would like to use those either way.
#
# -misc-no-recursion
# Recursion with functions can be an elegant way of solving recursive problems
#
# These checks have been disabled to keep compatibility with C++14:
# -modernize-concat-nested-namespaces
# -modernize-use-nodiscard
#

Checks: "-*,
clang-analyzer-*,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
bugprone-*,
-bugprone-easily-swappable-parameters,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-narrowing-conversions,
cppcoreguidelines-*,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-narrowing-conversions,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-no-malloc,
-cppcoreguidelines-owning-memory,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-pro-type-reinterpret-cast,
misc-*,
-misc-include-cleaner,
-misc-non-private-member-variables-in-classes,
-misc-no-recursion,
modernize-*,
-modernize-avoid-c-arrays,
-modernize-pass-by-value,
-modernize-use-trailing-return-type,
-modernize-use-auto,
-modernize-concat-nested-namespaces,
-modernize-return-braced-init-list,
-modernize-use-nodiscard,
performance-*,
readability-*,
-readability-braces-around-statements,
-readability-identifier-length,
-readability-magic-numbers,
-readability-redundant-access-specifiers,
-readability-function-cognitive-complexity,
-readability-else-after-return,
"
WarningsAsErrors: ''
HeaderFilterRegex: '^((?!/thirdparty/|/_deps/).)*$'
FormatStyle: none
47 changes: 47 additions & 0 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: macOS

on:
push:
pull_request:
branches: [ master ]

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

jobs:
build-macos:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: macos-latest

steps:

- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'true'
fetch-depth: 0

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
cmake -B ${{github.workspace}}/_build \
-DECALUDP_BUILD_SAMPLES=ON \
-DECALUDP_BUILD_TESTS=ON \
-DECALUDP_USE_BUILTIN_ASIO=ON \
-DECALUDP_USE_BUILTIN_RECYCLE=ON \
-DECALUDP_USE_BUILTIN_GTEST=ON \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
shell: bash

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/_build --config ${{env.BUILD_TYPE}}

- name: Run Tests
run: ctest -C Release -V
working-directory: ${{ github.workspace }}/_build

143 changes: 143 additions & 0 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
name: Ubuntu

on:
push:
pull_request:
branches: [ master ]

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

jobs:
build-ubuntu:

strategy:
matrix:
library_type: [static, shared, object]
os: [ubuntu-22.04, ubuntu-20.04]

# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ${{ matrix.os }}

steps:

- name: Set Variables
run: |
if [[ '${{ matrix.library_type }}' == 'static' ]]; then
echo "build_shared_libs=OFF" >> "$GITHUB_ENV"
echo "ecaludp_library_type=STATIC" >> "$GITHUB_ENV"
echo "package_postfix=static" >> "$GITHUB_ENV"
elif [[ '${{ matrix.library_type }}' == 'shared' ]]; then
echo "build_shared_libs=ON" >> "$GITHUB_ENV"
echo "ecaludp_library_type=SHARED" >> "$GITHUB_ENV"
echo "package_postfix=shared" >> "$GITHUB_ENV"
elif [[ '${{ matrix.library_type }}' == 'object' ]]; then
echo "build_shared_libs=OFF" >> "$GITHUB_ENV"
echo "ecaludp_library_type=OBJECT" >> "$GITHUB_ENV"
echo "package_postfix=object" >> "$GITHUB_ENV"
fi
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'true'
fetch-depth: 0

############################################
# Test-compile the project
############################################

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
cmake -B ${{github.workspace}}/_build \
-DECALUDP_BUILD_SAMPLES=ON \
-DECALUDP_BUILD_TESTS=ON \
-DECALUDP_USE_BUILTIN_ASIO=ON \
-DECALUDP_USE_BUILTIN_RECYCLE=ON \
-DECALUDP_USE_BUILTIN_GTEST=ON \
-DECALUDP_LIBRARY_TYPE=${{env.ecaludp_library_type}} \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DBUILD_SHARED_LIBS=${{ env.build_shared_libs }}
- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/_build --config ${{env.BUILD_TYPE}}

- name: Run Tests
run: ctest -C Release -V
working-directory: ${{ github.workspace }}/_build

- name: Read Project Version from CMakeCache
run: |
cmake_project_version_string=$(cat "${{github.workspace}}/_build/CMakeCache.txt" | grep "^CMAKE_PROJECT_VERSION:")
arr=(${cmake_project_version_string//=/ })
cmake_project_version=${arr[1]}
echo "CMAKE_PROJECT_VERSION=$cmake_project_version" >> "$GITHUB_ENV"
shell: bash

- name: CPack
run: cpack -G DEB
working-directory: ${{ github.workspace }}/_build
if: ${{ matrix.library_type != 'object' }}

- name: Rename .deb installer
run: |
mv *.deb '${{ env.PROJECT_NAME }}-${{ env.CMAKE_PROJECT_VERSION }}-${{ matrix.os }}-${{ env.package_postfix }}.deb'
shell: bash
working-directory: ${{github.workspace}}/_build/_package/
if: ${{ matrix.library_type != 'object' }}

- name: Upload binaries
uses: actions/upload-artifact@v3
with:
name: ${{ env.PROJECT_NAME }}-${{ env.CMAKE_PROJECT_VERSION }}-${{ matrix.os }}-${{ env.package_postfix }}
path: ${{github.workspace}}/_build/_package/*.deb
if: ${{ matrix.library_type != 'object' }}

############################################
# Test if our binary can be linked against
############################################

- name: Install binaries
shell: bash
run: sudo dpkg -i ${{ github.workspace }}/_build/_package/*.deb
if: ${{ matrix.library_type != 'object' }}

- name: Compile integration test (Release)
run: |
cmake -B ${{github.workspace}}/samples/integration_test/_build/release \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_MODULE_PATH="${{ github.workspace }}/thirdparty/asio-module/"
cmake --build ${{github.workspace}}/samples/integration_test/_build/release
working-directory: ${{ github.workspace }}/samples/integration_test
if: ${{ matrix.library_type != 'object' }}

- name: Run integration test (Release)
run: ./integration_test
working-directory: ${{ github.workspace }}/samples/integration_test/_build/release
if: ${{ matrix.library_type != 'object' }}

- name: Compile integration test (Debug)
run: |
cmake -B ${{github.workspace}}/samples/integration_test/_build/debug \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_MODULE_PATH="${{ github.workspace }}/thirdparty/asio-module/"
cmake --build ${{github.workspace}}/samples/integration_test/_build/debug
working-directory: ${{ github.workspace }}/samples/integration_test
if: ${{ matrix.library_type != 'object' }}

- name: Run integration test (Debug)
run: ./integration_test
working-directory: ${{ github.workspace }}/samples/integration_test/_build/debug
if: ${{ matrix.library_type != 'object' }}

Loading

0 comments on commit 655bbf1

Please sign in to comment.