-
Notifications
You must be signed in to change notification settings - Fork 0
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 #6 from fga-eps-mds/devel
Release 1
- Loading branch information
Showing
22 changed files
with
6,019 additions
and
938 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,140 @@ | ||
name: backend-financeiro-ci | ||
|
||
on: | ||
push: | ||
branches: [main, devel] | ||
pull_request: | ||
branches: | ||
- main | ||
- devel | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
format: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js 20.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.x | ||
|
||
- name: 📬 Caching | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
${{ github.workspace }}/node_modules | ||
${{ github.workspace }}/dist | ||
key: ${{ runner.os }}-node-${{ hashFiles('*/package-lock.json') }}-${{ hashFiles('/.{js,jsx,ts,tsx}') }} | ||
restore-keys: | | ||
${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}- | ||
- name: 🧰 Instala bibliotecas e dependências | ||
run: npm i | ||
|
||
- name: 🔍 Verifica estilização do código | ||
run: npm run check-format | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js 20.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.x | ||
|
||
- name: 📬 Caching | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
${{ github.workspace }}/node_modules | ||
${{ github.workspace }}/dist | ||
key: ${{ runner.os }}-node-${{ hashFiles('*/package-lock.json') }}-${{ hashFiles('/.{js,jsx,ts,tsx}') }} | ||
restore-keys: | | ||
${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}- | ||
- name: 🧰 Instala bibliotecas e dependências | ||
run: npm i | ||
|
||
- name: 🧹 Verifica eslint | ||
run: npm run lint | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
env: | ||
MONGO_URI: ${{ secrets.MONGO_URI }} | ||
MONGO_INITDB_ROOT_USERNAME: ${{ secrets.MONGO_INITDB_ROOT_USERNAME }} | ||
MONGO_INITDB_ROOT_PASSWORD: ${{ secrets.MONGO_INITDB_ROOT_PASSWORD }} | ||
DB_HOST: ${{ secrets.DB_HOST }} | ||
PORT: ${{ secrets.PORT }} | ||
EMAIL: ${{ secrets.EMAIL }} | ||
SECRET: ${{ secrets.SECRET }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js 20.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20.x | ||
|
||
- name: 📬 Caching | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
${{ github.workspace }}/node_modules | ||
${{ github.workspace }}/dist | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('/.{js,jsx,ts,tsx}') }} | ||
restore-keys: | | ||
${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}- | ||
- name: 🧰 Instala bibliotecas e dependências | ||
run: npm i | ||
|
||
- name: 🧪 Roda suíte de testes | ||
run: npm test -- --passWithNoTests | ||
|
||
sonarcloud: | ||
name: sonarcloud | ||
needs: [test] | ||
runs-on: ubuntu-latest | ||
env: | ||
MONGO_URI: ${{ secrets.MONGO_URI }} | ||
MONGO_INITDB_ROOT_USERNAME: ${{ secrets.MONGO_INITDB_ROOT_USERNAME }} | ||
MONGO_INITDB_ROOT_PASSWORD: ${{ secrets.MONGO_INITDB_ROOT_PASSWORD }} | ||
DB_HOST: ${{ secrets.DB_HOST }} | ||
PORT: ${{ secrets.PORT }} | ||
EMAIL: ${{ secrets.EMAIL }} | ||
SECRET: ${{ secrets.SECRET }} | ||
continue-on-error: true | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: 📬 Caching | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
${{ github.workspace }}/node_modules | ||
${{ github.workspace }}/dist | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.{js,jsx,ts,tsx}') }} | ||
restore-keys: | | ||
${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}- | ||
- name: 🧰 Instala bibliotecas e dependências | ||
run: npm i | ||
|
||
- name: 📜 Relatório do eslint | ||
run: npx eslint -f json -o reports/eslint-report.json src || true | ||
|
||
- name: 🧪 Testes e cobertura | ||
run: JEST_SONAR=jest-sonar CI=true npm test -- --coverage --passWithNoTests | ||
|
||
- name: SonarCloud Scan | ||
uses: SonarSource/sonarcloud-github-action@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PERSONAL_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,41 @@ | ||
name: backend-financeiro-release | ||
|
||
on: | ||
push: | ||
branches: [main, devel] | ||
tags: | ||
- "v*" | ||
|
||
jobs: | ||
generate-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: "Get Previous tag" | ||
id: previoustag | ||
uses: "WyriHaximus/github-action-get-previous-tag@v1" | ||
with: | ||
fallback: 1.0.0 | ||
|
||
- name: Use Node.js 16.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
|
||
- name: Cria métricas do SonarCloud | ||
run: python metrics/sonar-metrics.py ${{ github.event.repository.name }} ${{ github.ref_name }} | ||
|
||
- name: Commita arquivos de métricas do SonarCloud | ||
run: | | ||
git config --global user.email "${{ secrets.GIT_EMAIL }}" | ||
git config --global user.name "${{ secrets.GIT_USER }}" | ||
git clone --single-branch --branch main "https://x-access-token:${{ secrets.PERSONAL_TOKEN }}@github.com/fga-eps-mds/2024.1-SENTINELA-DOC" doc | ||
mkdir -p doc/analytics-raw-data | ||
cp -R fga-eps-mds*.json doc/analytics-raw-data | ||
cd doc | ||
git add . | ||
git commit -m "Métricas SonarCloud - ${{ github.event.repository.name }} ${{ github.ref_name }}" | ||
git push | ||
echo "Arquivos de métricas gerado com sucesso." |
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 |
---|---|---|
|
@@ -15,4 +15,6 @@ yarn-error.log | |
# Arquivos de configuração de IDEs | ||
.idea | ||
.vscode | ||
.env | ||
.env | ||
|
||
/coverage |
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,20 @@ | ||
echo '🏗️👷 Estilizando e verificando os padrões do seu código antes de commitar . . .\n' | ||
|
||
# Check Prettier standards | ||
npm run check-format || | ||
( | ||
echo '\n🤢🤮 Parece haver um problema de estilo 🤢🤮 | ||
Checagem do Prettier falhou... Rode um npm run format, adicione as alterações e tente novamente.\n'; | ||
false; | ||
) | ||
|
||
# Check ESLint Standards | ||
npm run lint || | ||
( | ||
echo '\n😤🏀👋😤 Daqui não passa! 😤🏀👋😤 | ||
Checagem do ESLint falhou... Faça as alterações listadas acima e tente novamente.\n' | ||
false; | ||
) | ||
|
||
# If everything passes... Now we can commit | ||
echo '\n\n✅✅✅✅ Você ganhou dessa vez, commitando agora. ✅✅✅✅\n' |
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,5 @@ | ||
.github | ||
*.md | ||
coverage | ||
dist | ||
*.json |
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,6 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"tabWidth": 4, | ||
"semi": true, | ||
"singleQuote": false | ||
} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# 2024.1-SENTINELA-BACKEND-FINACEIRO | ||
# 2024.1-SENTINELA-BACKEND-FINANCEIRO | ||
|
||
## Variáveis de ambiente | ||
|
||
|
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 |
---|---|---|
@@ -1,38 +1,38 @@ | ||
version: '3.8' | ||
version: "3.8" | ||
services: | ||
mongodb: | ||
image: mongo:7.0 | ||
container_name: financedb | ||
restart: always | ||
environment: | ||
MONGO_INITDB_ROOT_USERNAME: root | ||
MONGO_INITDB_ROOT_PASSWORD: password | ||
ports: | ||
- "27018:27017" | ||
env_file: .env | ||
volumes: | ||
- mongo-data:/data/db | ||
networks: | ||
- backend_network | ||
command: ["mongod", "--quiet", "--logpath", "/dev/null"] | ||
mongodb: | ||
image: mongo:7.0 | ||
container_name: financedb | ||
restart: always | ||
environment: | ||
MONGO_INITDB_ROOT_USERNAME: root | ||
MONGO_INITDB_ROOT_PASSWORD: password | ||
ports: | ||
- "27018:27017" | ||
env_file: .env | ||
volumes: | ||
- mongo-data:/data/db | ||
networks: | ||
- backend_network | ||
command: ["mongod", "--quiet", "--logpath", "/dev/null"] | ||
|
||
express_backend: | ||
build: . | ||
container_name: express_backend_finances | ||
ports: | ||
- "3002:3002" | ||
env_file: .env | ||
environment: | ||
MONGO_URI: ${MONGO_URI} | ||
depends_on: | ||
- mongodb | ||
networks: | ||
- backend_network | ||
volumes: | ||
- ./:/app | ||
express_backend: | ||
build: . | ||
container_name: express_backend_finances | ||
ports: | ||
- "3002:3002" | ||
env_file: .env | ||
environment: | ||
MONGO_URI: ${MONGO_URI} | ||
depends_on: | ||
- mongodb | ||
networks: | ||
- backend_network | ||
volumes: | ||
- ./:/app | ||
|
||
volumes: | ||
mongo-data: | ||
mongo-data: | ||
|
||
networks: | ||
backend_network: | ||
backend_network: |
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,11 @@ | ||
const pluginPrettier = require("eslint-plugin-prettier/recommended"); | ||
|
||
module.exports = [ | ||
pluginPrettier, | ||
{ | ||
rules: { | ||
"no-console": "warn", | ||
"no-unused-vars": "error", | ||
}, | ||
}, | ||
]; |
Oops, something went wrong.