diff --git a/.github/actions/sonarcloud/action.yml b/.github/actions/sonarcloud/action.yml new file mode 100644 index 0000000..38d3efd --- /dev/null +++ b/.github/actions/sonarcloud/action.yml @@ -0,0 +1,17 @@ +name: sonarcloud +description: SonarCloud Scan action +inputs: + sonar-token: + description: sonarToken + required: true + +runs: + using: composite + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: SonarCloud Scan + uses: SonarSource/sonarqube-scan-action@v4.2.0 + env: + SONAR_TOKEN: ${{inputs.sonar-token}} \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c843f34 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + +permissions: + id-token: write + contents: read + +jobs: + quality: + name: Quality + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Sonarcloud Scan + uses: ./.github/actions/sonarcloud + with: + sonar-token: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..7599bf4 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,23 @@ +# must be unique in a given SonarQube instance +sonar.projectKey=AlexByte18_artisan-api +sonar.organization=artisan + +# --- optional properties --- +sonar.javascript.lcov.reportPaths=**/coverage/**/lcov.info +sonar.scm.exclusions.disabled=true +sonar.scm.forceReloadAll=true + +# Path is relative to the sonar-project.properties file. Defaults to . +sonar.sources=. + +# Encoding of the source code. Default is default system encoding +sonar.sourceEncoding=UTF-8 +sonar.inclusions=**/*.ts,**/*.tsx,**/*.js,**/*.jsx,**/*.tf +sonar.exclusions=**/testHelpers/**/*,**/__tests__/**/*,**/mock*.ts,**/__mocks__/**/* +sonar.typescript.file.suffixes=.ts,.tsx + +# Coverage exclusions for specific files or folders +# Excluding artisan-api from coverage temporarily +sonar.coverage.exclusions=components/artisan-api/src/__service_tests__/**/*,components/artisan-api/src/testHelpers/**/*,components/artisan-api/scripts/**/*,components/artisan-api/**/handler.ts,components/artisan-api/src/resources/Profiles/dev-assets/index.ts +sonar.tests=. +sonar.test.inclusions=**/*.test.tsx,**/*.test.ts,**/testHelpers/**/*,**/__tests__/**/*,**/mock*.ts \ No newline at end of file