Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidelobe committed Feb 21, 2025
2 parents 5f5506d + 38e2ad9 commit 5f2bfc4
Show file tree
Hide file tree
Showing 16 changed files with 549 additions and 379 deletions.
25 changes: 10 additions & 15 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
name: Sidelobe Build Matrix Linux
on:
push:
branches:
- main
- develop
pull_request:
types: [opened, synchronize, reopened]
workflow_call:
jobs:
build:
name: Linux, ${{matrix.cxx}}, C++${{matrix.std}}, ${{matrix.build_type}}
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
cxx:
- g++-7
- g++-11
- g++-10
- g++-12
build_type: [Debug, Release]
std: [14]
include:
- cxx: g++-7
cc: gcc-7
other_pkgs: g++-7 gcc-7
- cxx: g++-11
cc: gcc-11
other_pkgs: g++-11 gcc-11
- cxx: g++-10
cc: gcc-10
other_pkgs: g++-10 gcc-10
- cxx: g++-12
cc: gcc-12
other_pkgs: g++-12 gcc-12

steps:
- uses: actions/checkout@v3
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
name: Sidelobe Build Matrix macos
on:
push:
branches:
- main
- develop
pull_request:
types: [opened, synchronize, reopened]
workflow_call:
jobs:
build:
name: ${{matrix.os}}, ${{matrix.cxx}}, C++${{matrix.std}}, ${{matrix.build_type}}
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: [macos-11]
os: [macos-latest]
cxx:
- clang++
build_type: [Debug]
build_type: [Debug, Release]
std: [14]

steps:
Expand All @@ -39,5 +34,5 @@ jobs:
CTEST_OUTPUT_ON_FAILURE: 1
working-directory: deploy/build
run: |
cmake --build . --parallel 2
cmake --build . --parallel 2 --target MemorySentinelTest
ctest -C ${{ matrix.build_type }} -L MemorySentinelTest -j 2
26 changes: 12 additions & 14 deletions .github/workflows/build-sonarqube.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
name: Sidelobe Build Sonarqube
on:
push:
branches:
- main
- develop
pull_request:
types: [opened, synchronize, reopened]
workflow_call:

jobs:
build:
name: Linux, GCC, Release, Coverage & SonarQube
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
env:
BUILD_WRAPPER_OUT_DIR: '$GITHUB_WORKSPACE/deploy/build/bw-output' # Directory where build-wrapper output will be placed
cxx: g++-11
cc: gcc-11
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'true'
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Install Toolchain
run: |
pip3 install gcovr
echo "Gcovr Updated!"
gcovr --version
sudo apt-get install -y g++-11 gcc-11
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v2
# sudo apt-get install -y g++-11 gcc-11
- name: Install Build Wrapper
uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v4
- name: Setup & Cmake
working-directory: deploy
env:
Expand All @@ -50,9 +46,11 @@ jobs:
# Generate coverage report
gcovr -r .. -f ../source --exclude-unreachable-branches --exclude-throw-branches --sonarqube -o report/coverage.xml
- name: Run sonar-scanner
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
with:
args: >
--define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"
7 changes: 1 addition & 6 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: Sidelobe Build Matrix Windows
on:
push:
branches:
- main
- develop
pull_request:
types: [opened, synchronize, reopened]
workflow_call:
jobs:
build:
name: ${{matrix.os}}, MSVC, C++${{matrix.std}}, ${{matrix.build_type}}, ${{matrix.platform}}
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build & Test
on:
push:
branches:
- main
- develop
pull_request:
types: [opened, synchronize, reopened]
schedule:
- cron: '0 3 1 * *' # At 3:00am on the 1st
workflow_dispatch:

jobs:
call-build-linux:
uses: ./.github/workflows/build-linux.yml
call-build-macos:
if: ${{ always() }}
uses: ./.github/workflows/build-macos.yml
call-build-windows:
if: ${{ always() }}
uses: ./.github/workflows/build-windows.yml
call-build-sonarqube:
if: ${{ always() }}
uses: ./.github/workflows/build-sonarqube.yml
secrets: inherit
9 changes: 6 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.9)
cmake_minimum_required(VERSION 3.20)

# ╔╦╗┌─┐┌┬┐┌─┐┬─┐┬ ┬ ╔═╗┌─┐┌┐┌┌┬┐┬┌┐┌┌─┐┬
# ║║║├┤ ││││ │├┬┘└┬┘ ╚═╗├┤ │││ │ ││││├┤ │
Expand Down Expand Up @@ -48,6 +48,8 @@ if (CODE_COVERAGE)
endif()

target_link_libraries(${TEST_NAME} ${LIB_NAME})

# Link to DL Libs
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
target_link_libraries(${TEST_NAME} dl)
endif()
Expand All @@ -58,7 +60,8 @@ if (POLICY CMP0110)
endif()

## ENABLE THE USE OF CTEST
include("test/external-utils/catch2/ParseAndAddCatchTests.cmake")
include("test/external-utils/catch2/Catch.cmake")

#include(CTest) # this will generate lots of additional targets
enable_testing()
ParseAndAddCatchTests(${TEST_NAME})
catch_discover_tests(${TEST_NAME})
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
╩ ╩└─┘┴ ┴└─┘┴└─ ┴ ╚═╝└─┘┘└┘ ┴ ┴┘└┘└─┘┴─┘
```

### A utility to detect memory allocation and de-allocation in a given scope. Meant to be used for testing environments.
### A utility to detect memory allocation and de-allocation in a given scope. Meant to be used for testing environments, not production deployments.


![](https://img.shields.io/github/license/Sidelobe/Hyperbuffer)
Expand All @@ -13,7 +13,7 @@

The `MemorySentinel` hijacks the all the system's variants of `new` & `delete` as well `malloc` & `free`. When unarmed, it quietly monitors the memory allocation landscape without intervening (quiet infiltration). When armed, and as soon as a "transgression" is detected, the `MemorySentinel` will become active, and either:

* Throw a ` std::bad_alloc`
* Throw a ` std::bad_alloc` (only for allocation funtions)
* Log to console (while still allocating normally)
* Register the event silently (status can be queried)

Expand Down Expand Up @@ -60,9 +60,7 @@ sentinel.clearTransgressions();
### Status

![](https://img.shields.io/badge/branch-main-blue)
[![Sidelobe Build Matrix Linux](https://github.com/Sidelobe/MemorySentinel/actions/workflows/build-linux.yml/badge.svg?branch=main)](https://github.com/Sidelobe/MemorySentinel/actions/workflows/build-linux.yml)
[![Sidelobe Build Matrix macos](https://github.com/Sidelobe/MemorySentinel/actions/workflows/build-macos.yml/badge.svg?branch=main)](https://github.com/Sidelobe/MemorySentinel/actions/workflows/build-macos.yml)
[![Sidelobe Build Matrix Windows](https://github.com/Sidelobe/MemorySentinel/actions/workflows/build-windows.yml/badge.svg?branch=main)](https://github.com/Sidelobe/MemorySentinel/actions/workflows/build-windows.yml)
[![Build & Test](https://github.com/Sidelobe/MemorySentinel/actions/workflows/workflow.yml/badge.svg)](https://github.com/Sidelobe/MemorySentinel/actions/workflows/workflow.yml)

MemorySentinel
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Sidelobe_MemorySentinel&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Sidelobe_MemorySentinel)
Expand Down
9 changes: 0 additions & 9 deletions deploy/generate-vs2019-windows.bat

This file was deleted.

9 changes: 9 additions & 0 deletions deploy/generate-vs2022-x64-windows.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@echo off

if not exist "build\vs2017-windows" mkdir build\vs2022-x64-windows
cd build\vs2022-x64-windows

cmake -G "Visual Studio 17 2022" -DCMAKE_GENERATOR_PLATFORM=x64 ..\..\..
if ERRORLEVEL 1 exit /b %ERRORLEVEL%

cd ..
4 changes: 2 additions & 2 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ sonar.c.file.suffixes=.c,.h
sonar.cpp.file.suffixes=.cpp,.hpp

# Config of C++ plugin
sonar.cfamily.threads=2
sonar.cfamily.build-wrapper-output=deploy/build/bw-output
#sonar.cfamily.threads=2
#sonar.cfamily.build-wrapper-output=deploy/build/bw-output

# Coverage Report
sonar.coverageReportPaths=deploy/report/coverage.xml
Expand Down
Loading

0 comments on commit 5f2bfc4

Please sign in to comment.