Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Repo to Sonarqube #261

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/sonarqube-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: sq_build

on:
push:
branches:
- master

jobs:
build:
name: sq_build
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v1

- name: 'Setup Node'
uses: actions/setup-node@v2
with:
node-version: '14'

- name: 'Set NPM registry'
run: npm set registry=https://registry.npmjs.org/

- name: 'Test registry connection'
run: npm install -g https://tls-test.npmjs.com/tls-test-1.0.0.tgz

- name: 'Set npmrc file'
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc

- name: 'sonar scanner'
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
run: |
npm install -g sonarqube-scanner
npm install
npm run lint:report
npm run sonar:build
# If you wish to fail your job when the Quality Gate is red, uncomment the
# following lines. This would typically be used to fail a deployment.
# - uses: sonarsource/sonarqube-quality-gate-action@master
# timeout-minutes: 5
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
"clean": "rm -rf node_modules && npm i",
"lint": "eslint src",
"publish": "npx jest && npx eslint src && npm run check-types && npm run build && cd build && npm publish && cd ..",
"test": "jest"
"test": "jest",
"sonar:build": "sonar-scanner -Dproject.settings=sonar-project.properties",
"lint:report": "eslint --ext .ts -f json -o ./reports/eslint-output.json"
},
"browserslist": [
">0.2%",
Expand Down
29 changes: 29 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Login for the environment version of SonarCube
#sonar.login=<set-this>

# must be unique in a given SonarQube instance
sonar.projectKey=JustSift_ReSift

# --- optional properties ---

# defaults to project key
sonar.projectName=ReSift
# defaults to 'not provided'
#sonar.projectVersion=1.0

# Path is relative to the sonar-project.properties file. Defaults to .
sonar.sources=src
sonar.tests=src
sonar.ts.tslintconfigpath=.eslintrc.json
sonar.eslint.reportPaths=reports/eslint-output.json

sonar.coverage.exclusions=src/tracing.ts,src/assemble-dependency-container.ts,src/**/logger.ts,src/**/types.ts,src/**/test/makers.ts

sonar.inclusions=src/**/*.ts

sonar.test.inclusions=src/**/*.test.ts

sonar.javascript.lcov.reportPaths=reports/lcov.info

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8