From 0c881cc786f3d3f61be8952765fbf9a49bff8bba Mon Sep 17 00:00:00 2001 From: Ryan Howard Date: Tue, 7 Mar 2023 13:28:02 -0600 Subject: [PATCH 1/2] Adding initial sonarqube files --- .github/workflows/sonarqube-build.yaml | 48 ++++++++++++++++++++++++++ package.json | 4 ++- sonar-project.properties | 29 ++++++++++++++++ 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/sonarqube-build.yaml create mode 100644 sonar-project.properties diff --git a/.github/workflows/sonarqube-build.yaml b/.github/workflows/sonarqube-build.yaml new file mode 100644 index 00000000..96345114 --- /dev/null +++ b/.github/workflows/sonarqube-build.yaml @@ -0,0 +1,48 @@ +name: sq_build + +on: + push: + branches: + - master + - feature/sonarqube + + +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 }} \ No newline at end of file diff --git a/package.json b/package.json index 56a3ec43..6eec42e7 100644 --- a/package.json +++ b/package.json @@ -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%", diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..55f29608 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,29 @@ +# Login for the environment version of SonarCube +#sonar.login= + +# 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 \ No newline at end of file From fa30a777b4895c74d78c7fd0ef28b811fd0ba462 Mon Sep 17 00:00:00 2001 From: Ryan Howard Date: Tue, 7 Mar 2023 13:48:33 -0600 Subject: [PATCH 2/2] removing working branch --- .github/workflows/sonarqube-build.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/sonarqube-build.yaml b/.github/workflows/sonarqube-build.yaml index 96345114..63492114 100644 --- a/.github/workflows/sonarqube-build.yaml +++ b/.github/workflows/sonarqube-build.yaml @@ -4,8 +4,6 @@ on: push: branches: - master - - feature/sonarqube - jobs: build: