From 1bea9867751b8776a4542c6ace95d2a2e3b683cf Mon Sep 17 00:00:00 2001 From: Akash Date: Wed, 30 Oct 2024 12:39:39 +0000 Subject: [PATCH] added --- .github/workflows/coverage.yml | 22 +--------------------- .github/workflows/sonarcube.yml | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/sonarcube.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 09b76178..15a7e8a4 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -80,24 +80,4 @@ jobs: git pull origin ${{ github.head_ref }} git add /home/runner/work/immunisation-batch/immunisation-batch/coverage_html_report/*.xml git commit -m "Add coverage index as XML" - git push origin ${{ github.head_ref }} - - - name: Install Sonar Scanner - run: | - wget -O sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-linux.zip - unzip sonar-scanner.zip - mv sonar-scanner-4.6.2.2472-linux sonar-scanner - export PATH="/home/runner/work/immunisation-batch/immunisation-batch/coverage_html_report" - - - name: Run SonarQube Scan - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - PATH: "/home/runner/work/immunisation-batch/immunisation-batch/coverage_html_report" - run: | - - ls -R /home/runner/work/immunisation-batch/immunisation-batch/coverage_html_report - sonar-scanner \ - -Dsonar.projectKey=NHSDigital_immunisation-batch \ - -Dsonar.host.url=https://sonarcloud.io \ - -Dsonar.login=$SONAR_TOKEN \ - -Dsonar.python.coverage.reportPaths=filenameprocessor_coverage.xml \ No newline at end of file + git push origin ${{ github.head_ref }} \ No newline at end of file diff --git a/.github/workflows/sonarcube.yml b/.github/workflows/sonarcube.yml new file mode 100644 index 00000000..9ce1c429 --- /dev/null +++ b/.github/workflows/sonarcube.yml @@ -0,0 +1,26 @@ +name: sonarcloud +on: pull_request +jobs: + sonar_scan: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install Sonar Scanner + run: | + wget -O sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.6.2.2472-linux.zip + unzip sonar-scanner.zip + mv sonar-scanner-4.6.2.2472-linux sonar-scanner + export PATH="${PATH}:${GITHUB_WORKSPACE}/sonar-scanner/bin" + + - name: Run SonarQube Scan + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + PATH: "${{ github.workspace }}/sonar-scanner/bin:${{ env.PATH }}" + run: | + sonar-scanner \ + -Dsonar.projectKey=NHSDigital_immunisation-batch \ + -Dsonar.host.url=https://sonarcloud.io \ + -Dsonar.login=$SONAR_TOKEN \ + -Dsonar.python.coverage.reportPaths=filenameprocessor_coverage.xml