From 61b13b384899f17dccefb595ca4a2a8ae34b2fa4 Mon Sep 17 00:00:00 2001 From: Cameron Gilbert Date: Fri, 13 Oct 2023 11:46:01 -0400 Subject: [PATCH] fix(fix): sonarqube --- .github/workflows/test-ts-sdk.yaml | 12 ++++++++++-- jest.config.js | 2 +- sonar-project.properties | 15 +++++++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 sonar-project.properties diff --git a/.github/workflows/test-ts-sdk.yaml b/.github/workflows/test-ts-sdk.yaml index a1e7f8b9..2a3890a5 100644 --- a/.github/workflows/test-ts-sdk.yaml +++ b/.github/workflows/test-ts-sdk.yaml @@ -2,10 +2,10 @@ name: ⛓️ Tests @nibiruchain/ts-sdk on: pull_request: - branches: ["main", "releases/*"] + branches: ["releases/*"] paths: ["**.js", "**.ts", "**.tsx", "**.json"] push: - branches: ["main", "releases/*"] + branches: ["releases/*"] paths: ["**.js", "**.ts", "**.tsx", "**.json"] jobs: @@ -24,6 +24,8 @@ jobs: steps: - name: Check out the repo uses: actions/checkout@v3 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - name: Install nibid run: curl -s https://get.nibiru.fi/@v0.21.9! | bash @@ -56,3 +58,9 @@ jobs: - name: Jest Coverage Comment uses: MishaKav/jest-coverage-comment@main + + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/jest.config.js b/jest.config.js index c22fc27e..05054ef1 100644 --- a/jest.config.js +++ b/jest.config.js @@ -40,7 +40,7 @@ module.exports = function (root = __dirname) { // A list of reporter names that Jest uses when writing coverage reports // coverageReporters: ['json', 'html', 'lcov', 'text'], - coverageReporters: ["json-summary", "text", "html"], + coverageReporters: ["json-summary", "text", "html", "lcov"], // An object that configures minimum threshold enforcement for coverage results coverageThreshold: { diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..75e50951 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,15 @@ +sonar.projectKey=NibiruChain_ts-sdk +sonar.organization=nibiruchain + +sonar.javascript.lcov.reportPaths=./coverage/lcov.info + +# This is the name and version displayed in the SonarCloud UI. +#sonar.projectName=ts-sdk +#sonar.projectVersion=1.0 + + +# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. +#sonar.sources=. + +# Encoding of the source code. Default is default system encoding +#sonar.sourceEncoding=UTF-8