Skip to content

Commit

Permalink
ci(sonar): implementar análise estática com SonarCloud
Browse files Browse the repository at this point in the history
  • Loading branch information
PauloGoncalvesBH committed May 8, 2021
1 parent cd5fbc6 commit cca3980
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 39 deletions.
38 changes: 0 additions & 38 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

28 changes: 27 additions & 1 deletion .github/workflows/continuous_delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,32 @@ jobs:
run: npm ci
- name: API Test
run: npm test
- uses: actions/upload-artifact@v2
if: ${{ matrix.node-version == '14.x' && matrix.os == 'ubuntu-20.04' }}
with:
name: source
retention-days: 1
path: |
${{ github.workspace }}
!.nyc_output/**
!.github/**
!node_modules/**
!docs/**
sonarcloud:
needs: test-api

runs-on: ubuntu-18.04

steps:
- uses: actions/download-artifact@v2
with:
name: source
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

test-mutation:

Expand Down Expand Up @@ -128,7 +154,7 @@ jobs:
PACT_BROKER_TOKEN: ${{ secrets.PACT_BROKER_TOKEN }}

release:
needs: [lint, commit-lint, dockerfile-lint, test-api, test-mutation, test-infra-docker, test-contract]
needs: [lint, commit-lint, dockerfile-lint, test-api, test-mutation, test-infra-docker, test-contract, sonarcloud]

runs-on: ubuntu-18.04

Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,32 @@ jobs:
run: npm ci
- name: API Test
run: npm test
- uses: actions/upload-artifact@v2
if: ${{ matrix.node-version == '14.x' && matrix.os == 'ubuntu-20.04' }}
with:
name: source
retention-days: 1
path: |
${{ github.workspace }}
!.nyc_output/**
!.github/**
!node_modules/**
!docs/**
sonarcloud:
needs: test-api

runs-on: ubuntu-18.04

steps:
- uses: actions/download-artifact@v2
with:
name: source
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

test-mutation-diff:

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.nyc_output/
coverage/
node_modules/
reports/

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"test:mutation": "cross-env NODE_ENV=serverest-test stryker run ./test/stryker.conf.js",
"test:mutation:diff": "cross-env NODE_ENV=serverest-test stryker-diff-runner --path ./test/stryker.conf.js --branch trunk",
"test": "cross-env NODE_ENV=serverest-test nyc mocha --config test/integration/.mocharc.js",
"posttest": "nyc report --reporter=lcov",
"lint": "standard",
"lint:fix": "standard --fix",
"lint:staged": "lint-staged",
Expand Down
9 changes: 9 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
sonar.organization=serverest
sonar.projectKey=ServeRest
sonar.projectName=ServeRest
sonar.projectVersion=1.0
sonar.sources=src/
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.sourceEncoding=UTF-8
sonar.exclusions=docs/**, test/**, .husky/**, .github/**, coverage/**, .nyc_output/**, reports/**
sonar.tests=test

0 comments on commit cca3980

Please sign in to comment.