From bbdd1090a125af343dabc63e35cb7000c0c1dc41 Mon Sep 17 00:00:00 2001 From: edwin-focaloid Date: Fri, 13 Oct 2023 08:56:44 +0530 Subject: [PATCH 1/3] feat: adding github action for sonar and added sonar property file --- .github/workflows/sonar.yml | 41 +++++++++++++++++++++++++++++++++++++ sonar-project.properties | 1 + 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/sonar.yml create mode 100644 sonar-project.properties diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml new file mode 100644 index 00000000..1a7a4788 --- /dev/null +++ b/.github/workflows/sonar.yml @@ -0,0 +1,41 @@ +name: Sonarqube_CI +on: + + push: + branches: + - master + - main + - develop + + pull_request: + types: [opened, synchronize, reopened] + branches: + - '**' + workflow_dispatch: + +jobs: + build: + name: Sonarqube_CI + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Sonarqube scan + uses: sonarsource/sonarqube-scan-action@master + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + + # Job will fail when the Quality Gate is red + - name: Sonarqube quality gate check + id: sonarqube-quality-gate-check + uses: sonarsource/sonarqube-quality-gate-action@master + timeout-minutes: 5 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + + - name: "Example show SonarQube Quality Gate Status value" + run: echo "The Quality Gate status is ${{ steps.sonarqube-quality-gate-check.outputs.quality-gate-status }}" diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..cdc741e7 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1 @@ +sonar.projectKey=expr-eval From b4bf8570f4a0798ccdd866cfe51f2cd04797c467 Mon Sep 17 00:00:00 2001 From: Edwin Sany Date: Mon, 15 Apr 2024 21:50:53 +0530 Subject: [PATCH 2/3] fix: update sonarqube workflow to reduce runner minutes --- .github/workflows/sonar.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index 1a7a4788..d1cd6708 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -1,21 +1,20 @@ name: Sonarqube_CI on: + pull_request: + types: + - labeled + push: branches: - master - main - - develop - - pull_request: - types: [opened, synchronize, reopened] - branches: - - '**' - workflow_dispatch: + - release-* jobs: build: name: Sonarqube_CI + if: ${{ github.event.label.name == 'sonar_check' || github.event_name == 'push' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -26,11 +25,11 @@ jobs: uses: sonarsource/sonarqube-scan-action@master env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + SONAR_HOST_URL: 'https://sonarqube.taotesting.info/sonarqube/' # Job will fail when the Quality Gate is red - name: Sonarqube quality gate check - id: sonarqube-quality-gate-check + id: sonarqube-quality-gate-check uses: sonarsource/sonarqube-quality-gate-action@master timeout-minutes: 5 env: @@ -38,4 +37,4 @@ jobs: - name: "Example show SonarQube Quality Gate Status value" - run: echo "The Quality Gate status is ${{ steps.sonarqube-quality-gate-check.outputs.quality-gate-status }}" + run: echo "The Quality Gate status is ${{ steps.sonarqube-quality-gate-check.outputs.quality-gate-status }}" \ No newline at end of file From d5afac6476f46e15fe02b246318176d63f2d1583 Mon Sep 17 00:00:00 2001 From: rahulfoc1990 Date: Fri, 6 Sep 2024 11:55:42 +0530 Subject: [PATCH 3/3] fix: update depreacted actions --- .github/workflows/continuous-integration.yml | 8 ++++---- .github/workflows/release-package.yml | 2 +- .github/workflows/sonar.yml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 0c2126ee..1658be52 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -11,7 +11,7 @@ jobs: code-check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: token: ${{ secrets.GH_TOKEN }} - run: git fetch --tags --unshallow @@ -20,7 +20,7 @@ jobs: uses: oat-sa/conventional-commit-action@v0 with: github_token: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v4 with: node-version: 18.x registry-url: https://registry.npmjs.org @@ -34,7 +34,7 @@ jobs: npm run coverage:clover - name: Report coverage if: always() - uses: slavcodev/coverage-monitor-action@v1 + uses: slavcodev/coverage-monitor-action@1.9.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} coverage_path: coverage/clover.xml @@ -47,7 +47,7 @@ jobs: - name: Annotate Code Linting Results if: always() continue-on-error: true - uses: ataylorme/eslint-annotate-action@1.2.0 + uses: ataylorme/eslint-annotate-action@2.2.0 with: repo-token: '${{ secrets.GITHUB_TOKEN }}' report-json: 'eslint_report.json' diff --git a/.github/workflows/release-package.yml b/.github/workflows/release-package.yml index 5fb0326c..d4a2f878 100644 --- a/.github/workflows/release-package.yml +++ b/.github/workflows/release-package.yml @@ -14,7 +14,7 @@ jobs: steps: - name: Clone the repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 #avoid unrelated history error token: ${{ secrets.SEMVER_GH_TOKEN }} #bypass branch protection rule diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index d1cd6708..5cf09793 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -17,7 +17,7 @@ jobs: if: ${{ github.event.label.name == 'sonar_check' || github.event_name == 'push' }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0