forked from fga-eps-mds/2024.1-CALCULUS-UserService
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from fga-eps-mds/84-feat_sonar
(#84) Adding SonarCloud and CI
- Loading branch information
Showing
15 changed files
with
8,973 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## Descrição | ||
<!-- Descreve precisamente o que está sendo submetido e suas alterações --> | ||
- Criando ... | ||
|
||
## Revisão | ||
<!-- Verifica se os critérios estabelecidos na issue foram realizados --> | ||
- [x] Cria ... | ||
|
||
## Pre-merge checklist | ||
|
||
- [x] O Pull Request refere-se a um único assunto, um título claro e uma descrição em frases gramaticalmente corretas e completas. | ||
- [x] A branch está atualizada com a branch main. | ||
- [x] Os commits atendem o padrão especificado na política de contribuição. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
name: Bug Report | ||
about: Reporte um bug | ||
title: '' | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
### Descrição | ||
<!--- Descrição geral do problema --> | ||
|
||
## Comportamento Atual | ||
<!--- O que o bug faz no sistema? use texto, imagens e/ou vídeos --> | ||
|
||
## Comportamento Esperado | ||
<!--- Como o sistema deveria reagir se o problema não existisse? use texto, imagens e/ou vídeos --> | ||
|
||
## Possível Solução | ||
<!--- Ideias ou sugestões de solução, caso existam, senão comentar essa seção --> | ||
|
||
## Passos para Reproduzir | ||
<!--- passa a passo, com comandos, para reproduzir o bug --> | ||
1. | ||
2. | ||
3. | ||
4. | ||
|
||
## Contexto | ||
<!--- descrever o ambiente onde ocorreu o erro, a máquina, o browser, tipo de usuário --> | ||
<!--- ou qualquer outra variável que seja determinante para reproduzir o erro --> | ||
### Máquina | ||
|
||
### Browser | ||
|
||
### Tipo de Usuário |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## Descrição | ||
<!-- Descreve precisamente o que está sendo submetido e suas alterações --> | ||
- Criando ... | ||
|
||
## Revisão | ||
<!-- Verifica se os critérios estabelecidos na issue foram realizados --> | ||
- [x] Cria ... | ||
|
||
## Pre-merge checklist | ||
|
||
- [x] O Pull Request refere-se a um único assunto, um título claro e uma descrição em frases gramaticalmente corretas e completas. | ||
- [x] A branch está atualizada com a branch main. | ||
- [x] Os commits atendem o padrão especificado na política de contribuição. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Análise de Código | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
branches: | ||
- main | ||
|
||
jobs: | ||
sonarcloud: | ||
name: SonarCloud | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Instala dependências | ||
run: npm install | ||
|
||
- name: Executa linter | ||
run: npm run lint | ||
|
||
- name: Executa testes e gera cobertura | ||
run: npm run test:all | ||
|
||
- name: Executa SonarCloud Scan | ||
if: ${{ always() }} | ||
uses: SonarSource/sonarcloud-github-action@master | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Metrics and Release | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
types: [closed] | ||
|
||
jobs: | ||
release: | ||
if: github.event.pull_request.merged == true | ||
runs-on: "ubuntu-latest" | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Cria arquivo .env | ||
run: | | ||
touch ./scripts/.env | ||
echo TOKEN=${{ secrets.API_TOKEN_GITHUB }} >> ./scripts/.env | ||
echo RELEASE_MAJOR=${{ contains(github.event.pull_request.labels.*.name, 'MAJOR RELEASE') }} >> ./scripts/.env | ||
echo RELEASE_MINOR=${{ contains(github.event.pull_request.labels.*.name, 'MINOR RELEASE') }} >> ./scripts/.env | ||
- name: Gera release e envia métricas para repositório de DOC | ||
run: | | ||
cd scripts && yarn install && node release.js | ||
git config --global user.email "${{secrets.GIT_USER_EMAIL}}" | ||
git config --global user.name "${{secrets.GIT_USER_NAME}}" | ||
git clone --single-branch --branch main "https://x-access-token:${{secrets.API_TOKEN_GITHUB}}@github.com/fga-eps-mds/${{secrets.GIT_DOC_REPO}}" ${{secrets.GIT_DOC_REPO}} | ||
mkdir -p ${{secrets.GIT_DOC_REPO}}/analytics-raw-data | ||
cp -R analytics-raw-data/*.json ${{secrets.GIT_DOC_REPO}}/analytics-raw-data | ||
cd ${{secrets.GIT_DOC_REPO}} | ||
git add . | ||
git commit -m "Adicionando métricas do repositório ${{ github.event.repository.name }} ${{ github.ref_name }}" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,8 @@ yarn-debug.log* | |
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
reports/* | ||
|
||
# OS | ||
.DS_Store | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import type {Config} from 'jest'; | ||
|
||
const config: Config = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
reporters: [ | ||
'default', | ||
[ | ||
'jest-sonar', | ||
{ | ||
outputDirectory: 'reports', | ||
outputName: 'sonar-report.xml' | ||
} | ||
] | ||
] | ||
}; | ||
|
||
export default config; |
Oops, something went wrong.