diff --git a/.github/workflows/ci_centos7.yml b/.github/workflows/ci_centos7.yml index 9ae4a2e68..fabe39f45 100644 --- a/.github/workflows/ci_centos7.yml +++ b/.github/workflows/ci_centos7.yml @@ -1,6 +1,10 @@ name: CI-cpp-centos7 -on: [push] +on: + workflow_dispatch: {} + pull_request: + push: + release: defaults: run: @@ -28,34 +32,50 @@ jobs: uses: actions/checkout@v1 - name: Download Boost-release - uses: pozetroninc/github-action-get-latest-release@master + uses: dsaltares/fetch-gh-release-asset@master with: - owner: ARnDOSrte - repo: Boost + repo: 'ARnDOSrte/Boost' + file: 'boost_1_73_0.zip' + target: 'boost_1_73_0.zip' token: ${{ secrets.TEST_TOKEN_RELEASE }} - name: Unzip Boost - run: | - pwd - ls - unzip boost_1_73_0.zip + 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-linux/external + 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-linux/external --parallel 2 + 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 -Wno-dev -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/metrix-simulator/build-linux/install -B $GITHUB_WORKSPACE/metrix-simulator/build-linux + 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-centos7/install -B $GITHUB_WORKSPACE/metrix-simulator/build-centos7 - name: Build - run: cmake --build $GITHUB_WORKSPACE/metrix-simulator/build-linux --target install --parallel 2 + run: cmake --build $GITHUB_WORKSPACE/metrix-simulator/build-centos7 --target install --parallel 2 - - name: Tests - run: cd $GITHUB_WORKSPACE/metrix-simulator/build-linux && ctest -j2 --output-on-failure \ No newline at end of file + # - name: Tests + # run: cd $GITHUB_WORKSPACE/metrix-simulator/build-centos7 && ctest -j2 --output-on-failure + + - name: Prepare Metrix install + if: github.event_name == 'workflow_dispatch' + id: metrix-install + run: | + ARCHIVE_NAME="metrix-simulator-centos7.zip" + ARCHIVE_PATH="$PWD/${ARCHIVE_NAME}" + cd metrix-simulator/build-centos7/install/ + zip -r $ARCHIVE_PATH bin etc + echo "::set-output name=archive_name::$ARCHIVE_NAME" + echo "::set-output name=archive_path::$ARCHIVE_PATH" + + - name: Upload OR-Tools install artifact + if: github.event_name == 'workflow_dispatch' + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.metrix-install.outputs.archive_name }} + path: ${{ steps.metrix-install.outputs.archive_path }} \ No newline at end of file diff --git a/.github/workflows/ci_ubuntu.yml b/.github/workflows/ci_ubuntu.yml index 6f6f18634..3b6422929 100644 --- a/.github/workflows/ci_ubuntu.yml +++ b/.github/workflows/ci_ubuntu.yml @@ -1,6 +1,11 @@ name: CI-cpp-ubuntu -on: [push] +on: + workflow_dispatch: {} + pull_request: + types: [opened, synchronize, ready_for_review] + push: + release: defaults: run: @@ -13,6 +18,7 @@ jobs: steps: - name: Install Boost run: | + echo "${{ github.event.action }}" sudo apt-get update -y sudo apt-get install -y libboost-all-dev @@ -39,74 +45,78 @@ jobs: - name: Tests run: cd $GITHUB_WORKSPACE/metrix-simulator/build-linux && ctest -j8 --output-on-failure - # qa: - # name: QA - CI - # runs-on: ubuntu-latest - # steps: - # - name: Install Java 11 - # uses: actions/setup-java@v1 - # with: - # java-version: 11 - - # - name: Install gcovr - # run: | - # sudo apt-get update -y - # sudo apt-get install -y gcovr - - # - name: Install Sonar wrapper - # working-directory: ${{ runner.workspace }} - # run: | - # wget https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip - # unzip build-wrapper-linux-x86.zip - - # - name: Install Sonar scanner - # working-directory: ${{ runner.workspace }} - # 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: Install Boost - # run: | - # sudo apt-get update -y - # sudo apt-get install -y libboost-all-dev - - # - name: Checkout sources - # uses: actions/checkout@v1 - - # - name: Configure 3rd parties - # run: > - # 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: > - # cmake -Wno-dev -S $GITHUB_WORKSPACE/metrix-simulator -B $GITHUB_WORKSPACE/metrix-simulator/build - # -DCMAKE_BUILD_TYPE=Debug - # -DCODE_COVERAGE=TRUE - # -DMETRIX_RUN_ALL_TESTS=OFF - # -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/metrix-simulator/build/install - - # - name: Build - # run: > - # ${{ runner.workspace }}/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: Sonarcloud - # working-directory: ${{ runner.workspace }}/powsybl-metrix/metrix-simulator - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - # run: > - # ${{ runner.workspace }}/sonar/bin/sonar-scanner - # -Dsonar.host.url=https://sonarcloud.io + qa: + name: QA - CI + runs-on: ubuntu-latest + # if: (github.event_name == 'pull_request' && (github.event.action == 'ready_for_review' || github.event.action == 'opened')) || github.event_name == 'release' + if: | + (github.event_name == 'pull_request' && github.event.action == 'ready_for_review') || + (github.event_name == 'pull_request' && github.event.action == 'opened') + steps: + - name: Install Java 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Install gcovr + run: | + sudo apt-get update -y + sudo apt-get install -y gcovr + + - name: Install Sonar wrapper + working-directory: ${{ runner.workspace }} + run: | + wget https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip + unzip build-wrapper-linux-x86.zip + + - name: Install Sonar scanner + working-directory: ${{ runner.workspace }} + 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: Install Boost + run: | + sudo apt-get update -y + sudo apt-get install -y libboost-all-dev + + - name: Checkout sources + uses: actions/checkout@v1 + + - name: Configure 3rd parties + run: > + 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: > + cmake -Wno-dev -S $GITHUB_WORKSPACE/metrix-simulator -B $GITHUB_WORKSPACE/metrix-simulator/build + -DCMAKE_BUILD_TYPE=Debug + -DCODE_COVERAGE=TRUE + -DMETRIX_RUN_ALL_TESTS=OFF + -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/metrix-simulator/build/install + + - name: Build + run: > + ${{ runner.workspace }}/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: Sonarcloud + working-directory: ${{ runner.workspace }}/powsybl-metrix/metrix-simulator + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: > + ${{ runner.workspace }}/sonar/bin/sonar-scanner + -Dsonar.host.url=https://sonarcloud.io diff --git a/.github/workflows/maven_centos7.yml b/.github/workflows/maven_centos7.yml index b539aa479..46a140b6b 100644 --- a/.github/workflows/maven_centos7.yml +++ b/.github/workflows/maven_centos7.yml @@ -1,6 +1,12 @@ name: CI_centos7 -on: [push] +on: + push: + branches: + - 'main' + - 'release-v**' + - 'full-sonar-analysis-**' + pull_request: jobs: build: diff --git a/.github/workflows/maven_ubuntu.yml b/.github/workflows/maven_ubuntu.yml index 4dd20fe13..fd67e650c 100644 --- a/.github/workflows/maven_ubuntu.yml +++ b/.github/workflows/maven_ubuntu.yml @@ -1,6 +1,12 @@ -name: CI_ubuntu +name: CI-UBUNTU -on: [push] +on: + push: + branches: + - 'main' + - 'release-v**' + - 'full-sonar-analysis-**' + pull_request: jobs: build: @@ -11,10 +17,10 @@ jobs: os: [ubuntu-latest] steps: - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v1 with: - java-version: 11 + java-version: 17 - name: Checkout sources uses: actions/checkout@v1 @@ -22,14 +28,14 @@ jobs: - name: Build with Maven run: mvn --batch-mode package - # - name: Run SonarCloud analysis - # if: matrix.os == 'ubuntu-latest' - # run: > - # mvn --batch-mode -Pjacoco verify sonar:sonar - # -Dsonar.host.url=https://sonarcloud.io - # -Dsonar.organization=powsybl-ci-github - # -Dsonar.projectKey=com.powsybl:powsybl-metrix - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: Run SonarCloud analysis + if: matrix.os == 'ubuntu-latest' + run: > + mvn --batch-mode -Pjacoco verify sonar:sonar + -Dsonar.host.url=https://sonarcloud.io + -Dsonar.organization=powsybl-ci-github + -Dsonar.projectKey=com.powsybl:powsybl-metrix + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/qa_pr_cpp_centos7.yml b/.github/workflows/qa_pr_cpp_centos7.yml index 1967f9f77..a27ef70b6 100644 --- a/.github/workflows/qa_pr_cpp_centos7.yml +++ b/.github/workflows/qa_pr_cpp_centos7.yml @@ -2,7 +2,7 @@ name: QA-PR-CPP-CENTOS7 on: pull_request: - types: [opened, synchronize, edited] + types: [opened, ready_for_review] release: types: [created, published, released] @@ -14,50 +14,61 @@ jobs: steps: - name: Install Dependancies run: | + echo $GITHUB_WORKSPACE + pwd + echo ${{ runner.workspace }} yum update -y yum install -y epel-release yum install -y git redhat-lsb-core make wget centos-release-scl scl-utils yum install -y devtoolset-9 + + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@v1.13 + with: + cmake-version: '3.22.x' + + - name: Checkout sources + uses: actions/checkout@v1 - - name: Install Boost - run: | - source /opt/rh/devtoolset-9/enable - wget https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.tar.gz - tar -xzvf ./boost_1_73_0.tar.gz - cd boost_1_73_0 - ./bootstrap.sh --prefix=/usr/local - ./b2 install --without-python -j 5 - cd .. + - name: Download Boost-release + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: 'ARnDOSrte/Boost' + file: 'boost_1_73_0.zip' + target: 'boost_1_73_0.zip' + token: ${{ secrets.TEST_TOKEN_RELEASE }} + + - name: Unzip Boost + run: unzip boost_1_73_0.zip - name: Install clang-tidy run: | - yum install -y clang-tidy-14 - yum update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-14 100 - - - name: Checkout sources - uses: actions/checkout@v1 + # yum install -y clang-tidy-14 + # yum update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-14 100 + 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-linux/external + 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/external --parallel 2 + 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 - -DCMAKE_BUILD_TYPE=Debug - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + 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 run: | 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)$") + echo $MODIFIED_FILES if [ -n "$MODIFIED_FILES" ]; then - clang-tidy $MODIFIED_FILES -p $GITHUB_WORKSPACE/metrix-simulator/build + clang-tidy $MODIFIED_FILES -p $GITHUB_WORKSPACE/metrix-simulator/build-centos7 fi qa: name: QA - full @@ -70,6 +81,13 @@ jobs: yum install -y epel-release yum install -y git redhat-lsb-core make wget centos-release-scl scl-utils yum install -y devtoolset-9 + yum install -y python3 python3-pip + + + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@v1.13 + with: + cmake-version: '3.22.x' - name: Install Java 11 uses: actions/setup-java@v1 @@ -77,16 +95,21 @@ jobs: java-version: 11 - name: Install gcovr - run: yum pip install gcovr + run: | + yum -y install libxml2-devel libxslt-devel + yum -y clean all + pip3 install wheel + pip3 install gcovr cpplint + - name: Install Sonar wrapper - working-directory: ${{ runner.workspace }} + 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: ${{ runner.workspace }} + 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 @@ -95,72 +118,57 @@ jobs: env: SONAR_SCANNER_VERSION: 3.3.0.1492 - - name: Install Boost - run: | - source /opt/rh/devtoolset-9/enable - wget https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.tar.gz - tar -xzvf ./boost_1_73_0.tar.gz - cd boost_1_73_0 - ./bootstrap.sh --prefix=/usr/local - ./b2 install --without-python -j 5 - cd .. - - name: Checkout sources uses: actions/checkout@v1 + + - name: Download Boost-release + uses: dsaltares/fetch-gh-release-asset@master + with: + repo: 'ARnDOSrte/Boost' + file: 'boost_1_73_0.zip' + target: 'boost_1_73_0.zip' + token: ${{ secrets.TEST_TOKEN_RELEASE }} + + - name: Unzip Boost + run: unzip boost_1_73_0.zip - name: Configure 3rd parties run: | - source /opt/rh/devtoolset-9/enable 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 (For Release) - if: github.event_name == 'release' + + - 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 - -DCODE_COVERAGE=TRUE - -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/metrix-simulator/build/install - - - name: Configure CMake (For Pull Request) - if: github.event_name != 'release' - run: > - cmake -Wno-dev -S $GITHUB_WORKSPACE/metrix-simulator -B $GITHUB_WORKSPACE/metrix-simulator/build - -DCMAKE_BUILD_TYPE=Debug - -DCODE_COVERAGE=FALSE - -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/metrix-simulator/build/install + 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 - run: > - ${{ runner.workspace }}/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 - + 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 -R "bug_pne" --output-on-failure + 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 - # working-directory: ${{ runner.workspace }}/powsybl-metrix/metrix-simulator - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - # run: > - # ${{ runner.workspace }}/sonar/bin/sonar-scanner - # -Dsonar.host.url=https://sonarcloud.io + - 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 - name: Prepare Metrix install if: github.event_name == 'release' id: metrix-install run: | - ARCHIVE_NAME="metrix-simulator.zip" + ARCHIVE_NAME="metrix-simulator-centos7.zip" ARCHIVE_PATH="$PWD/${ARCHIVE_NAME}" zip $ARCHIVE_PATH /__w/powsybl-metrix/powsybl-metrix/metrix-simulator/build-linux/install/bin/metrix-simulator echo "::set-output name=archive_name::$ARCHIVE_NAME" @@ -172,37 +180,3 @@ jobs: with: name: ${{ steps.metrix-install.outputs.archive_name }} path: ${{ steps.metrix-install.outputs.archive_path }} - - publish_asset: - name: Publish release assets - needs: qa - runs-on: ubuntu-latest - if: github.event_name == 'release' - steps: - - name: Download artifacts - uses: actions/download-artifact@v3 - with: - name: metrix-simulator.zip - path: ./ - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.TEST_TOKEN_RELEASE }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - draft: false - prerelease: false - - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.TEST_TOKEN_RELEASE }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: metrix-simulator.zip - asset_name: metrix-simulator.zip - asset_content_type: application/zip diff --git a/.github/workflows/qa_pr_cpp_ubuntu.yml b/.github/workflows/qa_pr_cpp_ubuntu.yml index 7c19aee48..b1a695fa5 100644 --- a/.github/workflows/qa_pr_cpp_ubuntu.yml +++ b/.github/workflows/qa_pr_cpp_ubuntu.yml @@ -1,10 +1,10 @@ -name: QA-PR-CPP +name: QA-PR-CPP-UBUNTU on: pull_request: - types: [opened, synchronize, edited] + types: [opened, ready_for_review] release: - types: [created] + types: [created, published, released] jobs: clang-tidy: @@ -41,6 +41,7 @@ jobs: - name: Clang Tidy run: | 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)$") + echo $MODIFIED_FILES if [ -n "$MODIFIED_FILES" ]; then clang-tidy $MODIFIED_FILES -p $GITHUB_WORKSPACE/metrix-simulator/build fi @@ -89,21 +90,12 @@ jobs: - name: Build 3rd parties run: > cmake --build $GITHUB_WORKSPACE/metrix-simulator/build/external --parallel 2 - - - name: Configure CMake (For Release) - if: github.event_name == 'release' - run: > - cmake -Wno-dev -S $GITHUB_WORKSPACE/metrix-simulator -B $GITHUB_WORKSPACE/metrix-simulator/build - -DCMAKE_BUILD_TYPE=Debug - -DCODE_COVERAGE=TRUE - -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/metrix-simulator/build/install - - name: Configure CMake (For Pull Request) - if: github.event_name != 'release' + - name: Configure CMake run: > cmake -Wno-dev -S $GITHUB_WORKSPACE/metrix-simulator -B $GITHUB_WORKSPACE/metrix-simulator/build -DCMAKE_BUILD_TYPE=Debug - -DCODE_COVERAGE=FALSE + -DCODE_COVERAGE=TRUE -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/metrix-simulator/build/install - name: Build @@ -113,10 +105,9 @@ jobs: cmake --build $GITHUB_WORKSPACE/metrix-simulator/build --parallel 2 --target install - name: Tests - run: cd $GITHUB_WORKSPACE/metrix-simulator/build && ctest -j8 -R "bug_pne" --output-on-failure + run: cd $GITHUB_WORKSPACE/metrix-simulator/build && ctest -j8 --output-on-failure - name: Code coverage - if: github.event_name == 'release' run: cmake --build $GITHUB_WORKSPACE/metrix-simulator/build --target code-coverage - name: Sonarcloud @@ -132,7 +123,7 @@ jobs: if: github.event_name == 'release' id: metrix-install run: | - ARCHIVE_NAME="metrix-simulator.zip" + ARCHIVE_NAME="metrix-simulator-ubuntu.zip" ARCHIVE_PATH="$PWD/${ARCHIVE_NAME}" zip $ARCHIVE_PATH /__w/powsybl-metrix/powsybl-metrix/metrix-simulator/build/install/bin/metrix-simulator echo "::set-output name=archive_name::$ARCHIVE_NAME" @@ -144,32 +135,3 @@ jobs: with: name: ${{ steps.metrix-install.outputs.archive_name }} path: ${{ steps.metrix-install.outputs.archive_path }} - - publish_asset: - name: Publish release assets - needs: qa - runs-on: ubuntu-latest - if: github.event_name == 'release' - steps: - - name: Download artifacts - uses: actions/download-artifact@v3 - with: - name: metrix-simulator.zip - path: ./ - - - name: Get release - id: get_release - uses: bruceadams/get-release@v1.3.2 - env: - GITHUB_TOKEN: ${{ secrets.TEST_TOKEN_RELEASE }} - - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.TEST_TOKEN_RELEASE }} - with: - upload_url: ${{ steps.get_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: metrix-simulator.zip - asset_name: metrix-simulator.zip - asset_content_type: application/zip diff --git a/.gitignore b/.gitignore index 53ece5874..9e7378b01 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ # CMake projects /build/ +/buildDebug/ /thirdparty/build/ # IntelliJ diff --git a/metrix-simulator/CMakeLists.txt b/metrix-simulator/CMakeLists.txt index cf7487d27..6fa8b2716 100755 --- a/metrix-simulator/CMakeLists.txt +++ b/metrix-simulator/CMakeLists.txt @@ -193,4 +193,4 @@ write_basic_package_version_file( ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/metrix-simulator-config.cmake" DESTINATION ${INSTALL_CMAKE_DIR} -) +) \ No newline at end of file diff --git a/metrix-simulator/src/reseau.cpp b/metrix-simulator/src/reseau.cpp index c870af838..8130c6bd9 100644 --- a/metrix-simulator/src/reseau.cpp +++ b/metrix-simulator/src/reseau.cpp @@ -3039,7 +3039,7 @@ void Reseau::updateVariant(MapQuadinVar& mapping, const config::VariantConfigura throw ErrorI(err::ioDico().msg("ERRGrpRandomDifferentGrp", c_fmt("%d", variant->num_))); } } - if (config.randomGroups.empty()){ + if (!config.randomGroups.empty()){ for (const auto& group : groupes_){ if (std::find(config.randomGroups.begin(), config.randomGroups.end(), group.first) == config.randomGroups.end()){ throw ErrorI(err::ioDico().msg("ERRGrpRandomDifferentGrp", c_fmt("%d", variant->num_)));