Skip to content

Instantly share code, notes, and snippets.

@tiagolpadua
Created August 25, 2021 23:46
Show Gist options
  • Save tiagolpadua/652a5a7b62b932afc43ff6d5ab7ae93c to your computer and use it in GitHub Desktop.
Save tiagolpadua/652a5a7b62b932afc43ff6d5ab7ae93c to your computer and use it in GitHub Desktop.
# Este arquivo deve ficar na pasta .github/workflows/build.yml
name: Build
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: 12
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test:ci
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
{
"name": "carango-bom",
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.11.3",
"@material-ui/data-grid": "^4.0.0-alpha.24",
"@material-ui/icons": "^4.11.2",
"@testing-library/jest-dom": "^5.11.10",
"@testing-library/react": "^11.2.6",
"fontsource-roboto": "^4.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"serve": "^11.3.2",
"web-vitals": "^1.1.1"
},
"scripts": {
"start": "serve -p $PORT -s build",
"develop": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --coverage --watchAll=false",
"test:ci": "react-scripts test --coverage --watchAll=false --testResultsProcessor ./node_modules/jest-sonar-reporter",
"test:dev": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@testing-library/user-event": "^12.8.3",
"jest-sonar-reporter": "^2.0.0"
}
}
# 'Project Key' e 'Organization Key' você encontra na página inicial do seu dashboard do SonarCloud - https://sonarcloud.io/dashboard?id=tiagolpadua_carango-bom
sonar.projectKey=tiagolpadua_carango-bom
sonar.organization=tiagolpadua
sonar.javascript.lcov.reportPaths=./coverage/lcov.info
sonar.testExecutionReportPaths=./test-report.xml
sonar.projectName=carango-bom
sonar.projectVersion=1.0
sonar.sources=.
sonar.language=js
sonar.exclusions=src/**/*.test.js,src/**/*.spec.js,src/**/*.test.jsx,src/**/*.spec.jsx
sonar.coverage.exclusions=src/**/*.test.js,src/**/*.spec.js,src/**/*.test.jsx,src/**/*.spec.jsx,lighthouserc.js
sonar.sourceEncoding=UTF-8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment