Skip to content
6 changes: 6 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,9 @@ jobs:
token: ${{ secrets.PUSH_TO_PROTECTED_BRANCH }}
branch: ${{ steps.vars.outputs.stage }}
unprotect_reviews: true

- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
16 changes: 7 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:

steps:
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
Expand All @@ -20,6 +21,7 @@ jobs:

- name: Install dependencies
run: yarn

- name: Lint
run: yarn lint

Expand All @@ -29,12 +31,8 @@ jobs:
- name: Build
run: yarn build:prod

# - name: SonarCloud Scan
# uses: sonarsource/sonarcloud-github-action@master
# with:
# args: >
# -Dsonar.organization=${{ secrets.SONAR_ORG}}
# -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY}}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Upload code coverage
uses: actions/upload-artifact@v2
with:
name: coverage
path: coverage/lcov.info
26 changes: 26 additions & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: SonarQube Analysis
on:
workflow_run:
workflows: [React Template CI]
types: [completed]

jobs:
sonar-analysis:
name: SonarQube Analysis
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Download code coverage artifact
uses: actions/download-artifact@v2
with:
name: coverage
path: coverage/lcov.info

- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
6 changes: 3 additions & 3 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
sonar.organization=wednesday-solutions
sonar.projectKey=wednesday-solutions_react-template
sonar.projectKey=wednesday-solutions_react-graphql-ts-template_AY7GxkO6B2n8RRmGoU1i

sonar.language=js
sonar.language=ts
sonar.sources=.
sonar.tests=app
sonar.exclusions=*./.storybook,*./internals,*./server
sonar.test.inclusions=**/*.test.js
sonar.test.inclusions=**/*.test.ts
sonar.javascript.lcov.reportPaths=./coverage/lcov.info
sonar.testExecutionReportPaths=./reports/test-report.xml
sonar.sourceEncoding=UTF-8