From 45f08f5efa5b747bac3eb03009506542577741fa Mon Sep 17 00:00:00 2001 From: jeandemanged Date: Thu, 7 Nov 2024 14:38:00 +0100 Subject: [PATCH] Rework GitHub workflows (#178) * try rework github workflows Signed-off-by: Damien Jeandemange * try rework github workflows Signed-off-by: Damien Jeandemange * clang tidy Signed-off-by: Damien Jeandemange * clang tidy Signed-off-by: Damien Jeandemange * clang tidy Signed-off-by: Damien Jeandemange * clang tidy Signed-off-by: Damien Jeandemange * clang tidy Signed-off-by: Damien Jeandemange * clang tidy Signed-off-by: Damien Jeandemange * artifacts Signed-off-by: Damien Jeandemange * artifacts Signed-off-by: Damien Jeandemange * artifacts Signed-off-by: Damien Jeandemange * artifacts Signed-off-by: Damien Jeandemange * wip Signed-off-by: Damien Jeandemange * fix Signed-off-by: Damien Jeandemange * use softprops/action-gh-release Signed-off-by: Damien Jeandemange * fix Signed-off-by: Damien Jeandemange --------- Signed-off-by: Damien Jeandemange (cherry picked from commit dcb11db6ef8cc1be2c68f4e3657edb91732a6708) --- .github/workflows/ci_centos7.yml | 99 ------- .github/workflows/ci_ol8.yml | 58 ---- .github/workflows/ci_ubuntu.yml | 132 --------- .github/workflows/dev-ci.yml | 375 ++++++++++++++++++++++++ .github/workflows/full-ci.yml | 323 ++++++++++++++++++++ .github/workflows/maven.yml | 62 ---- .github/workflows/qa_pr_cpp_centos7.yml | 350 ---------------------- .github/workflows/qa_pr_cpp_ol8.yml | 209 ------------- .github/workflows/qa_pr_cpp_ubuntu.yml | 222 -------------- .github/workflows/release-ci.yml | 217 ++++++++++++++ 10 files changed, 915 insertions(+), 1132 deletions(-) delete mode 100644 .github/workflows/ci_centos7.yml delete mode 100644 .github/workflows/ci_ol8.yml delete mode 100644 .github/workflows/ci_ubuntu.yml create mode 100644 .github/workflows/dev-ci.yml create mode 100644 .github/workflows/full-ci.yml delete mode 100644 .github/workflows/maven.yml delete mode 100644 .github/workflows/qa_pr_cpp_centos7.yml delete mode 100644 .github/workflows/qa_pr_cpp_ol8.yml delete mode 100644 .github/workflows/qa_pr_cpp_ubuntu.yml create mode 100644 .github/workflows/release-ci.yml diff --git a/.github/workflows/ci_centos7.yml b/.github/workflows/ci_centos7.yml deleted file mode 100644 index 5f45611f..00000000 --- a/.github/workflows/ci_centos7.yml +++ /dev/null @@ -1,99 +0,0 @@ -name: CI-cpp-centos7 - -on: - workflow_dispatch: {} - pull_request: - types: [opened, ready_for_review, reopened] - push: - paths: - - 'metrix-simulator/**' - - '.github/workflows/ci_centos7.yml' - release: - types: [published] - -# 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 - -defaults: - run: - shell: bash - -env: - ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true - -jobs: - linux: - name: Tests 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: Setup cmake - uses: jwlawson/actions-setup-cmake@v1.13 - 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-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 -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-centos7 --target install --parallel 2 - - - name: Tests - run: cd $GITHUB_WORKSPACE/metrix-simulator/build-centos7 && ctest -j2 --output-on-failure \ No newline at end of file diff --git a/.github/workflows/ci_ol8.yml b/.github/workflows/ci_ol8.yml deleted file mode 100644 index 61802d39..00000000 --- a/.github/workflows/ci_ol8.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: CI-cpp-ol8 - -on: - workflow_dispatch: {} - pull_request: - types: [opened, ready_for_review, reopened] - push: - paths: - - 'metrix-simulator/**' - - '.github/workflows/ci_ol8.yml' - release: - types: [published] - -# 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 - -defaults: - run: - shell: bash - -jobs: - linux: - name: Tests C++ Oracle Linux 8 - runs-on: ubuntu-latest - container: 'oraclelinux:8' - steps: - - name: Install Boost - run: | - yum update -y - yum install cmake make gcc gcc-c++ which git - dnf --enablerepo=ol8_codeready_builder install boost-static - - - name: Checkout sources - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - - - name: Configure 3rd parties - run: > - cmake -S $GITHUB_WORKSPACE/metrix-simulator/external -B $GITHUB_WORKSPACE/metrix-simulator/build-ol8/external - - - name: Build 3rd parties - run: > - cmake --build $GITHUB_WORKSPACE/metrix-simulator/build-ol8/external --parallel 2 - - - name: Configure CMake - run: > - cmake -Wno-dev -S $GITHUB_WORKSPACE/metrix-simulator -B $GITHUB_WORKSPACE/metrix-simulator/build-ol8 - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/metrix-simulator/build-ol8/install - - - name: Build - run: cmake --build $GITHUB_WORKSPACE/metrix-simulator/build-ol8 --target install --parallel 2 - - - name: Tests - run: cd $GITHUB_WORKSPACE/metrix-simulator/build-ol8 && ctest -j8 --output-on-failure \ No newline at end of file diff --git a/.github/workflows/ci_ubuntu.yml b/.github/workflows/ci_ubuntu.yml deleted file mode 100644 index e4e2a3aa..00000000 --- a/.github/workflows/ci_ubuntu.yml +++ /dev/null @@ -1,132 +0,0 @@ -name: CI-cpp-ubuntu - -on: - workflow_dispatch: {} - pull_request: - types: [opened, ready_for_review, reopened] - push: - paths: - - 'metrix-simulator/**' - - '.github/workflows/ci_ubuntu.yml' - release: - types: [published] - -# 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 - -defaults: - run: - shell: bash - -jobs: - linux: - name: Tests C++ Ubuntu - runs-on: ubuntu-latest - steps: - - name: Install Boost - run: | - sudo apt-get update -y - sudo apt-get install -y libboost-all-dev - - - name: Checkout sources - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - - - name: Configure 3rd parties - run: > - cmake -S $GITHUB_WORKSPACE/metrix-simulator/external -B $GITHUB_WORKSPACE/metrix-simulator/build-linux/external - - - name: Build 3rd parties - run: > - cmake --build $GITHUB_WORKSPACE/metrix-simulator/build-linux/external --parallel 2 - - - name: Configure CMake - run: > - cmake -Wno-dev -S $GITHUB_WORKSPACE/metrix-simulator -B $GITHUB_WORKSPACE/metrix-simulator/build-linux - -DCMAKE_BUILD_TYPE=Release - -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/metrix-simulator/build-linux/install - - - name: Build - run: cmake --build $GITHUB_WORKSPACE/metrix-simulator/build-linux --target install --parallel 2 - - - name: Tests - run: cd $GITHUB_WORKSPACE/metrix-simulator/build-linux && ctest -j8 --output-on-failure - - qa: - name: Short QA C++ Ubuntu - runs-on: ubuntu-latest - steps: - - name: Install Java 17 - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 - with: - distribution: 'temurin' - java-version: '17' - - - 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@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - - - 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: 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 \ No newline at end of file diff --git a/.github/workflows/dev-ci.yml b/.github/workflows/dev-ci.yml new file mode 100644 index 00000000..e96cde98 --- /dev/null +++ b/.github/workflows/dev-ci.yml @@ -0,0 +1,375 @@ +name: Dev CI + +on: + workflow_dispatch: + inputs: + generate_artifacts: + description: 'Generate and upload build artifacts' + required: true + default: false + type: boolean + pull_request: + +permissions: { } + +# 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 + +jobs: + java: + name: Build Java ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest, windows-latest, macos-latest ] + + steps: + - name: Set up JDK 17 + uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 + with: + distribution: 'temurin' + java-version: '17' + + - name: Checkout sources + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + + - name: Build with Maven (Ubuntu) + if: matrix.os == 'ubuntu-latest' + run: ./mvnw --batch-mode -Pjacoco install + + - name: Build with Maven (Windows) + if: matrix.os == 'windows-latest' + run: mvnw.cmd --batch-mode install + shell: cmd + + - name: Build with Maven (MacOS) + if: matrix.os == 'macos-latest' + run: ./mvnw --batch-mode install + + - name: Run SonarCloud analysis + if: matrix.os == 'ubuntu-latest' + run: > + ./mvnw --batch-mode -DskipTests 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: Get Maven version + if: ${{ matrix.os == 'ubuntu-latest' && github.event_name == 'workflow_dispatch' && inputs.generate_artifacts }} + run: echo "MAVEN_PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + + - name: Upload Metrix iTools archive + if: ${{ matrix.os == 'ubuntu-latest' && github.event_name == 'workflow_dispatch' && inputs.generate_artifacts }} + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # 4.3.3 + with: + name: itools-metrix-${{ env.MAVEN_PROJECT_VERSION }} + path: ${{ github.workspace }}/metrix-distribution/target/metrix + + cpp_centos7: + name: Build C++ CentOS7 + runs-on: ubuntu-latest + container: 'centos:centos7' + env: + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true + 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/actions-setup-cmake@v1.13 + with: + cmake-version: '3.22.x' + + - name: Checkout sources + uses: actions/checkout@v3 + + - 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: Tests + run: cd $GITHUB_WORKSPACE/metrix-simulator/build && ctest -j2 --output-on-failure + + - name: Upload Metrix Simulator archive + if: ${{ github.event_name == 'workflow_dispatch' && inputs.generate_artifacts }} + uses: actions/upload-artifact@v3 + with: + name: metrix-simulator-centos7 + path: | + metrix-simulator/build/install/bin + metrix-simulator/build/install/etc + + cpp_oraclelinux8: + name: Build C++ Oracle Linux 8 + runs-on: ubuntu-latest + container: 'oraclelinux:8' + steps: + - name: Install Boost + run: | + yum update -y + yum install cmake make gcc gcc-c++ which git + dnf --enablerepo=ol8_codeready_builder install boost-static + + - name: Checkout sources + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + + - 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=Release + -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/metrix-simulator/build/install + + - name: Build + run: cmake --build $GITHUB_WORKSPACE/metrix-simulator/build --target install --parallel 2 + + - name: Tests + run: cd $GITHUB_WORKSPACE/metrix-simulator/build && ctest -j2 --output-on-failure + + - name: Upload Metrix Simulator archive + if: ${{ github.event_name == 'workflow_dispatch' && inputs.generate_artifacts }} + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # 4.3.3 + with: + name: metrix-simulator-ol8 + path: | + metrix-simulator/build/install/bin + metrix-simulator/build/install/etc + + cpp_ubuntu: + name: Build C++ Ubuntu + runs-on: ubuntu-latest + steps: + - name: Install Boost + run: | + sudo apt-get update -y + sudo apt-get install -y libboost-all-dev + + - name: Checkout sources + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + + - 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=Release + -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/metrix-simulator/build/install + + - name: Build + run: cmake --build $GITHUB_WORKSPACE/metrix-simulator/build --target install --parallel 2 + + - name: Tests + run: cd $GITHUB_WORKSPACE/metrix-simulator/build && ctest -j2 --output-on-failure + + - name: Upload Metrix Simulator archive + if: ${{ github.event_name == 'workflow_dispatch' && inputs.generate_artifacts }} + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # 4.3.3 + with: + name: metrix-simulator-ubuntu + path: | + metrix-simulator/build/install/bin + metrix-simulator/build/install/etc + + cpp_ubuntu_qa: + name: Short QA C++ Ubuntu + runs-on: ubuntu-latest + steps: + - name: Install Java 17 + uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 + with: + distribution: 'temurin' + java-version: '17' + + - 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@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + + - 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 -j2 --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 + + cpp_clang_tidy: + name: Clang Tidy Report (PR only) + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' # github.base_ref exists only for PRs + steps: + - name: Install Boost + run: | + sudo apt-get update -y + sudo apt-get install -y libboost-all-dev + + - name: Install clang-tidy + run: | + sudo apt install -y clang-tidy-15 + sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-15 100 + + - name: Checkout sources + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + + - name: Git fetch base_ref and head_ref + run: | + git fetch --no-tags --depth=1 origin ${{ github.base_ref }} ${{ github.head_ref }} + git show-ref + + - 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 -S $GITHUB_WORKSPACE/metrix-simulator -B $GITHUB_WORKSPACE/metrix-simulator/build + -DCMAKE_BUILD_TYPE=Debug + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + + - name: Generate Clang Tidy Report (Modified C++ sources only) + id: clang-pr + run: | + REPORT_NAME="clang_tidy_report_pr.txt" + REPORT_PATH="$PWD/${REPORT_NAME}" + export METRIX_CPP_SOURCES=$(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 "$METRIX_CPP_SOURCES" ]; then + clang-tidy $METRIX_CPP_SOURCES -p $GITHUB_WORKSPACE/metrix-simulator/build > $REPORT_NAME || true + echo "report_exists=true" >> "$GITHUB_OUTPUT" + echo "report_name=$REPORT_NAME" >> "$GITHUB_OUTPUT" + echo "report_path=$REPORT_PATH" >> "$GITHUB_OUTPUT" + else + echo "No C++ source file modification found in this PR, no Clang Tidy report will be generated" + fi + + - name: Upload Clang Tidy Report (Modified C++ sources in PR) + if: steps.clang-pr.outputs.report_exists + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # 4.3.3 + with: + name: ${{ steps.clang-pr.outputs.report_name }} + path: ${{ steps.clang-pr.outputs.report_path }} diff --git a/.github/workflows/full-ci.yml b/.github/workflows/full-ci.yml new file mode 100644 index 00000000..ff606354 --- /dev/null +++ b/.github/workflows/full-ci.yml @@ -0,0 +1,323 @@ +name: Full CI + +on: + workflow_dispatch: + push: + branches: + - main + - 'release-v**' + - 'full-sonar-analysis-**' + tags: + - 'v[0-9]+.[0-9]+.[0-9]+*' + +permissions: { } + +# 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 + +jobs: + java: + name: Build Java ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ ubuntu-latest, windows-latest, macos-latest ] + + steps: + - name: Set up JDK 17 + uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 + with: + distribution: 'temurin' + java-version: '17' + + - name: Checkout sources + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + + - name: Build with Maven (Ubuntu) + if: matrix.os == 'ubuntu-latest' + run: ./mvnw --batch-mode -Pjacoco install + + - name: Build with Maven (Windows) + if: matrix.os == 'windows-latest' + run: mvnw.cmd --batch-mode install + shell: cmd + + - name: Build with Maven (MacOS) + if: matrix.os == 'macos-latest' + run: ./mvnw --batch-mode install + + - name: Run SonarCloud analysis + if: matrix.os == 'ubuntu-latest' + run: > + ./mvnw --batch-mode -DskipTests 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 }} + + cpp_centos7: + name: Build C++ CentOS7 + runs-on: ubuntu-latest + container: 'centos:centos7' + env: + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true + 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/actions-setup-cmake@v1.13 + with: + cmake-version: '3.22.x' + + - name: Checkout sources + uses: actions/checkout@v3 + + - 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: Tests + run: cd $GITHUB_WORKSPACE/metrix-simulator/build && ctest -j2 --output-on-failure + + cpp_oraclelinux8: + name: Build C++ Oracle Linux 8 + runs-on: ubuntu-latest + container: 'oraclelinux:8' + steps: + - name: Install Boost + run: | + yum update -y + yum install cmake make gcc gcc-c++ which git + dnf --enablerepo=ol8_codeready_builder install boost-static + + - name: Checkout sources + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + + - 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=Release + -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/metrix-simulator/build/install + + - name: Build + run: cmake --build $GITHUB_WORKSPACE/metrix-simulator/build --target install --parallel 2 + + - name: Tests + run: cd $GITHUB_WORKSPACE/metrix-simulator/build && ctest -j2 --output-on-failure + + cpp_ubuntu: + name: Build C++ Ubuntu + runs-on: ubuntu-latest + steps: + - name: Install Boost + run: | + sudo apt-get update -y + sudo apt-get install -y libboost-all-dev + + - name: Checkout sources + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + + - 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=Release + -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/metrix-simulator/build/install + + - name: Build + run: cmake --build $GITHUB_WORKSPACE/metrix-simulator/build --target install --parallel 2 + + - name: Tests + run: cd $GITHUB_WORKSPACE/metrix-simulator/build && ctest -j2 --output-on-failure + + cpp_ubuntu_qa: + name: Full QA C++ Ubuntu + runs-on: ubuntu-latest + steps: + - name: Install Java 17 + uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 + with: + distribution: 'temurin' + java-version: '17' + + - 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@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + + - 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=ON + -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 -j2 --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 + + cpp_clang_tidy: + name: Clang Tidy Report + runs-on: ubuntu-latest + steps: + - name: Install Boost + run: | + sudo apt-get update -y + sudo apt-get install -y libboost-all-dev + + - name: Install clang-tidy + run: | + sudo apt install -y clang-tidy-15 + sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-15 100 + + - name: Checkout sources + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + + - 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 -S $GITHUB_WORKSPACE/metrix-simulator -B $GITHUB_WORKSPACE/metrix-simulator/build + -DCMAKE_BUILD_TYPE=Debug + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + + - name: Generate Clang Tidy Report (All C++ sources) + id: clang-pr + run: | + REPORT_NAME="clang_tidy_report_all.txt" + REPORT_PATH="$PWD/${REPORT_NAME}" + export METRIX_CPP_SOURCES=$(find metrix-simulator/log/ metrix-simulator/src/ -type f | grep -E ".*(metrix-simulator/src|metrix-simulator/log).*\.(cpp|hpp)$") + clang-tidy $METRIX_CPP_SOURCES -p $GITHUB_WORKSPACE/metrix-simulator/build > $REPORT_NAME || true + + - name: Upload Clang Tidy Report (All C++ sources) + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # 4.3.3 + with: + name: ${{ steps.clang-pr.outputs.report_name }} + path: ${{ steps.clang-pr.outputs.report_path }} diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml deleted file mode 100644 index acfdbc8a..00000000 --- a/.github/workflows/maven.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: CI-java - -on: - push: - branches: - - 'main' - - 'release-v**' - - 'full-sonar-analysis-**' - pull_request: - release: - types: [published] - -permissions: {} - -# 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 - -jobs: - build: - name: Build Java on OS ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - - steps: - - name: Set up JDK 17 - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 - with: - distribution: 'temurin' - java-version: '17' - - - name: Checkout sources - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - - - name: Build with Maven (Ubuntu) - if: matrix.os == 'ubuntu-latest' - run: ./mvnw --batch-mode -Pjacoco install - - - name: Build with Maven (Windows) - if: matrix.os == 'windows-latest' - run: mvnw.cmd --batch-mode install - shell: cmd - - - name: Build with Maven (MacOS) - if: matrix.os == 'macos-latest' - run: ./mvnw --batch-mode install - - - name: Run SonarCloud analysis - if: matrix.os == 'ubuntu-latest' - run: > - ./mvnw --batch-mode -DskipTests 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 deleted file mode 100644 index 650b0ab0..00000000 --- a/.github/workflows/qa_pr_cpp_centos7.yml +++ /dev/null @@ -1,350 +0,0 @@ -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/actions-setup-cmake@v1.13 - 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/actions-setup-cmake@v1.13 - 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/actions-setup-cmake@v1.13 - 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 \ No newline at end of file diff --git a/.github/workflows/qa_pr_cpp_ol8.yml b/.github/workflows/qa_pr_cpp_ol8.yml deleted file mode 100644 index 87c51050..00000000 --- a/.github/workflows/qa_pr_cpp_ol8.yml +++ /dev/null @@ -1,209 +0,0 @@ -name: QA-PR-CPP-OL8 - -on: - workflow_dispatch: - pull_request: - types: [opened, ready_for_review, reopened] - release: - types: [published] - push: - paths: - - '.github/workflows/qa_pr_cpp_ol8.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 - -defaults: - run: - shell: bash - -jobs: - clang-tidy: - name: Clang-tidy Oracle Linux 8 - runs-on: ubuntu-latest - container: 'oraclelinux:8' - steps: - - name: Install Boost - run: | - yum update -y - yum install cmake make gcc gcc-c++ which git - dnf --enablerepo=ol8_codeready_builder install boost-static - - - name: Install clang-tidy - run: | - yum install -y llvm-toolset - - - name: Checkout sources - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - - - name: Configure 3rd parties - run: > - cmake -S $GITHUB_WORKSPACE/metrix-simulator/external -B $GITHUB_WORKSPACE/metrix-simulator/build-ol8/external - - - name: Build 3rd parties - run: > - cmake --build $GITHUB_WORKSPACE/metrix-simulator/build-ol8/external --parallel 2 - - - name: Configure CMake - run: > - cmake -S $GITHUB_WORKSPACE/metrix-simulator -B $GITHUB_WORKSPACE/metrix-simulator/build-ol8 - -DCMAKE_BUILD_TYPE=Debug - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - - - name: Clang Tidy PR - id: clang-pr - if: github.event_name == 'pull_request' - run: | - REPORT_NAME="clang_tidy_report_ol8.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-ol8 > $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@65462800fd760344b1a7b4382951275a0abb4808 # 4.3.3 - with: - name: ${{ steps.clang-pr.outputs.report_name }} - path: ${{ steps.clang-pr.outputs.report_path }} - - qa: - name: Full QA C++ Oracle Linux 8 - runs-on: ubuntu-latest - container: 'oraclelinux:8' - steps: - - name: Install Dependencies - run: | - yum update -y - yum install cmake make gcc gcc-c++ which git wget zip - dnf --enablerepo=ol8_codeready_builder install boost-static - yum install -y python3 python3-pip - - - name: Install Java 17 - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 - 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: 5.0.1.3006 - - - name: Checkout sources - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - - - 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 - -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 Oracle Linux 8 - runs-on: ubuntu-latest - container: 'oraclelinux:8' - needs: qa - if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' - steps: - - name: Install Dependencies - run: | - yum update -y - yum install cmake make gcc gcc-c++ which git wget zip - dnf --enablerepo=ol8_codeready_builder install boost-static - - - name: Checkout sources - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - - - 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=Release - -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/metrix-simulator/build/install - - - 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-ol8" - 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@65462800fd760344b1a7b4382951275a0abb4808 # 4.3.3 - 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@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # 2.0.4 - if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/') - with: - files: ${{ steps.metrix-install.outputs.archive_name }}.zip \ No newline at end of file diff --git a/.github/workflows/qa_pr_cpp_ubuntu.yml b/.github/workflows/qa_pr_cpp_ubuntu.yml deleted file mode 100644 index a48200de..00000000 --- a/.github/workflows/qa_pr_cpp_ubuntu.yml +++ /dev/null @@ -1,222 +0,0 @@ -name: QA-PR-CPP-UBUNTU - -on: - workflow_dispatch: - pull_request: - types: [opened, ready_for_review, reopened] - release: - types: [published] - push: - paths: - - '.github/workflows/qa_pr_cpp_ubuntu.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 - -defaults: - run: - shell: bash - -jobs: - clang-tidy: - name: Clang-tidy Ubuntu - runs-on: ubuntu-latest - steps: - - name: Install Boost - run: | - sudo apt-get update -y - sudo apt-get install -y libboost-all-dev - - - name: Install clang-tidy - run: | - sudo apt install -y clang-tidy-15 - sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-15 100 - - - name: Checkout sources - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - - - 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 -S $GITHUB_WORKSPACE/metrix-simulator -B $GITHUB_WORKSPACE/metrix-simulator/build - -DCMAKE_BUILD_TYPE=Debug - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - - - name: Clang Tidy PR - id: clang-pr - if: github.event_name == 'pull_request' - run: | - REPORT_NAME="clang_tidy_report_ubuntu.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 > $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@65462800fd760344b1a7b4382951275a0abb4808 # 4.3.3 - 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_ubuntu.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 - 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++ Ubuntu - runs-on: ubuntu-latest - steps: - - name: Install Java 17 - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 - with: - distribution: 'temurin' - java-version: '17' - - - 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@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - - - 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 - -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: 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 - - release: - name: Release Ubuntu - runs-on: ubuntu-latest - needs: qa - if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' - steps: - - name: Install Boost - run: | - sudo apt-get update -y - sudo apt-get install -y libboost-all-dev - - - name: Checkout sources - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - - - 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=Release - -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/metrix-simulator/build/install - - - 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-ubuntu" - 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@65462800fd760344b1a7b4382951275a0abb4808 # 4.3.3 - 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@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # 2.0.4 - if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/') - with: - files: ${{ steps.metrix-install.outputs.archive_name }}.zip \ No newline at end of file diff --git a/.github/workflows/release-ci.yml b/.github/workflows/release-ci.yml new file mode 100644 index 00000000..3729a9a7 --- /dev/null +++ b/.github/workflows/release-ci.yml @@ -0,0 +1,217 @@ +name: Release CI + +on: + release: + types: + - created + +permissions: + contents: write + +jobs: + java: + name: Package Java + runs-on: ubuntu-latest + + steps: + - name: Set up JDK 17 + uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 + with: + distribution: 'temurin' + java-version: '17' + + - name: Checkout sources + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + + - name: Package with Maven + run: ./mvnw --batch-mode package + + - name: Upload release package + uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9 + with: + files: ./metrix-distribution/target/itools-metrix.zip + + cpp_centos7: + name: Package C++ CentOS7 + runs-on: ubuntu-latest + container: 'centos:centos7' + env: + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true + 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/actions-setup-cmake@v1.13 + with: + cmake-version: '3.22.x' + + - name: Checkout sources + uses: actions/checkout@v3 + + - 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: Tests + run: cd $GITHUB_WORKSPACE/metrix-simulator/build && ctest -j2 --output-on-failure + + - name: Prepare Metrix package + 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 release package + uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1 (nb: v0.1.15) + with: + files: ${{ steps.metrix-install.outputs.archive_path }}.zip + + cpp_oraclelinux8: + name: Package C++ Oracle Linux 8 + runs-on: ubuntu-latest + container: 'oraclelinux:8' + steps: + - name: Install Boost + run: | + yum update -y + yum install cmake make gcc gcc-c++ which git zip + dnf --enablerepo=ol8_codeready_builder install boost-static + + - name: Checkout sources + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + + - 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=Release + -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/metrix-simulator/build/install + + - name: Build + run: cmake --build $GITHUB_WORKSPACE/metrix-simulator/build --target install --parallel 2 + + - name: Tests + run: cd $GITHUB_WORKSPACE/metrix-simulator/build && ctest -j2 --output-on-failure + + - name: Prepare Metrix package + id: metrix-install + run: | + ARCHIVE_NAME="metrix-simulator-ol8" + 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 release package + uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9 + with: + files: ${{ steps.metrix-install.outputs.archive_path }}.zip + + cpp_ubuntu: + name: Package C++ Ubuntu + runs-on: ubuntu-latest + steps: + - name: Install Boost + run: | + sudo apt-get update -y + sudo apt-get install -y libboost-all-dev + + - name: Checkout sources + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 + + - 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=Release + -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/metrix-simulator/build/install + + - name: Build + run: cmake --build $GITHUB_WORKSPACE/metrix-simulator/build --target install --parallel 2 + + - name: Tests + run: cd $GITHUB_WORKSPACE/metrix-simulator/build && ctest -j2 --output-on-failure + + - name: Prepare Metrix package + id: metrix-install + run: | + ARCHIVE_NAME="metrix-simulator-ubuntu" + 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 release package + uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9 + with: + files: ${{ steps.metrix-install.outputs.archive_path }}.zip