9 Commits

5 changed files with 34 additions and 20 deletions

View File

@@ -1,26 +1,30 @@
name: Build
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: sonarsource/sonarqube-scan-action@master
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v1
- name: Run build-wrapper
run: |
mkdir build
cmake -S . -B build
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build/ --config Release
- name: Run sonar-scanner
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
# If you wish to fail your job when the Quality Gate is red, uncomment the
# following lines. This would typically be used to fail a deployment.
# - uses: sonarsource/sonarqube-quality-gate-action@master
# timeout-minutes: 5
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Put the name of your token here
run: |
sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"

3
.gitignore vendored
View File

@@ -34,5 +34,4 @@
**/lcoverage
.idea
cmake-*
**/CMakeFiles
sonar-project.properties
**/CMakeFiles

View File

@@ -2,6 +2,7 @@
#include <algorithm>
#include <set>
#include <cmath>
#include <limits>
#include "CPPFImdlp.h"
#include "Metrics.h"
@@ -36,8 +37,6 @@ namespace mdlp {
size_t idxNext = cut + 1 < end ? cut + 1 : cut;
bool backWall; // true if duplicates reach begining of the interval
precision_t previous, actual, next;
if (cut - 1 < start || cut + 1 >= end)
throw logic_error("Invalid cutpoint index");
previous = X[indices[idxPrev]];
actual = X[indices[cut]];
next = X[indices[idxNext]];

View File

@@ -23,7 +23,7 @@ namespace mdlp {
~CPPFImdlp();
CPPFImdlp& fit(samples_t&, labels_t&);
samples_t getCutPoints();
inline string version() { return "1.1.0"; };
inline string version() { return "1.1.1"; };
};
}
#endif
#endif

12
sonar-project.properties Normal file
View File

@@ -0,0 +1,12 @@
sonar.projectKey=rmontanana_mdlp
sonar.organization=rmontanana
# This is the name and version displayed in the SonarCloud UI.
#sonar.projectName=mdlp
#sonar.projectVersion=1.0
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
#sonar.sources=.
# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8