Skip to content

Commit

Permalink
Merge pull request #16 from fga-eps-mds/test/sonarcloud
Browse files Browse the repository at this point in the history
Update package.json
  • Loading branch information
EduardoGurgel authored Nov 10, 2023
2 parents ce01a82 + 70d81c2 commit bd69d4d
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ on:
push:
branches:
- main
- test/sonar
- test/sonarcloud
pull_request:
types: [opened, synchronize, reopened]
# types: [opened, synchronize, reopened]
jobs:
test-unit:
name: Test Unit & Scan
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/sonar_teste.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Análise de Código
on:
push:
branches:
- main
- test/sonarcloud
pull_request:
# types: [opened, synchronize, reopened]
branches:
- main
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Instala dependências
run: yarn

- name: Executa linter
run: yarn lint

- name: Executa testes e gera cobertura
run: yarn test:all

- name: Executa SonarCloud Scan
if: ${{ always() }}
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}
20 changes: 12 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"start:debug": "nest start --debug 0.0.0.0:7002 --watch --preserveWatchOutput",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest --no-cache --colors --detectOpenHandles",
"test": "jest --passWithNoTests --no-cache --runInBand",
"test:all": "CI=true npm run test -- --coverage",
"test:watch": "jest --watchAll",
"test:cov": "jest --forceExit --detectOpenHandles --runInBand --coverage --colors",
Expand Down Expand Up @@ -77,7 +77,7 @@
"@types/cors": "2.8.12",
"@types/express": "4.17.13",
"@types/express-actuator": "1.8.0",
"@types/jest": "27.0.2",
"@types/jest": "^29.5.6",
"@types/node": "18.17.0",
"@types/passport-jwt": "3.0.6",
"@types/passport-local": "1.0.34",
Expand All @@ -89,14 +89,16 @@
"eslint-config-prettier": "8.4.0",
"eslint-plugin-prettier": "4.0.0",
"graphql": "16.6.0",
"jest": "27.5.1",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"jest-sonar": "^0.2.16",
"jest-sonar-reporter": "^2.0.0",
"jest-mock-extended": "^3.0.5",
"prettier": "2.5.1",
"sonarqube-scanner": "2.8.1",
"source-map-support": "0.5.21",
"supertest": "6.2.2",
"ts-jest": "27.1.3",
"jest-sonar": "^0.2.16",
"jest-sonar-reporter": "^2.0.0",
"ts-jest": "^29.1.1",
"ts-loader": "9.2.7",
"ts-node": "10.6.0",
"tsconfig-paths": "3.12.0",
Expand All @@ -107,7 +109,7 @@
"esbenp.prettier-vscode",
"rbbit.typescript-hero"
],
"jest": {
"jest": {
"moduleFileExtensions": [
"js",
"json",
Expand Down Expand Up @@ -141,9 +143,11 @@
"jest-sonar",
{
"outputDirectory": "reports",
"outputName": "sonar-report.xml"
"outputName": "sonar-report.xml",
"reportedMetrics": ["test_errors", "test_execution_time", "test_failures", "tests", "coverage"]
}
]
]
}
}

14 changes: 5 additions & 9 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
sonar.projectKey=fga-eps-mds_2023-2-GEROcuidado-APIForum
sonar.organization=fga-eps-mds-1

sonar.projectName=2023-2-GEROcuidado-APIForum

sonar.sources=src

sonar.host.url=https://sonarcloud.io
sonar.language=ts
sonar.typescript.tsconfigPath=./tsconfig.json

sonar.sourceEncoding=UTF-8
sonar.python.version=3

sonar.sources=./src
sonar.inclusions=**
sonar.test.inclusions=**/*.spec.tsx,**/*.spec.ts, **/*.test.ts
sonar.exclusions=**/main.ts,**/ormconfig.ts,**/*.module.ts,src/migration/*.ts,src/migrations.ts,**/*.spec.ts
sonar.exclusions=node_modules/**,**/main.ts,**/ormconfig.ts,**/*.module.ts,src/migration/*.ts,src/migrations.ts

sonar.javascript.lcov.reportPaths=./coverage/unit/lcov.info
sonar.dynamicAnalysis=reuseReports
sonar.core.codeCoveragePlugin=cobertura

sonar.testExecutionReportPaths=reports/sonar-report.xml

0 comments on commit bd69d4d

Please sign in to comment.