-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[INFRA] Add SonarCloud analysis on CI build (#906)
* Add configuration to run a SonarCloud analysis on master branch and pull requests * Fix coverage generation * Add coverage badge in README
- Loading branch information
Showing
7 changed files
with
102 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,11 +33,19 @@ jobs: | |
matrix: | ||
# syntax inspired from https://github.community/t5/GitHub-Actions/Using-a-matrix-defined-input-for-a-custom-action/m-p/32032/highlight/true#M988 | ||
os: | ||
- { name: ubuntu-20.04 } | ||
- { name: ubuntu-20.04, coverage: '-- --coverage' } | ||
- { name: macos-10.15 } | ||
- { name: windows-2019 } | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Checkout with shallow clone | ||
uses: actions/checkout@v2 | ||
if: ${{ !contains(matrix.os.coverage, 'coverage') }} | ||
- name: Checkout without shallow clone | ||
uses: actions/checkout@v2 | ||
if: ${{ contains(matrix.os.coverage, 'coverage') }} | ||
with: | ||
# Disabling shallow clone is recommended for improving relevancy of SonarCloud reporting | ||
fetch-depth: 0 | ||
- name: Setup node | ||
uses: actions/setup-node@v1 | ||
with: | ||
|
@@ -54,7 +62,7 @@ jobs: | |
run: npm run build | ||
- name: Test Application | ||
id: 'test_unit' | ||
run: npm run test:unit | ||
run: npm run test:unit ${{ matrix.os.coverage }} | ||
- name: Upload unit test results | ||
if: ${{ failure() && steps.test_unit.outcome == 'failure' }} | ||
uses: actions/upload-artifact@v2 | ||
|
@@ -63,7 +71,7 @@ jobs: | |
path: build/test-report/unit | ||
- name: Test Application End to End | ||
id: 'test_e2e' | ||
run: npm run test:e2e | ||
run: npm run test:e2e ${{ matrix.os.coverage }} | ||
- name: Upload e2e test results | ||
if: ${{ failure() && steps.test_e2e.outcome == 'failure' }} | ||
uses: actions/upload-artifact@v2 | ||
|
@@ -73,3 +81,11 @@ jobs: | |
# Ensure we don't break scripts | ||
- name: Build utils | ||
run: npm run build-utils | ||
|
||
# No need to run the analysis from all environments | ||
- name: SonarCloud Scan | ||
if: ${{ success() && contains(matrix.os.coverage, 'coverage') }} | ||
uses: SonarSource/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Organization and project keys are displayed in the right sidebar of the project homepage | ||
sonar.projectKey=process-analytics_bpmn-visualization-js | ||
sonar.organization=process-analytics | ||
|
||
# This is the name and version displayed in the SonarCloud UI. | ||
sonar.projectName=bpmn-visualization | ||
sonar.projectVersion=0.7.0 | ||
|
||
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. | ||
sonar.sources=src | ||
sonar.exclusions=src/model/**/*,src/demo/**/*,src/static/**/* | ||
#sonar.inclusions= | ||
# Encoding of the source code. Default is default system encoding | ||
sonar.sourceEncoding=UTF-8 | ||
|
||
# Path to tests | ||
sonar.tests=test | ||
sonar.test.exclusions=**/jest.config.js,**/*.png | ||
#sonar.test.inclusions= | ||
|
||
sonar.javascript.lcov.reportPaths=build/test-report/unit/lcov.info,build/test-report/e2e/lcov.info | ||
sonar.testExecutionReportPaths=build/test-report/unit/sonar-report.xml,build/test-report/e2e/sonar-report.xml | ||
|
||
# The job failed before the sonar analysis, if the lint check failed. So no need to configure eslint for Sonar | ||
#sonar.eslint.reportPaths=build/eslint-reporter.json | ||
sonar.typescript.tsconfigPath=tsconfig.json | ||
|
||
# Exclusions for copy-paste detection | ||
#sonar.cpd.exclusions= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters