Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Banco de dados no docker #50

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
adf7433
Generalizando endereco de smtp
thiagohdaqw Sep 17, 2023
38503f0
Added entity framework
thiagohdaqw Sep 21, 2023
da53ba2
Added entity UnidadeFederativa
thiagohdaqw Sep 21, 2023
f032909
Added entity EtapaEnsino
thiagohdaqw Sep 21, 2023
be82313
Added entity Municipio
thiagohdaqw Sep 21, 2023
7264bad
Added entity Situacao
thiagohdaqw Sep 21, 2023
dbe11e1
Added entity Rede
thiagohdaqw Sep 21, 2023
1b6e0c9
Added entity Porte
thiagohdaqw Sep 21, 2023
c7756d0
Added entity Localizacao
thiagohdaqw Sep 21, 2023
bdf125f
Added entity Escola
thiagohdaqw Sep 21, 2023
838df08
Added entity EscolaEtapaEnsino
thiagohdaqw Sep 21, 2023
9999c53
Transformed entities in enums
thiagohdaqw Sep 21, 2023
5f79506
Merge pull request #1 from fga-eps-mds/deploy
thiagohdaqw Sep 21, 2023
845e6a8
Added municipio seeding
thiagohdaqw Sep 22, 2023
460e005
Fixed escola optional fields
thiagohdaqw Sep 22, 2023
3648c72
Converted create escolas with csv
thiagohdaqw Sep 22, 2023
e7d3539
Dockerfile modificado para ambiente de dev
wagnermc506 Sep 27, 2023
d8290bb
Adicionando api error handler
thiagohdaqw Sep 30, 2023
0d90042
Refatorando cadastro de escola
thiagohdaqw Sep 30, 2023
0a01e4a
Refatorando delecao de escola
thiagohdaqw Sep 30, 2023
e93b2d2
Refatorando pesquisa paginada de escola
thiagohdaqw Sep 30, 2023
8064373
Refatorando alteracao de dados da escola
thiagohdaqw Sep 30, 2023
5a66615
Refatorando dominio para o entity framework
thiagohdaqw Sep 30, 2023
a109ea1
Organizando pastas do projeto
thiagohdaqw Sep 30, 2023
40db5ae
Arrumando alteracao da etapa de ensino
thiagohdaqw Sep 30, 2023
51201b3
Arrumando referencias
thiagohdaqw Sep 30, 2023
e19d785
Melhorando performance no seeding de municipio
thiagohdaqw Oct 6, 2023
3e819a4
test: adiciona testes do municipio repositorio
thiagohdaqw Oct 7, 2023
92a539a
Fix: arruma colisao entre do banco com testes paralelos
thiagohdaqw Oct 7, 2023
436d0e5
test: adiciona testes do repositorio de escolas
thiagohdaqw Oct 7, 2023
5b9389c
test: evita acesso recorrente ao arquivo de municipios
thiagohdaqw Oct 7, 2023
76b1f49
Test: adiciona testes do dominio controller
thiagohdaqw Oct 7, 2023
e52cb64
fix: arruma testes do dominio e solicitacao
thiagohdaqw Oct 7, 2023
620f7a5
Update build.yml
thiagohdaqw Oct 9, 2023
5d2d140
Merge pull request #2 from fga-eps-mds/docker-environment
thiagohdaqw Oct 11, 2023
299607e
Update build.yml
thiagohdaqw Oct 11, 2023
a66ace9
chore: Atualiza repositórios no workflow de release
wagnermc506 Oct 14, 2023
641c21c
test: adiciona testes do EscolaService com entity framework
thiagohdaqw Oct 15, 2023
fb7a9fa
feat: adiciona coverage no gitignore
thiagohdaqw Oct 15, 2023
f0979a6
Merge remote-tracking branch 'origin/develop' into add-entity-framework
thiagohdaqw Oct 15, 2023
78f8887
test: adiciona escola controller tests
thiagohdaqw Oct 15, 2023
cebb947
Merge pull request #5 from fga-eps-mds/release_workflow
thiagohdaqw Oct 16, 2023
d13d177
fix: remove alteracoes desnecessarias
thiagohdaqw Oct 16, 2023
d92aac7
fix: arruma qualidade do codigo
thiagohdaqw Oct 16, 2023
b844617
hotfix: arruma formato do release.yml
thiagohdaqw Oct 16, 2023
4c47cd0
fix: remove mal cheiros de código
thiagohdaqw Oct 16, 2023
803b8cc
fix: arruma encode dos arquivos de teste
thiagohdaqw Oct 16, 2023
589e461
fix: mal cheiro de código
thiagohdaqw Oct 16, 2023
d6a6f36
feat: adiciona ci pelo ubuntu
thiagohdaqw Oct 17, 2023
514dc33
Merge remote-tracking branch 'origin/develop' into add-entity-framework
thiagohdaqw Oct 17, 2023
b98162c
fix: arruma encoding dos arquivos
thiagohdaqw Oct 17, 2023
0d8effa
feat: adiciona sonar properties
thiagohdaqw Oct 17, 2023
143f95d
chore: melhora eficiencia do ci
thiagohdaqw Oct 17, 2023
1c5099e
fix: arruma exclusoes do sonar
thiagohdaqw Oct 17, 2023
26f3a10
fix: remove code smells
thiagohdaqw Oct 17, 2023
1bd59cb
fix: arruma code smells
thiagohdaqw Oct 17, 2023
ed3c54a
fix: adiciona arquivo main na exclusao do sonar
thiagohdaqw Oct 19, 2023
6dc94bb
feat: adiciona módulo de autenticação
csreis72 Oct 20, 2023
7d3033d
fix: arruma exclusao do sonar
thiagohdaqw Oct 20, 2023
559061d
refactor: utiliza pacote de autenticação
csreis72 Oct 20, 2023
b3a7a54
feat: adiciona permissões de usuário referentes ao serviço de escolas
csreis72 Oct 20, 2023
1349814
fix: arruma docker
thiagohdaqw Oct 21, 2023
9c5c369
Merge pull request #6 from fga-eps-mds/add-entity-framework
thiagohdaqw Oct 21, 2023
af33a4b
Merge branch 'develop' of github.com:fga-eps-mds/2023.2-Dnit-EscolaSe…
csreis72 Oct 21, 2023
4c19101
fix: remove chaves duplicadas no json de configurações
csreis72 Oct 21, 2023
a1ddd7a
refactor: move Permissao para pasta Enums e remove rota de teste
csreis72 Oct 21, 2023
7986abb
fix: atualiza service de autenticacao
thiagohdaqw Oct 21, 2023
f477bcf
test: adiciona testes de permissao
thiagohdaqw Oct 22, 2023
7ae4244
feat: autenticação e autorização
yudi-azvd Oct 23, 2023
a3cc31a
devops: adicionando database no docker
thiagohdaqw Nov 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.idea/
.git/
.github/
publish/
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[*.cs]

# CS8618: Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
dotnet_diagnostic.CS8618.severity = none
63 changes: 0 additions & 63 deletions .github/workflows/build.yml

This file was deleted.

113 changes: 68 additions & 45 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,79 @@
name: Deploy AWS

name: CI
on:
workflow_dispatch:
push:
branches: [ main ]
branches:
- main
- develop
pull_request:
branches: [ main ]

types: [opened, synchronize, reopened]
jobs:
build:

runs-on: ubuntu-latest

ci-windows:
name: Build, test and analyze Windows
runs-on: windows-latest
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v3
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Install dotnet-coverage
shell: powershell
run: dotnet tool install --global dotnet-coverage
- name: Clone trx2sonar
uses: actions/checkout@v3
with:
repository: gmarokov/dotnet-trx2sonar
path: dotnet-trx2sonar
- name: Setup trx2sonar
shell: powershell
run: |
dotnet restore dotnet-trx2sonar
dotnet build dotnet-trx2sonar --configuration Release
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"fga-eps-mds_2023.2-Dnit-EscolaService" /o:"fga-eps-mds-1" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml /d:sonar.testExecutionReportPaths=results.xml
dotnet build
dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml"
dotnet test --logger "trx;LogFileName=results.trx" --results-directory ./TestResults/results.xml
./dotnet-trx2sonar/TrxToSonar/bin/Release/net6.0/TrxToSonar -d ./TestResults -o results.xml
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
ci-linux:
name: Build and test Linux
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3

- name: Setup .NET Core
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'

- name: Install dependencies
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --configuration Release --no-restore

run: dotnet build --no-restore
- name: Test
run: dotnet test --no-restore --verbosity normal

- name: Publish
run: dotnet publish -c Release -o '${{ github.workspace }}/out'

- name: Create email service .env
run: |
echo 'EMAIL_SERVICE_ADDRESS=${{ secrets.EMAIL_SERVICE_ADDRESS }}' > '${{ github.workspace }}/out/.env'
echo 'EMAIL_SERVICE_PASSWORD=${{ secrets.EMAIL_SERVICE_PASSWORD }}' >> '${{ github.workspace }}/out/.env'
echo 'EMAIL_DNIT=${{ secrets.EMAIL_DNIT }}' >> '${{ github.workspace }}/out/.env'

- name: Zip Package
run: |
cd ${{ github.workspace }}/out
zip -r ${{ github.workspace }}/out.zip * .env

- name: Deploy to EB
uses: einaregilsson/beanstalk-deploy@v21
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
application_name: back-dnit-escola
environment_name: Back-dnit-escola-env
region: us-east-1
version_label: ${{ github.run_id }}
version_description: ${{ github.sha }}
deployment_package: ${{ github.workspace }}/out.zip
run: dotnet test --no-build --verbosity normal
56 changes: 56 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Deploy AWS

on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'

- name: Install dependencies
run: dotnet restore

- name: Build
run: dotnet build --configuration Release --no-restore

- name: Test
run: dotnet test --no-restore --verbosity normal

- name: Publish
run: dotnet publish -c Release -o '${{ github.workspace }}/out'

- name: Create email service .env
run: |
echo 'EMAIL_SERVICE_ADDRESS=${{ secrets.EMAIL_SERVICE_ADDRESS }}' > '${{ github.workspace }}/out/.env'
echo 'EMAIL_SERVICE_PASSWORD=${{ secrets.EMAIL_SERVICE_PASSWORD }}' >> '${{ github.workspace }}/out/.env'
echo 'EMAIL_DNIT=${{ secrets.EMAIL_DNIT }}' >> '${{ github.workspace }}/out/.env'

- name: Zip Package
run: |
cd ${{ github.workspace }}/out
zip -r ${{ github.workspace }}/out.zip * .env

- name: Deploy to EB
uses: einaregilsson/beanstalk-deploy@v21
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
application_name: back-dnit-escola
environment_name: Back-dnit-escola-env
region: us-east-1
version_label: ${{ github.run_id }}
version_description: ${{ github.sha }}
deployment_package: ${{ github.workspace }}/out.zip
12 changes: 7 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,27 @@ jobs:
steps:
- name: Get file name
id: name
run: echo "::set-output name=file_name::fga-eps-mds-2023.1-Dnit-EscolaService-$(TZ='America/Sao_Paulo' date +'%m-%d-%Y-%H-%M-%S')-${{github.ref_name}}"
run: echo "::set-output name=file_name::fga-eps-mds_2023.2-Dnit-EscolaService-$(TZ='America/Sao_Paulo' date +'%m-%d-%Y-%H-%M-%S')-${{github.ref_name}}"

- name: Copy repository
- name: Copy repository and download metrics
uses: actions/checkout@v2
- run: wget $METRICS_URL -O ${{ steps.name.outputs.file_name }}.json
env:
METRICS_URL: ${{ secrets.METRICS_URL }}
- uses: actions/upload-artifact@v2

- name: Uploads file
uses: actions/upload-artifact@v2
with:
name: ${{ steps.name.outputs.file_name }}.json
path: ${{ steps.name.outputs.file_name }}.json

- name: Send metrics to doc repo
uses: dmnemec/[email protected]
env:
API_TOKEN_GITHUB: ${{ secrets.TOKEN_GITHUB }}
API_TOKEN_GITHUB: ${{ secrets.GIT_TOKEN }}
with:
source_file: ${{ steps.name.outputs.file_name }}.json
destination_repo: 'fga-eps-mds/2023.1-Dnit-DOC'
destination_repo: 'fga-eps-mds/2023.2-Dnit-DOC'
destination_folder: 'analytics-raw-data'
user_email: ${{ secrets.GIT_EMAIL}}
user_name: ${{ secrets.GIT_USER }}
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -362,3 +362,8 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd
/dominio/UsuarioDNIT.cs

coverage.*
app/build

report/
27 changes: 2 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,6 @@ FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build

WORKDIR /app

COPY EscolaService.sln ./
COPY app/app.csproj ./app/
COPY dominio/dominio.csproj ./dominio/
COPY repositorio/repositorio.csproj ./repositorio/
COPY service/service.csproj ./service/
COPY test/test.csproj ./test/
COPY . .

RUN dotnet restore

COPY . ./

RUN dotnet build -c Release

RUN dotnet publish app/app.csproj -c Release -o /app/out
RUN dotnet publish service/service.csproj -c Release -o /app/out
RUN dotnet publish repositorio/repositorio.csproj -c Release -o /app/out
RUN dotnet publish dominio/dominio.csproj -c Release -o /app/out
RUN dotnet publish test/test.csproj -c Release -o /app/out

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime

WORKDIR /app

COPY --from=build /app/out .

ENTRYPOINT ["dotnet", "app.dll"]
CMD dotnet watch --project app
19 changes: 6 additions & 13 deletions EscolaService.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ VisualStudioVersion = 17.0.32112.339
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "app", "app\app.csproj", "{A553D130-F52F-4C65-9EFA-DE58FAC021FA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dominio", "dominio\dominio.csproj", "{91F2F3EB-3054-4187-8E04-0E04EC55ED08}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "service", "service\service.csproj", "{7F390C74-6B61-4479-8840-E57D6B9E56C5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "repositorio", "repositorio\repositorio.csproj", "{456103BA-9130-4604-8AF7-49632FBAB6BB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "api", "api\api.csproj", "{91F2F3EB-3054-4187-8E04-0E04EC55ED08}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "test", "test\test.csproj", "{A6A560FE-BB47-4B88-AF9F-8AC9F5F856ED}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9283DB24-9EF4-4203-BDA7-F74DBE63BCF4}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -27,14 +28,6 @@ Global
{91F2F3EB-3054-4187-8E04-0E04EC55ED08}.Debug|Any CPU.Build.0 = Debug|Any CPU
{91F2F3EB-3054-4187-8E04-0E04EC55ED08}.Release|Any CPU.ActiveCfg = Release|Any CPU
{91F2F3EB-3054-4187-8E04-0E04EC55ED08}.Release|Any CPU.Build.0 = Release|Any CPU
{7F390C74-6B61-4479-8840-E57D6B9E56C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7F390C74-6B61-4479-8840-E57D6B9E56C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7F390C74-6B61-4479-8840-E57D6B9E56C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7F390C74-6B61-4479-8840-E57D6B9E56C5}.Release|Any CPU.Build.0 = Release|Any CPU
{456103BA-9130-4604-8AF7-49632FBAB6BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{456103BA-9130-4604-8AF7-49632FBAB6BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{456103BA-9130-4604-8AF7-49632FBAB6BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{456103BA-9130-4604-8AF7-49632FBAB6BB}.Release|Any CPU.Build.0 = Release|Any CPU
{A6A560FE-BB47-4B88-AF9F-8AC9F5F856ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A6A560FE-BB47-4B88-AF9F-8AC9F5F856ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A6A560FE-BB47-4B88-AF9F-8AC9F5F856ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ _Observação_: No EscolaServices, é necessario adicionar um arquivo ".env" den

- EMAIL_SERVICE_ADDRESS : email usado para enviar a mensagem.
- EMAIL_SERVICE_PASSWORD: senha do email acima.
- EMAIL_SERVICE_SMTP: endereco do servidor smtp
- EMAIL_DNIT: email que receberá a mensagem.

#### Windows e MacOs
Expand Down
Loading
Loading