Skip to content

Improve mapping doc examples about enumerations usage #219

Improve mapping doc examples about enumerations usage

Improve mapping doc examples about enumerations usage #219

name: QA-PR-CPP-CENTOS7
on:
workflow_dispatch:
pull_request:
types: [opened, ready_for_review, reopened]
release:
types: [published]
push:
paths:
- '.github/workflows/qa_pr_cpp_centos7.yml'
# Cancel previous workflows if they are the same workflow on same ref (branch/tags)
# with the same event (push/pull_request) even they are in progress.
# This setting will help reduce the number of duplicated workflows.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
jobs:
clang-tidy:
name: Clang-tidy CentOS
runs-on: ubuntu-latest
container: 'centos:centos7'
steps:
- name: Update mirrors
run: |
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
- name: Update Dependencies
run: |
yum update -y
- name: Install Dependencies 1
run: |
yum install -y epel-release
- name: Install Dependencies 2
run: |
yum install -y git redhat-lsb-core make wget centos-release-scl scl-utils
- name: Update mirrors again because why not
run: |
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
- name: Install Dependencies 3
run: |
yum install -y devtoolset-9
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.22.x'
- name: Checkout sources
uses: actions/checkout@v1
- name: Download Boost-release
uses: dsaltares/fetch-gh-release-asset@a40c8b4a0471f9ab81bdf73a010f74cc51476ad4 # v1.1.1
with:
repo: 'ARnDOSrte/Boost'
file: 'boost_1_73_0.zip'
target: 'boost_1_73_0.zip'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Unzip Boost
run: unzip boost_1_73_0.zip
- name: Install clang-tidy
run: |
yum install -y centos-release-scl
yum install -y llvm-toolset-7.0
scl enable llvm-toolset-7.0 bash
- name: Configure 3rd parties
run: |
source /opt/rh/devtoolset-9/enable
cmake -S $GITHUB_WORKSPACE/metrix-simulator/external -B $GITHUB_WORKSPACE/metrix-simulator/build-centos7/external
- name: Build 3rd parties
run: |
cmake --build $GITHUB_WORKSPACE/metrix-simulator/build-centos7/external --parallel 2
- name: Configure CMake
run: |
source /opt/rh/devtoolset-9/enable
cmake -S $GITHUB_WORKSPACE/metrix-simulator -B $GITHUB_WORKSPACE/metrix-simulator/build-centos7 -DCMAKE_BUILD_TYPE=Debug -DBoost_ROOT=$GITHUB_WORKSPACE/__w/Boost/Boost/boost_1_73_0/installBoost -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Clang Tidy PR
id: clang-pr
if: github.event_name == 'pull_request'
run: |
REPORT_NAME="clang_tidy_report_centos.txt"
REPORT_PATH="$PWD/${REPORT_NAME}"
export MODIFIED_FILES=$(git diff --name-only --diff-filter=d origin/${{ github.base_ref }} origin/${{ github.head_ref }} | grep -E ".*(metrix-simulator/src|metrix-simulator/log).*\.(cpp|hpp)$")
if [ -n "$MODIFIED_FILES" ]; then
clang-tidy $MODIFIED_FILES -p $GITHUB_WORKSPACE/metrix-simulator/build-centos7 > $REPORT_NAME || true
fi
echo "report_name=$REPORT_NAME" >> "$GITHUB_OUTPUT"
echo "report_path=$REPORT_PATH" >> "$GITHUB_OUTPUT"
- name: Upload Clang Tidy report - PR
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v3
with:
name: ${{ steps.clang-pr.outputs.report_name }}
path: ${{ steps.clang-pr.outputs.report_path }}
# - name: Clang Tidy Release
# id: clang-release
# if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
# run: |
# REPORT_NAME="clang_tidy_report_centos.txt"
# REPORT_PATH="$PWD/${REPORT_NAME}"
# export MODIFIED_FILES=$(find metrix-simulator/log/ metrix-simulator/src/ -type f | grep -E ".*(metrix-simulator/src|metrix-simulator/log).*\.(cpp|hpp)$")
# if [ -n "$MODIFIED_FILES" ]; then
# clang-tidy $MODIFIED_FILES -p $GITHUB_WORKSPACE/metrix-simulator/build > $REPORT_NAME || true
# cat clan_tidy_report_centos.txt # Display the contents of the report
# exit_code=$?
# if [ $exit_code -ne 0 ]; then
# echo "clang-tidy failed with exit code $exit_code"
# exit $exit_code
# fi
# fi
# echo "report_name=$REPORT_NAME" >> "$GITHUB_OUTPUT"
# echo "report_path=$REPORT_PATH" >> "$GITHUB_OUTPUT"
#
# - name: Upload Clang Tidy report - Release
# if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
# uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # 4.3.3
# with:
# name: ${{ steps.clang-release.outputs.report_name }}
# path: ${{ steps.clang-release.outputs.report_path }}
qa:
name: Full QA C++ CentOS
runs-on: ubuntu-latest
container: 'centos:centos7'
steps:
- name: Update mirrors
run: |
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
- name: Update Dependencies
run: |
yum update -y
- name: Install Dependencies 1
run: |
yum install -y epel-release
- name: Install Dependencies 2
run: |
yum install -y git redhat-lsb-core make wget centos-release-scl scl-utils
- name: Update mirrors again because why not
run: |
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
- name: Install Dependencies 3
run: |
yum install -y devtoolset-9
- name: Install Dependencies 4
run: |
yum install -y python3 python3-pip
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.22.x'
- name: Install Java 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Install gcovr
run: |
yum -y install libxml2-devel libxslt-devel
yum -y clean all
pip3 install wheel
pip3 install gcovr cpplint lxml==4.9.4
- name: Install Sonar wrapper
working-directory: /__w/powsybl-metrix
run: |
wget https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
unzip build-wrapper-linux-x86.zip
- name: Install Sonar scanner
working-directory: /__w/powsybl-metrix
run: |
wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}.zip
unzip sonar-scanner-cli-${SONAR_SCANNER_VERSION}.zip
ln -s sonar-scanner-${SONAR_SCANNER_VERSION} sonar
rm sonar-scanner-cli-${SONAR_SCANNER_VERSION}.zip
env:
SONAR_SCANNER_VERSION: 3.3.0.1492
- name: Checkout sources
uses: actions/checkout@v1
- name: Download Boost-release
uses: dsaltares/fetch-gh-release-asset@a40c8b4a0471f9ab81bdf73a010f74cc51476ad4 # v1.1.1
with:
repo: 'ARnDOSrte/Boost'
file: 'boost_1_73_0.zip'
target: 'boost_1_73_0.zip'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Unzip Boost
run: unzip boost_1_73_0.zip
- name: Configure 3rd parties
run: |
source /opt/rh/devtoolset-9/enable
cmake -S $GITHUB_WORKSPACE/metrix-simulator/external -B $GITHUB_WORKSPACE/metrix-simulator/build/external
- name: Build 3rd parties
run: |
cmake --build $GITHUB_WORKSPACE/metrix-simulator/build/external --parallel 2
- name: Configure CMake
run: |
source /opt/rh/devtoolset-9/enable
cmake -Wno-dev -S $GITHUB_WORKSPACE/metrix-simulator -B $GITHUB_WORKSPACE/metrix-simulator/build -DCMAKE_BUILD_TYPE=Debug -DBoost_ROOT=$GITHUB_WORKSPACE/__w/Boost/Boost/boost_1_73_0/installBoost -DBoost_INCLUDE_DIR=$GITHUB_WORKSPACE/__w/Boost/Boost/boost_1_73_0/installBoost -DCODE_COVERAGE=TRUE -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/metrix-simulator/build/install
- name: Build-Sonar
run: |
/__w/powsybl-metrix/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir $GITHUB_WORKSPACE/metrix-simulator/build/output cmake --build $GITHUB_WORKSPACE/metrix-simulator/build --parallel 2 --target install
- name: Tests
run: cd $GITHUB_WORKSPACE/metrix-simulator/build && ctest -j8 --output-on-failure
- name: Code coverage
run: cmake --build $GITHUB_WORKSPACE/metrix-simulator/build --target code-coverage
- name: Sonarcloud
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
cd metrix-simulator
/__w/powsybl-metrix/sonar/bin/sonar-scanner -Dsonar.host.url=https://sonarcloud.io
release:
name: Release CentOS7
runs-on: ubuntu-latest
container: 'centos:centos7'
needs: qa
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
steps:
- name: Update mirrors
run: |
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
- name: Update Dependencies
run: |
yum update -y
- name: Install Dependencies 1
run: |
yum install -y epel-release
- name: Install Dependencies 2
run: |
yum install -y git redhat-lsb-core make wget centos-release-scl scl-utils
- name: Update mirrors again because why not
run: |
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
- name: Install Dependencies 3
run: |
yum install -y devtoolset-9
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.22.x'
- name: Checkout sources
uses: actions/checkout@v1
- name: Download Boost-release
uses: dsaltares/fetch-gh-release-asset@a40c8b4a0471f9ab81bdf73a010f74cc51476ad4 # v1.1.1
with:
repo: 'ARnDOSrte/Boost'
file: 'boost_1_73_0.zip'
target: 'boost_1_73_0.zip'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Unzip Boost
run: unzip boost_1_73_0.zip
- name: Configure 3rd parties
run: |
source /opt/rh/devtoolset-9/enable
cmake -S $GITHUB_WORKSPACE/metrix-simulator/external -B $GITHUB_WORKSPACE/metrix-simulator/build/external
- name: Build 3rd parties
run: |
cmake --build $GITHUB_WORKSPACE/metrix-simulator/build/external --parallel 2
- name: Configure CMake
run: |
source /opt/rh/devtoolset-9/enable
cmake -S $GITHUB_WORKSPACE/metrix-simulator -Wno-dev -DCMAKE_BUILD_TYPE=Release -DBoost_ROOT=$GITHUB_WORKSPACE/__w/Boost/Boost/boost_1_73_0/installBoost -DBoost_INCLUDE_DIR=$GITHUB_WORKSPACE/__w/Boost/Boost/boost_1_73_0/installBoost -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/metrix-simulator/build/install -B $GITHUB_WORKSPACE/metrix-simulator/build
- name: Build
run: cmake --build $GITHUB_WORKSPACE/metrix-simulator/build --target install --parallel 2
- name: Prepare Metrix install
id: metrix-install
run: |
ARCHIVE_NAME="metrix-simulator-centos7"
ARCHIVE_PATH="$PWD/${ARCHIVE_NAME}"
cd metrix-simulator/build/install/
zip -r $ARCHIVE_PATH bin etc
echo "archive_name=$ARCHIVE_NAME" >> "$GITHUB_OUTPUT"
echo "archive_path=$ARCHIVE_PATH" >> "$GITHUB_OUTPUT"
- name: Upload OR-Tools install artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.metrix-install.outputs.archive_name }}.zip
path: ${{ steps.metrix-install.outputs.archive_path }}.zip
- name: Upload asset to release
uses: softprops/action-gh-release@v1
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/')
with:
files: ${{ steps.metrix-install.outputs.archive_name }}.zip