From 9b227a881687c093f57d11cd610cac5ef5160c44 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 15 Nov 2023 17:12:02 +0100 Subject: [PATCH] sonar --- .github/actions/setup-sonar-tools/action.yml | 33 +++++++++++++------- .github/workflows/test_python_cplusplus.yml | 19 ++--------- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/.github/actions/setup-sonar-tools/action.yml b/.github/actions/setup-sonar-tools/action.yml index b9ef5c0dd5..d791c120bf 100644 --- a/.github/actions/setup-sonar-tools/action.yml +++ b/.github/actions/setup-sonar-tools/action.yml @@ -1,15 +1,26 @@ -name: Install apt dependencies -description: Install apt dependencies for the AMICI Python package +name: Set up Sonar tools +description: Download and install sonar-scanner and build-wrapper runs: using: "composite" steps: - - run: | - sudo apt-get update \ - && sudo apt-get install -y \ - libatlas-base-dev \ - libboost-chrono-dev \ - libboost-math-dev \ - libboost-serialization-dev \ - libhdf5-serial-dev \ - swig + - run: echo "SONAR_SCANNER_VERSION=5.0.1.3006" >> $GITHUB_ENV + shell: bash + - run: echo "SONAR_SCANNER_HOME=${HOME}/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux" >> $GITHUB_ENV + shell: bash + - run: echo "SONAR_SCANNER_OPTS=-server" >> $GITHUB_ENV + shell: bash + - run: echo "${SONAR_SCANNER_HOME}/bin" >> $GITHUB_PATH + shell: bash + - run: echo "${HOME}/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH + shell: bash + + - name: Install sonarcloud tools + run: | + sudo apt-get install nodejs curl unzip \ + && curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip \ + https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip \ + && unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ \ + && curl --create-dirs -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip \ + https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip \ + && unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/ \ shell: bash diff --git a/.github/workflows/test_python_cplusplus.yml b/.github/workflows/test_python_cplusplus.yml index a1b68cfc1f..546b297712 100644 --- a/.github/workflows/test_python_cplusplus.yml +++ b/.github/workflows/test_python_cplusplus.yml @@ -35,23 +35,8 @@ jobs: - run: echo "AMICI_DIR=$(pwd)" >> $GITHUB_ENV - run: echo "BNGPATH=${GITHUB_WORKSPACE}/ThirdParty/BioNetGen-2.7.0" >> $GITHUB_ENV - # sonar cloud - - run: echo "SONAR_SCANNER_VERSION=5.0.1.3006" >> $GITHUB_ENV - - run: echo "SONAR_SCANNER_HOME=${HOME}/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux" >> $GITHUB_ENV - - run: echo "SONAR_SCANNER_OPTS=-server" >> $GITHUB_ENV - - run: echo "${SONAR_SCANNER_HOME}/bin" >> $GITHUB_PATH - - run: echo "${HOME}/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH - - # TODO: add to ci image - - name: Install sonarcloud tools - run: | - sudo apt-get install nodejs curl unzip \ - && curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip \ - https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip \ - && unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ \ - && curl --create-dirs -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip \ - https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip \ - && unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/ \ + - name: Set up Sonar tools + uses: ./.github/actions/setup-sonar-tools - name: Install apt dependencies uses: ./.github/actions/install-apt-dependencies