From 6a8846ba887fe6e996e670494f58ee58f62afccd Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Wed, 11 Oct 2023 10:42:45 -0400 Subject: [PATCH 1/7] Move sonar reporting to GH action --- .github/workflows/code-quality.yml | 6 ++++++ .npmignore | 1 + .sonarcloud.properties => sonar-project.properties | 3 +++ 3 files changed, 10 insertions(+) rename .sonarcloud.properties => sonar-project.properties (75%) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index d0bc9f333..2829a1e0f 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -72,3 +72,9 @@ jobs: - name: Upload coverage uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 + + - name: SonarCloud scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.npmignore b/.npmignore index ce0a6b844..4a09377e4 100644 --- a/.npmignore +++ b/.npmignore @@ -21,5 +21,6 @@ openapi-templates codecov.yml jest.config.cjs rollup.config.js +sonar-project.properties .sonarcloud.properties tsconfig.json diff --git a/.sonarcloud.properties b/sonar-project.properties similarity index 75% rename from .sonarcloud.properties rename to sonar-project.properties index bdc73bd6d..d0223174c 100644 --- a/.sonarcloud.properties +++ b/sonar-project.properties @@ -5,3 +5,6 @@ sonar.exclusions = src/**/__tests__/**/*,src/**/__helpers__/**/*,src/generated-c # Paths for tests sonar.tests = src/ sonar.test.inclusions = src/**/__tests__/**/* + +# Coverage report paths +sonar.javascript.lcov.reportPaths = coverage/ From f39c70a0dfc86a11e5fbc96b0f3c3e153002c8ea Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Wed, 11 Oct 2023 11:54:33 -0400 Subject: [PATCH 2/7] Add sonar project properties --- sonar-project.properties | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sonar-project.properties b/sonar-project.properties index d0223174c..6615fa81e 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,3 +1,6 @@ +sonar.projectKey=jellyfin_jellyfin-sdk-typescript +sonar.organization=jellyfin + # Paths for sources sonar.sources = src/ sonar.exclusions = src/**/__tests__/**/*,src/**/__helpers__/**/*,src/generated-client/**/* From 93be8ed55b80e01d2d6079fb03bfd318eae5c7b3 Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Wed, 11 Oct 2023 12:01:25 -0400 Subject: [PATCH 3/7] Fix coverage file location --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index 6615fa81e..b29c36efb 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -10,4 +10,4 @@ sonar.tests = src/ sonar.test.inclusions = src/**/__tests__/**/* # Coverage report paths -sonar.javascript.lcov.reportPaths = coverage/ +sonar.javascript.lcov.reportPaths = coverage/lcov.info From ac24b5384910201a46c2c99bc0ffcfa94ab11112 Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Wed, 11 Oct 2023 12:11:43 -0400 Subject: [PATCH 4/7] Use default coverage report location --- sonar-project.properties | 3 --- 1 file changed, 3 deletions(-) diff --git a/sonar-project.properties b/sonar-project.properties index b29c36efb..6bc449266 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -8,6 +8,3 @@ sonar.exclusions = src/**/__tests__/**/*,src/**/__helpers__/**/*,src/generated-c # Paths for tests sonar.tests = src/ sonar.test.inclusions = src/**/__tests__/**/* - -# Coverage report paths -sonar.javascript.lcov.reportPaths = coverage/lcov.info From de356d8fa6d05a23096ba4df36779ce58e992fac Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Wed, 11 Oct 2023 12:12:11 -0400 Subject: [PATCH 5/7] Pin sonar action version --- .github/workflows/code-quality.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 2829a1e0f..c777fb512 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -70,11 +70,11 @@ jobs: - name: Run jest run: npx jest --coverage --group=unit - - name: Upload coverage - uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 - - name: SonarCloud scan - uses: SonarSource/sonarcloud-github-action@master + uses: SonarSource/sonarcloud-github-action@c25d2e7e3def96d0d1781000d3c429da22cd6252 # v2.0.2 env: GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + - name: Upload coverage + uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 From 7b14c67ced3ce344d9bca13a0e18089fa49cb1bc Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Wed, 11 Oct 2023 12:16:14 -0400 Subject: [PATCH 6/7] Revert "Use default coverage report location" This reverts commit ac24b5384910201a46c2c99bc0ffcfa94ab11112. --- sonar-project.properties | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sonar-project.properties b/sonar-project.properties index 6bc449266..b29c36efb 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -8,3 +8,6 @@ sonar.exclusions = src/**/__tests__/**/*,src/**/__helpers__/**/*,src/generated-c # Paths for tests sonar.tests = src/ sonar.test.inclusions = src/**/__tests__/**/* + +# Coverage report paths +sonar.javascript.lcov.reportPaths = coverage/lcov.info From cbc9b88c6ca07cfed3de64011750e3de7f3fb030 Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Wed, 11 Oct 2023 15:19:40 -0400 Subject: [PATCH 7/7] Limit codecov/sonar runs to upstream repo --- .github/workflows/code-quality.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index c777fb512..7f0ab4e18 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -71,10 +71,12 @@ jobs: run: npx jest --coverage --group=unit - name: SonarCloud scan + if: ${{ github.repository == 'jellyfin/jellyfin-sdk-typescript' }} uses: SonarSource/sonarcloud-github-action@c25d2e7e3def96d0d1781000d3c429da22cd6252 # v2.0.2 env: GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - name: Upload coverage + if: ${{ github.repository == 'jellyfin/jellyfin-sdk-typescript' }} uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4