Skip to content

Commit 65870c9

Browse files
committed
CI updates
- Re order npm scripts and reduce them to the actual needs - Configure sonar to evaluate code coverage - Configure sonar cloud status badge
1 parent 332d920 commit 65870c9

File tree

6 files changed

+31
-29
lines changed

6 files changed

+31
-29
lines changed

.github/workflows/build.yml

+6-14
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,9 @@ jobs:
2424
npm ci
2525
npm run unit-test
2626
npm run eslint
27-
npm run only-cobertura
28-
29-
- name: Code Coverage Report
30-
uses: irongut/[email protected]
31-
with:
32-
filename: coverage/cobertura-coverage.xml
33-
badge: true
34-
fail_below_min: true
35-
format: markdown
36-
hide_branch_rate: false
37-
hide_complexity: true
38-
indicators: true
39-
output: console
40-
thresholds: '70 90'
27+
npm run only-coverage
28+
- name: SonarCloud Scan
29+
uses: SonarSource/sonarcloud-github-action@master
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}

.github/workflows/code-coverage-results.md

Whitespace-only changes.

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ typings/
7171
data/*
7272
# sessionDB local
7373
SessionDB/data/redis-data
74-
sonar-project.properties
7574
.scannerwork
7675

7776
# rsk db data

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=rsksmart_2wp-api&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=rsksmart_2wp-api)
2+
13
# 2wp-api
24

35
This is the API component for 2-Way-Peg solution.

package.json

+20-14
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,40 @@
1212
"node": ">=10.16"
1313
},
1414
"scripts": {
15+
"clean": "lb-clean dist *.tsbuildinfo .eslintcache",
16+
1517
"build": "lb-tsc",
1618
"build:watch": "lb-tsc --watch",
19+
"rebuild": "npm run clean && npm run build",
20+
1721
"lint": "npm run eslint",
18-
"coverage": "npm run pretest && lb-nyc mocha --recursive 'dist/__tests__/**/*.unit.js' --timeout 10000 && lb-nyc report --reporter=cobertura",
19-
"only-cobertura": "lb-nyc report --reporter=cobertura",
20-
"coverage:ci": "lb-nyc report --reporter=cobertura | coveralls",
2122
"lint:fix": "npm run eslint:fix && npm run prettier:fix",
23+
"eslint": "lb-eslint --report-unused-disable-directives .",
24+
"eslint:fix": "npm run eslint -- --fix",
2225
"prettier:cli": "lb-prettier \"**/*.ts\" \"**/*.js\"",
2326
"prettier:check": "npm run prettier:cli -- -l",
2427
"prettier:fix": "npm run prettier:cli -- --write",
25-
"eslint": "lb-eslint --report-unused-disable-directives .",
26-
"eslint:fix": "npm run eslint -- --fix",
27-
"unit-test": "npm run pretest && lb-nyc mocha --recursive 'dist/__tests__/**/*.unit.js' --timeout 10000",
28-
"pretest": "npm run clean && npm run build",
28+
29+
"precoverage": "npm run unit-test",
30+
"coverage": "lb-nyc report --reporter=text --reporter=lcov",
31+
"only-coverage": "lb-nyc report --reporter=lcov",
32+
33+
"pretest": "npm run rebuild",
2934
"test": "lb-nyc mocha --recursive 'dist/__tests__/**/*.js' --timeout 10000",
3035
"posttest": "npm run lint",
3136
"test:dev": "lb-nyc mocha --allow-console-logs dist/__tests__/**/*.js && npm run posttest",
32-
"precoverage": "npm test",
33-
"premigrate": "npm run build",
37+
"unit-test": "npm run pretest && lb-nyc mocha --recursive 'dist/__tests__/**/*.unit.js' --timeout 10000",
38+
39+
"premigrate": "npm run rebuild",
3440
"migrate": "node ./dist/migrate",
35-
"preopenapi-spec": "npm run build",
41+
42+
"preopenapi-spec": "npm run rebuild",
3643
"openapi-spec": "node ./dist/openapi-spec",
37-
"rebuild": "npm run clean && npm run build",
44+
3845
"prestart": "npm run rebuild",
3946
"start": "node -r source-map-support/register .",
40-
"start-daemon": "npm run prestart && node -r source-map-support/register . --appmode=DAEMON",
41-
"start-api": "npm run prestart && node -r source-map-support/register . --appmode=API",
42-
"clean": "lb-clean dist *.tsbuildinfo .eslintcache"
47+
"start-api": "npm run start -- --appmode=API",
48+
"start-daemon": "npm run start -- --appmode=DAEMON"
4349
},
4450
"repository": {
4551
"type": "git",

sonar-project.properties

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
sonar.projectKey=rsksmart_2wp-api
2+
sonar.organization=rsksmart
3+
sonar.javascript.lcov.reportPaths=./coverage/lcov.info

0 commit comments

Comments
 (0)