Skip to content

Commit

Permalink
Merge branch 'main' into franziska-wegner/2023/december/tests/algorit…
Browse files Browse the repository at this point in the history
…hms/GeneratorBasedBetweennessCentrality
  • Loading branch information
franziska-wegner authored Dec 23, 2023
2 parents d1c9c95 + 349a8f5 commit 65f68b4
Show file tree
Hide file tree
Showing 4 changed files with 192 additions and 7 deletions.
21 changes: 20 additions & 1 deletion .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,26 @@ jobs:
# Death tests use fork(), which is unsafe particularly in a threaded context. For this test, Google Test detected
# 3 threads. See https://github.com/google/googletest/blob/main/docs/advanced.md#death-tests-and-threads for more
# explanation and suggested solutions, especially if this is the last message you see before your test times out.
run: ctest --verbose -j1 --build-config ${{ matrix.build_type }}
run: ctest --verbose -j1 --build-config ${{ matrix.build_type }} -T Test

- name: Test Coverage Collection (Ubuntu GCC Debug only)
working-directory: ${{ steps.strings.outputs.build-output-dir }}
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
# The tests are run single threaded due to the fact that the Google Testframework uses forks in the Death Tests. The following warning
# we try to avoid:
# Warning: NG] /Users/runner/work/egoa/egoa/external/GoogleTestFramework/googletest/src/gtest-death-test.cc:1102::
# Death tests use fork(), which is unsafe particularly in a threaded context. For this test, Google Test detected
# 3 threads. See https://github.com/google/googletest/blob/main/docs/advanced.md#death-tests-and-threads for more
# explanation and suggested solutions, especially if this is the last message you see before your test times out.
if: ${{ startsWith(matrix.os,'ubuntu-') && startsWith(matrix.c_compiler,'gcc') && matrix.build_type == 'Debug' }}
run: ctest --verbose -j1 --build-config ${{ matrix.build_type }} -T Coverage

- name: Upload coverage reports to Codecov (Ubuntu GCC Debug only)
if: ${{ startsWith(matrix.os,'ubuntu-') && startsWith(matrix.c_compiler,'gcc') && matrix.build_type == 'Debug' }}
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Generate documentation
if: startsWith(matrix.os,'ubuntu-')
Expand Down
157 changes: 157 additions & 0 deletions .github/workflows/synopsys-security-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# This file is parttly based on https://github.com/marketplace/actions/synopsys-intelligent-security-scan.
name: Coverity
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '30 2 * * *' # Run once per day, to avoid Coverity's submission limits
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
Coverity:

runs-on: ubuntu-latest

env:
COV_URL: ${{ secrets.SYNOPSYS_ACCESS_URL }}
COV_USER: ${{ secrets.SYNOPSYS_ACCESS_EMAIL }}
COVERITY_PASSPHRASE: ${{ secrets.SYNOPSYS_ACCESS_TOKEN }}
CSA: cov-analysis-linux64-2020.12
COVERITY_PROJECT: franziska-wegner/egoa
BLDCMD: mvn -B clean package -DskipTests
CHECKERS: --webapp-security
QT_VERSION: "6.2.0"

steps:
- name: Checkout EGOA
uses: actions/checkout@v4

- name: Coverity Download
run: |
wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$COVERITY_PASSPHRASE&project=franziska-wegner%2Fegoa" -O coverity_tool.tgz
mkdir cov-scan
tar ax -f coverity_tool.tgz --strip-components=1 -C cov-scan
# - name: Coverity Full Scan
# if: ${{ github.event_name != 'pull_request' }}
# run: |
# export PATH=$PATH:/tmp/$CSA/bin
# set -x
# cov-build --dir idir --fs-capture-search $GITHUB_WORKSPACE $BLDCMD
# cov-analyze --dir idir --ticker-mode none --strip-path $GITHUB_WORKSPACE $CHECKERS
# cov-commit-defects --dir idir --ticker-mode none --url $COV_URL --stream $COVERITY_PROJECT-${GITHUB_REF##*/} --scm git \
# --description $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID --target $RUNNER_OS --version $GITHUB_SHA

# - name: Coverity Quality Gate
# if: ${{ github.event_name != 'pull_request' }}
# run: |
# curl -fLsS --user $COV_USER:$COVERITY_PASSPHRASE $COV_URL/api/viewContents/issues/v1/OWASP%20Web%20Top%2010?projectId=$COVERITY_PROJECT > results.json
# if [ $(cat results.json | jq .viewContentsV1.totalRows) -ne 0 ]; then cat results.json | jq .viewContentsV1.rows; exit 1; fi

# - id: changeset
# name: Get Pull Request Changeset
# uses: jitterbit/get-changed-files@v1
# if: ${{ github.event_name == 'pull_request' }}

# - name: Coverity Incremental Scan
# if: ${{ github.event_name == 'pull_request' && steps.changeset.outputs.added_modified != '' }}
# run: |
# export PATH=$PATH:/tmp/$CSA/bin
# set -x
# cov-run-desktop --dir idir --url $COV_URL --stream $COVERITY_PROJECT-$GITHUB_BASE_REF --build $BLDCMD
# cov-run-desktop --dir idir --url $COV_URL --stream $COVERITY_PROJECT-$GITHUB_BASE_REF --present-in-reference false \
# --ignore-uncapturable-inputs true --exit1-if-defects true ${{ steps.changeset.outputs.added_modified }}

- name: Setup environment
run: |
echo "$(pwd)/cov-scan/bin" >> $GITHUB_PATH
echo "NPROC=$(getconf _NPROCESSORS_ONLN)" >> $GITHUB_ENV
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
cache: 'true'
cache-key-prefix: ${{ runner.os }}-Qt-Cache-${{ env.QT_VERSION }}
dir: ${{ github.workspace }}/Qt

- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Configure egoa
env:
CMAKE_PREFIX_PATH: ${{env.Qt6_DIR}}
CMAKE_MODULE_PATH: ${{env.Qt6_DIR}}
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=g++
-DCMAKE_C_COMPILER=gcc
-DEGOA_BUILD_TYPE=Release
-DCMAKE_BUILD_TYPE=Release
-DBoost_NO_SYSTEM_PATHS=TRUE
-DEGOA_DOWNLOAD_CPPAD=OFF
-DEGOA_DOWNLOAD_EIGEN=OFF
-DEGOA_DOWNLOAD_GOOGLE_TEST_FRAMEWORK=OFF
-DEGOA_DOWNLOAD_IEEE=OFF
-DEGOA_DOWNLOAD_PYPSA_EUR=OFF
-DEGOA_DOWNLOAD_PYPSA_ITI_COLLABORATION=OFF
-DEGOA_DOWNLOAD_SCIGRID=OFF
-DEGOA_DOWNLOAD_WINDFARM=OFF
-DEGOA_ENABLE_ASSERTION=ON
-DEGOA_ENABLE_BONMIN=OFF
-DEGOA_ENABLE_BOOST=OFF
-DEGOA_ENABLE_CPLEX=OFF
-DEGOA_ENABLE_DOCUMENTATION=OFF
-DEGOA_ENABLE_EXCEPTION_HANDLING=ON
-DEGOA_ENABLE_GUROBI=OFF
-DEGOA_ENABLE_IPOPT=OFF
-DEGOA_ENABLE_OGDF=OFF
-DEGOA_ENABLE_OPENMP=OFF
-DEGOA_ENABLE_TESTS=OFF
-DEGOA_ENABLE_VERBOSE_MAKEFILE=ON
-DEGOA_PEDANTIC_AS_ERRORS=OFF
-DEGOA_PEDANTIC_MODE=ON
-DEGOA_TEST_FRAMEWORK=OfflineGoogleTestFramework
-DEGOA_TEST_FRAMEWORK_LOCATION=external/GoogleTestFramework
-DEGOA_THREAD_LIMIT=0
-DEGOA_WARNINGS_AS_ERRORS=ON
-DBONMIN_ROOT_DIR="NONE-DIR"
-DBoost_DIRECTORIES="/opt/homebrew/opt/boost/"
-DCOIN_INCLUDE_DIR="NONE-DIR"
-DCOIN_LIBRARY_DIR="NONE-DIR"
-DCPLEX_HOME="NONE-DIR"
-DGUROBI_ROOT_DIR="NONE-DIR"
-DOGDF_AUTOGEN_INCLUDE_DIR="NONE-DIR"
-DOGDF_INCLUDE_DIR="NONE-DIR"
-DOGDF_LIBRARY_DIR="NONE-DIR"
-DOPENMP_INCLUDES="/opt/homebrew/opt/llvm/include"
-DOPENMP_LIBRARIES="/opt/homebrew/opt/llvm/lib"
-S ${{ github.workspace }}
- name: Run coverity build/scan
run: |
cd build && cov-build --dir cov-int make -j${NPROC}
- name: Submit results
run: |
cd build
tar zcf cov-scan.tgz cov-int
curl --form token=$COVERITY_PASSPHRASE \
--form email=$COV_USER \
--form [email protected] \
--form version="$(git rev-parse HEAD)" \
--form description="Automatic GHA scan" \
'https://scan.coverity.com/builds?project=franziska-wegner%2Fegoa'
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0) [![CMake on multiple platforms](https://github.com/franziska-wegner/egoa/actions/workflows/cmake-multi-platform.yml/badge.svg?branch=master)](https://github.com/franziska-wegner/egoa/actions/workflows/cmake-multi-platform.yml) [![CodeQL](https://github.com/franziska-wegner/egoa/actions/workflows/codeql.yml/badge.svg?branch=master)](https://github.com/franziska-wegner/egoa/actions/workflows/codeql.yml) <a href="https://scan.coverity.com/projects/franziska-wegner-egoa"><img alt="Coverity Scan Build Status" src="https://scan.coverity.com/projects/29511/badge.svg"/></a>
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0) [![CMake on multiple platforms](https://github.com/franziska-wegner/egoa/actions/workflows/cmake-multi-platform.yml/badge.svg?branch=master)](https://github.com/franziska-wegner/egoa/actions/workflows/cmake-multi-platform.yml) [![CodeQL](https://github.com/franziska-wegner/egoa/actions/workflows/codeql.yml/badge.svg?branch=master)](https://github.com/franziska-wegner/egoa/actions/workflows/codeql.yml) <a href="https://scan.coverity.com/projects/franziska-wegner-egoa"><img alt="Coverity Scan Build Status" src="https://scan.coverity.com/projects/29511/badge.svg"/></a> [![codecov](https://codecov.io/gh/franziska-wegner/egoa/graph/badge.svg?token=OL0N2WXV4I)](https://codecov.io/gh/franziska-wegner/egoa)
<h1 align="center">EGOA - Energy Grid Optimization and Analysis</h1>

Energy Grid Optimization and Analysis (EGOA) is a framework for energy grid analysis and planning. This framework is based on the PhD thesis <a href="http://dx.doi.org/10.5445/IR/1000120612">"Combinatorial Problems in Energy Networks -- Graph Theoretic Models and Algorithms"</a>. The Git repository of the PhD thesis is available under <a href="https://github.com/franziska-wegner/PhD_Thesis--Combinatorial_Problems_in_Energy_Networks--Graph_Theoretic_Models_and_Algorithms">Combinatorial_Problems_in_Energy_Networks</a>.

<img height=275 alt="Swiss Power Grid Branch with Parameters" src="https://github.com/franziska-wegner/egoa/assets/57569315/514cd0d2-6fac-416a-bf8d-31d97565fed8"/> <img height=275 alt="Swiss Power Grid Bus with Parameters" src="https://github.com/franziska-wegner/egoa/assets/57569315/aad67a45-a656-4c42-9c74-e7d82eedc6fb"/>


<h2>Workflow Status</h2>

| | |
Expand All @@ -11,6 +14,7 @@ Energy Grid Optimization and Analysis (EGOA) is a framework for energy grid anal
| [CodeQL](https://codeql.github.com) Scan Build Status: | [![CodeQL](https://github.com/franziska-wegner/egoa/actions/workflows/codeql.yml/badge.svg?branch=master)](https://github.com/franziska-wegner/egoa/actions/workflows/codeql.yml) |
| Project Documentation: | [Code Documentation by Doxygen](https://franziska-wegner.github.io/egoa) |
| Coverity Scan Build Status: | <a href="https://scan.coverity.com/projects/franziska-wegner-egoa"><img alt="Coverity Scan Build Status" src="https://scan.coverity.com/projects/29511/badge.svg"/></a> |
| Code Coverage: | [![codecov](https://codecov.io/gh/franziska-wegner/egoa/graph/badge.svg?token=OL0N2WXV4I)](https://codecov.io/gh/franziska-wegner/egoa) |

<h2>Installation</h2>

Expand Down
15 changes: 10 additions & 5 deletions cmake/CompilerConfiguration.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# CompilerConfiguration.cmake
#
#
# Created on: Nov 04, 2019
# Author: Franziska Wegner
#
#
# Compiler specific configurations.
#
#

# -ggdb Produce debugging information for use by GDB. This means
# to use the most expressive format available (DWARF, stabs, or
Expand All @@ -14,8 +14,13 @@
# - Wall This enables all the warnings about constructions that
# some users consider questionable, and that are easy to avoid
# (or modify to prevent the warning), even in conjunction with macros
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast")
if (CMAKE_BUILD_TYPE MATCHES "Debug" AND CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_SYSTEM_NAME MATCHES "Linux")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -coverage")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast -coverage")
else()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast")
endif()

####################################################################
# Compiler Options #################################################
Expand Down

0 comments on commit 65f68b4

Please sign in to comment.