From f9903a3ff351ad635fb2487d19f81a2076d98fee Mon Sep 17 00:00:00 2001 From: manjunathb4461 Date: Thu, 27 Jun 2024 11:18:19 +0200 Subject: [PATCH] test ci-sonarqube-ts --- .github/workflows/ci-sonarqube.yml | 24 +++++++ .github/workflows/integration_gauntlet.yml | 2 +- .github/workflows/sonar-scan.yml | 79 ++-------------------- 3 files changed, 29 insertions(+), 76 deletions(-) create mode 100644 .github/workflows/ci-sonarqube.yml diff --git a/.github/workflows/ci-sonarqube.yml b/.github/workflows/ci-sonarqube.yml new file mode 100644 index 00000000..4b78d5d8 --- /dev/null +++ b/.github/workflows/ci-sonarqube.yml @@ -0,0 +1,24 @@ +name: CI Sonarqube + +on: + pull_request: + branches: + - '**' + +jobs: + ci-sonarqube: + needs: [ci-lint, ci-test] + if: ${{ always() }} + runs-on: ubuntu-latest + steps: + - name: ci-sonarqube + uses: smartcontractkit/.github/actions/ci-sonarqube@5b1046c28343660ecb84844c6fa95a66d1cdb52e # ci-sonarqube@0.3.2 + with: + # grafana inputs + metrics-job-name: ci-sonarqube + gc-basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} + gc-host: ${{ secrets.GRAFANA_INTERNAL_HOST }} + gc-org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }} + # sonarqube inputs + sonar-token: ${{ secrets.SONAR_TOKEN }} + sonar-host-url: ${{ secrets.SONAR_HOST_URL }} diff --git a/.github/workflows/integration_gauntlet.yml b/.github/workflows/integration_gauntlet.yml index 069bd92c..3b9ea08f 100644 --- a/.github/workflows/integration_gauntlet.yml +++ b/.github/workflows/integration_gauntlet.yml @@ -31,7 +31,7 @@ jobs: if: always() uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 with: - name: gauntlet-eslint-report + name: ts-lint-results path: ./eslint-report.json integration_gauntlet_run_tests: diff --git a/.github/workflows/sonar-scan.yml b/.github/workflows/sonar-scan.yml index 4d3a1a44..e9ec6ec1 100644 --- a/.github/workflows/sonar-scan.yml +++ b/.github/workflows/sonar-scan.yml @@ -32,79 +32,8 @@ jobs: runs-on: ubuntu-latest if: always() steps: - - name: Checkout the repo - uses: actions/checkout@v4 - with: - fetch-depth: 0 # fetches all history for all tags and branches to provide more metadata for sonar reports - - - name: Download Golangci unit tests reports - uses: dawidd6/action-download-artifact@93c629661111aae296c04004b30ae3ba22ed46f3 # v5 - with: - workflow: relayer.yml - workflow_conclusion: "" - name_is_regexp: true - name: go-unit-tests-results - if_no_artifact_found: warn - - - name: Download Golangci Relayer report - uses: dawidd6/action-download-artifact@93c629661111aae296c04004b30ae3ba22ed46f3 # v5 - with: - workflow: golangci-lint.yml - workflow_conclusion: "" - name_is_regexp: true - name: golangci-lint-relayer-report - if_no_artifact_found: warn - - - name: Download Golangcio Ops report - uses: dawidd6/action-download-artifact@93c629661111aae296c04004b30ae3ba22ed46f3 # v5 - with: - workflow: golangci-lint.yml - workflow_conclusion: "" - name_is_regexp: true - name: golangci-lint-ops-report - if_no_artifact_found: warn - - - name: Download Golangci-lint Integration tests report - uses: dawidd6/action-download-artifact@93c629661111aae296c04004b30ae3ba22ed46f3 # v5 + - name: ci-sonarqube + uses: smartcontractkit/.github/actions/ci-sonarqube-ts@7878f06999495f9e736183f8805a4909379acf52 # ci-sonarqube-ts@0.0.0 with: - workflow: golangci-lint.yml - workflow_conclusion: "" - name_is_regexp: true - name: golangci-lint-integration-tests-report - if_no_artifact_found: warn - - - name: Download gauntlet eslint reports - uses: dawidd6/action-download-artifact@93c629661111aae296c04004b30ae3ba22ed46f3 # v5 - with: - workflow: integration_gauntlet.yml - workflow_conclusion: "" - name_is_regexp: true - name: gauntlet-eslint-report - if_no_artifact_found: warn - - - name: Set SonarQube Report Paths - id: sonarqube_report_paths - shell: bash - run: | - { - echo "sonarqube_tests_report_paths=$(find . -type f -name output.txt | paste -sd "," -)" - echo "sonarqube_coverage_report_paths=$(find . -type f -name '*coverage.txt' | paste -sd "," -)" - echo "sonarqube_golangci_report_paths=$(find . -type f -name 'golangci-*-report.xml' -printf "%p,")" - echo "sonarqube_eslint_report_paths=$(find -type f -name 'eslint-report.json' -printf "%p")" >> $GITHUB_OUTPUT - } >> "$GITHUB_OUTPUT" - - - name: Update ESLint report symlinks - continue-on-error: true - run: sed -i 's+/home/runner/work/feeds-manager/feeds-manager/+/github/workspace/+g' ${{ steps.sonarqube_report_paths.outputs.sonarqube_eslint_report_paths }} - - - name: SonarQube Scan - uses: sonarsource/sonarqube-scan-action@86fe81775628f1c6349c28baab87881a2170f495 # v2.1.0 - with: - args: > - -Dsonar.go.tests.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_tests_report_paths }} - -Dsonar.go.coverage.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_coverage_report_paths }} - -Dsonar.go.golangci-lint.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_golangci_report_paths }} - -Dsonar.eslint.reportPaths=${{ steps.sonarqube_report_paths.outputs.sonarqube_eslint_report_paths }} - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + sonar-token: ${{ secrets.SONAR_TOKEN }} + sonar-host-url: ${{ secrets.SONAR_HOST_URL }}