Refinamento e Teste do fluxo dos Workflows #163
Workflow Build and Test
name: Build and Test
on:
workflow_call:
push:
branches:
- main
- dev
pull_request:
types: [opened]
branches:
- main
permissions:
contents: read
jobs:
build_and_test:
name: Build and Test .Net
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache .NET packages
uses: actions/cache@v3
id: dotnet-cache
with:
path: ~/.nuget/packages
key: dotnet-packages-${{ github.repository }}
restore-keys: dotnet-packages-${{ github.repository }}
- name: Setup .NET
uses: actions/setup-dotnet@v3
if: steps.dotnet-cache.outputs.cache-hit != 'true'
with:
dotnet-version: 8.0.x
- name: Build and Restore App
run: dotnet build ./Despesas.WebApi/Despesas.WebApi.csproj --restore
continue-on-error: false
- name: Test .Net App
run: dotnet test ./XunitTests/XUnit.Tests.csproj
continue-on-error: false
build_and_test_angular:
name: Build and Test AngularApp
needs: build_and_test
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '21.*.*'
- name: Install Angular dependencies
run: |
npm install [email protected]
npm install -g @angular/core@16 @angular/cli@16
npm install
working-directory: AngularApp
- name: Build Angular App
run: npm run build
working-directory: AngularApp
- name: Test Angular App
run: npm run test:coverage
working-directory: AngularApp
trigger_tests_sonarcloud:
needs: build_and_test_angular
name: Test and Analysis Code In Sonar Cloud
uses: alexfariakof/app-despesas-pessoais/.github/workflows/test_analyse_in_Sonar_Cloud.yml@main
secrets: inherit
Workflow Test and Analysis Code In Sonar Cloud
name: Test and Analysis Code In Sonar Cloud
on:
workflow_call:
push:
branches:
- hotfix/*
- feature/*
- bugfix/*
pull_request:
types: [opened, synchronize, reopened]
branches:
- hotfix/*
- feature/*
- bugfix/*
permissions:
contents: read
jobs:
test_code_in_sonar:
name: Test and Analysis Code In Sonar Cloud
runs-on: windows-latest
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu'
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache SonarCloud packages
id: cache-sonar
uses: actions/cache@v3
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Create if not Exist Cache Sonar Packages
if: steps.cache-sonar.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path ~\sonar\cache -ItemType Directory
- 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: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '21.*.*'
- name: Install Angular dependencies
run: |
npm install [email protected]
npm install -g @angular/core@16 @angular/cli@16
npm install
working-directory: AngularApp
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
./.sonar/scanner/dotnet-sonarscanner begin /k:"alexfariakof_despesas-backend-api-net-core" /o:"alexfariakof" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="**/coverage.opencover.xml" /d:sonar.exclusions="**/XunitTests/**, **/Migrations.MsSqlServer/**, **/Migrations.MySqlServer/**, **/HyperMedia/**, **/.documents/**, *.sql, **/Program.cs, **/Despesas.DataSeeders/**, **/Despesas.CrossCutting/**, **/*.spec.ts, **/main.ts, **/environment.*, **/app-routing.module.ts, **/*.js, **/test.ts" /d:sonar.cs.lcov.reportPaths="**/TestResults/coveragereport/lcov.info" /d:sonar.typescript.opencover.reportsPaths="**/coverage/clover.xml" /d:sonar.typescript.lcov.reportPaths="**/coverage/lcov.info"
$baseDirectory = Get-Location
$projectAngular = (Resolve-Path -Path "$baseDirectory\AngularApp")
$sonarProjectFile = "$projectAngular\sonar-project.properties"
Remove-Item -Path $sonarProjectFile -Force
dotnet tool install -g dotnet-reportgenerator-globaltool
dotnet test ./XunitTests/XUnit.Tests.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect:"XPlat Code Coverage;Format=opencover"
./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
Workflow Deploy Development Project in AWS
name: Deploy Development Project in AWS
on:
push:
branches:
- staging
permissions:
contents: read
jobs:
trigger_build_and_test:
name: Triggered Deploy Dev
uses: alexfariakof/app-despesas-pessoais/.github/workflows/build_and_test.yml@main
secrets: inherit
deploy_dev:
needs: trigger_build_and_test
name: Docker Build and Publish in Development
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build Docker image
env:
DOCKER_CLI_AGGREGATE: 1
run: |
docker-compose -f docker-compose.dev.yml build
continue-on-error: false
- name: Push Docker image to Docker Hub
env:
DOCKER_LOGIN: ${{ secrets.DOCKER_LOGIN }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_CLI_AGGREGATE: 1
run: |
docker login -u ${{ secrets.DOCKER_LOGIN }} -p ${{ secrets.DOCKER_PASSWORD }}
docker push alexfariakof/api-despesas-backend-netcore-dev-img
continue-on-error: false
- name: Execute SSH Commands into EC2
env:
EC2_HOST: ${{ secrets.EC2_HOST }}
EC2_USERNAME: ${{ secrets.EC2_USERNAME }}
AWS_SSH_KEY: ${{ secrets.AWS_SSH_KEY }}
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.AWS_SSH_KEY }}
port: 22
script: |
./scripts/dp-api.dev.sh
continue-on-error: false
# trigger_e2e_tests:
# needs: deploy_dev
# name: Tests End-to-End Triggered
# uses: alexfariakof/app-despesas-pessoais/.github/workflows/tests_E2E.yml@main
# secrets: inherit
Workflow Deploy Production Project in AWS
name: Deploy Production Project in AWS
on:
push:
tags:
- v*.*.*
jobs:
trigger_build_and_test:
name: Triggered Deploy Prod
uses: alexfariakof/app-despesas-pessoais/.github/workflows/build_and_test.yml@main
secrets: inherit
deploy:
needs: trigger_build_and_test
name: Docker Build and Publish in Production
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build Docker image
env:
DOCKER_CLI_AGGREGATE: 1
run: |
docker-compose -f docker-compose.prod.yml build
continue-on-error: false
- name: Push Docker image to Docker Hub
env:
DOCKER_LOGIN: ${{ secrets.DOCKER_LOGIN }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_CLI_AGGREGATE: 1
run: |
docker login -u ${{ secrets.DOCKER_LOGIN }} -p ${{ secrets.DOCKER_PASSWORD }}
docker push ${{ secrets.DOCKER_IMAGE }}
continue-on-error: false
- name: Execute SSH Commands into EC2
env:
EC2_HOST: ${{ secrets.EC2_HOST }}
EC2_USERNAME: ${{ secrets.EC2_USERNAME }}
AWS_SSH_KEY: ${{ secrets.AWS_SSH_KEY }}
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.AWS_SSH_KEY }}
port: 22
script: |
./scripts/dp-api.prod.sh
continue-on-error: false
Workflow Tests End-to-End
- Disabled to "Review, Refacotry and Implementation new Features and Strategies"
name: Tests End-to-End
on:
workflow_call:
secrets:
ENV_PAT:
required: true
pull_request:
types: [opened, synchronize, reopened]
branches:
- staging
jobs:
trigger-tests-e2e:
runs-on: ubuntu-latest
steps:
- name: Trigger Workflow End-to-End
run: |
repo=${{ github.repository }}
file_path=$(echo "workflow_tests_e2e")
curl -X POST \
-H "Authorization: token ${{ secrets.ENV_PAT }}" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/alexfariakof/despesas-e2e-tests/dispatches \
-d "{\"event_type\":\"trigger-api-e2e-tests\", \"client_payload\": {\"unit\": false, \"integration\": true, \"father_workflow_id\": \"${{ github.run_id }}\", \"path\": \"$file_path\", \"repo\": \"$repo\" }}"
continue-on-error: false
- name: Wait Workflow End-to-End Initialize And Update File triggered-workflow-id
run: sleep 15
- name: Wait for Triggered Workflow Test e2e Run
run: |
download_url="https://raw.githubusercontent.com/${{ github.repository }}/attachments/triggered-workflow-id-${{ github.run_id }}"
curl -o triggered-workflow-id -L "$download_url"
triggered_workflow_id=$(cat triggered-workflow-id)
echo "Triggered Workflow ID: $triggered_workflow_id"
response=""
status=""
while true; do
response=$(curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.ENV_PAT }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/alexfariakof/despesas-e2e-tests/actions/runs/$triggered_workflow_id")
status=$(echo $response | jq -r '.status')
echo "Current status: $status"
if [ "$status" == "queued" ] || [ "$status" == "in_progress" ]; then
sleep 20
else
break
fi
done
conclusion=$(echo $response | jq -r '.conclusion')
echo "Conclusion: $conclusion"
if [ "$status" == "completed" ] && [ "$conclusion" == "success" ]; then
echo "workflow_status=${{ job.status }}" >> $GITHUB_OUTPUT
else
echo "workflow_status=failure" >> $GITHUB_OUTPUT
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
What's Changed
- Configure EnittyFramework to Mysql an add Migrations by @alexfariakof in #1
- Aws upload files by @alexfariakof in #2
- Criação PerFilFile by @alexfariakof in #3
- Aws upload files by @alexfariakof in #4
- Atualizando Projeto Test-XUnit by @alexfariakof in #9
- Deploy azure by @alexfariakof in #11
- Mysql server local by @alexfariakof in #12
- Update Azure Deploy by @alexfariakof in #13
- Atualizando Main by @alexfariakof in #14
- Atualizando Test-Xunit by @alexfariakof in #15
- Atualizando mysql-in-memory by @alexfariakof in #16
- Merge pull request #16 from alexfariakof/main by @alexfariakof in #17
- Merge pull request #16 from alexfariakof/main by @alexfariakof in #18
- Mysql server local by @alexfariakof in #19
- Mysql server local by @alexfariakof in #21
- Mysql server local by @alexfariakof in #22
- Atualizando Migrations by @alexfariakof in #23
- Atualizando Migrations by @alexfariakof in #24
- Mysql server local by @alexfariakof in #20
- Atuazalizando Migrations by @alexfariakof in #25
- Atualizando Branch Azure by @alexfariakof in #26
- update by @alexfariakof in #27
- Atualizando Brach de acordo com produção no azure by @alexfariakof in #28
- Atualizando branch de acordo com a aplicação em produção by @alexfariakof in #29
- Atualizando branch de acordo com a aplicação em produção by @alexfariakof in #30
- Atualizando branch de acordo com a aplicação em produção by @alexfariakof in #31
- Mysql server local to deploy-azure atualização by @alexfariakof in #32
- Adicionando Testes Unitário com Xunit by @alexfariakof in #33
- Atualizando branch Main by @alexfariakof in #34
- Atualizando Branch mysql-server-local by @alexfariakof in #35
- Atualizando Branch database-in-memory by @alexfariakof in #36
- Update README.md by @alexfariakof in #38
- Atualizando Configurações de acesso a chaves by @alexfariakof in #39
- Atualizando branch com novas configurações de segurança by @alexfariakof in #40
- Mudando Classe responsável pelo acesso ao S3Bucket para Infrastructu… by @alexfariakof in #41
- Fe controle acesso security endpoint by @alexfariakof in #42
- Implementação de Controle de Acesso by @alexfariakof in #43
- Atualizando aplicação em produção by @alexfariakof in #44
- Corrigindo Objeto AuthResponse by @alexfariakof in #45
- Fe 000004 by @alexfariakof in #46
- Colocando implantações da SPRINT-02 em produção by @alexfariakof in #47
- Atualizando Branch dev by @alexfariakof in #48
- Transformando Classe de Acesso ao S3Bucket em uma Classe do Tipo Singleton by @alexfariakof in #49
- Refatoração - Transformando Classe Crypto em um Singleton by @alexfariakof in #50
- Atualizando versão em produção by @alexfariakof in #51
- Bg fix change password by @alexfariakof in #52
- Atualizando Branch Main Sprint-02 by @alexfariakof in #53
- Testando Workflow GitActions by @alexfariakof in #54
- Testando GitActions Workflow de Publicação CI/CD na Branch main by @alexfariakof in #55
- Atualizando Branch pre-release by @alexfariakof in #61
- Testando Workflow GitActions by @alexfariakof in #62
- Testando nova arquitetura em produção by @alexfariakof in #63
- Teste GitActions pre-release by @alexfariakof in #64
- Atualizando Banch Dev Deacordo com a novas configurações aplicadas by @alexfariakof in #65
- Bugfix/id usuario should be null at once by @alexfariakof in #66
- Update CategoriaController.cs by @alexfariakof in #67
- Atualizando Branch Main com Correções de BUG by @alexfariakof in #68
- Update DespesaController.cs by @alexfariakof in #69
- Atualização com BUGS apontados pelo SONAR CLOUD by @alexfariakof in #70
- Publicando nova versão com bugs apontados pelo sonar corrigidos by @alexfariakof in #71
- Corrigindo implementação de tratamento do bug by @alexfariakof in #72
- Publicando nova versão com bugs apontados pelo sonar corrigidos by @alexfariakof in #73
- Update publish_project_in_production.yml by @alexfariakof in #74
- Feature/test xunit implementation by @alexfariakof in #75
- Feature/test xunit implementation by @alexfariakof in #76
- 'Merge feature/test-unit-EfRepository-exclude-from-project' by @alexfariakof in #78
- 'Merge feature/test-unit-EfRepository-exclude-from-project' by @alexfariakof in #79
- Feature/text unit implementations by @alexfariakof in #80
- Update Branch Dev With implments in Feature/test-unit-implementation-controllers by @alexfariakof in #81
- Dev by @alexfariakof in #82
- Feature/test xunit implementation ControleAcessoController by @alexfariakof in #83
- Atualizando Baranch Main com novas implementações Feature/test xunit implementation by @alexfariakof in #84
- Merge tag Dev And feature/test-xunit-implementation by @alexfariakof in #85
- Merge tag test-unit-implmentations-ImagemPerfilUsuarioBusinessImplTest by @alexfariakof in #87
- Atualização de Teste Unitários e Implementações corretivas by @alexfariakof in #88
- Atualização Branch Main by @alexfariakof in #89
- Criação de Teste Unitário para a Classe LancamentoRepositorioImpl#91 by @alexfariakof in #93
- Feature/test xunit implementation with 95.3% Coverage Test in Sonar Cloud by @alexfariakof in #95
- 'Merge DEV com 95,3% Coverage Test in Sonar Cloud by @alexfariakof in #96
- Merge branch 'feature/text-unit-implementation-EntityConfig-Maps-CLass by @alexfariakof in #98
- Implementação de Teste Unitário da Classe AmazonS3Bucket by @alexfariakof in #100
- Implementação de Teste Unitário da Classe AmazonS3Bucket (#100) by @alexfariakof in #101
- Implementação de Teste Unitário para cobertura de código da Classe CommonInjectDependence by @alexfariakof in #102
- hotfix/fixing-issues-in-project by @alexfariakof in #104
- make-crypto-class-in-complete-singleton by @alexfariakof in #106
- Update README.md by @alexfariakof in #107
- Dev by @alexfariakof in #108
- Implementations to Add Description Categoria in "Despesa and Receita VM" by @alexfariakof in #110
- Deploy In Production by @alexfariakof in #111
- Release/4.0.8 Reopened by @alexfariakof in #105
- Implementations New Endpoint to "Graficos and Saldo" by @alexfariakof in #113
- Deploy API In Production with New Implementations by @alexfariakof in #114
- Feature/new implementations imagem perfil usuario by @alexfariakof in #116
- Refactory Authentication Controller Access API by @alexfariakof in #115
- Feature/Implementations Add Required in ViewModels Objects props by @alexfariakof in #117
- Deploy Feature/Implementations Add Required in ViewModels Objects props by @alexfariakof in #118
- Implementations News Features in Workflow Development/Production by @alexfariakof in #121
- Deploy In Production Implementations Iteration 2 by @alexfariakof in #120
- Testing Execution Workflow "Tests End-to-End" Deploying Development Server by @alexfariakof in #122
- Testing "Deploy Development Server" and "Triggered Tests End-to-End" by @alexfariakof in #123
- Testing "Deploy Development Server" and "Triggered Tests End-to-End" by @alexfariakof in #124
- Testing "Deploy Development" and "triggered Workflow Tests End-to-End" by @alexfariakof in #125
- Testing "Deploy Development" and "triggered Workflow Tests End-to-End" by @alexfariakof in #126
- Testing "Deploy in Production" by @alexfariakof in #127
- New Architecture Implementations and Update Version to .Net Core 8.0 by @alexfariakof in #128
- Refactory Arch Code to use UnitOfWork and CQRS by @alexfariakof in #129
- Update with New Architecture by @alexfariakof in #130
- Dev by @alexfariakof in #131
- Feature/new implementations work flow git actions docker compose by @alexfariakof in #132
- Test New Workflow Implementations by @alexfariakof in #133
- Feature/Implementations Refresh Token by @alexfariakof in #134
- Test Implementations Refresh Token by @alexfariakof in #135
- Finish Implementations to fix bug in ImagemPerfilUsuario by @alexfariakof in #137
- Feature/Implementations Refresh Token by @alexfariakof in #138
- Feature/Implementations Refresh Token by @alexfariakof in #139
- Refactory Code to Documentation Swagger and HATEOAS by @alexfariakof in #140
- Refactory Code to Documentation Swagger and HATEOAS (#140) #42 by @alexfariakof in #141
- bugfix/Refinements & Review Code by @alexfariakof in #142
- Staging by @alexfariakof in #143
- feature Add Versioning Control to API by @alexfariakof in #144
- Deploy in Development feature Add Versioning Control to API (#144) by @alexfariakof in #147
- Deploy in Production feature Add Versioning Control to API (#144) (… by @alexfariakof in #148
- Feature Create Migratioins Azure Database Sql by @alexfariakof in #149
- Feature/create migrations azure sql server by @alexfariakof in #150
- Deploy Refectoring Project in Dev by @alexfariakof in #151
- feature/Refactory Code and Security Fixies by @alexfariakof in #152
- Feature/Implementations Security Hash Salt and Auth Key by @alexfariakof in #154
- Update LICENSE by @alexfariakof in #155
- Feature/Implementations Security Hash Salt and Auth Key (#154) #92 by @alexfariakof in #156
- Feature/Add SPA AngularApp in Project WebAPI by @alexfariakof in #157
- Test Workflow Deploy in Develop Server by @alexfariakof in #158
Full Changelog: https://github.com/alexfariakof/app-despesas-pessoais/commits/v2.0.0