Se configuro los datos de cuidador #23
This file contains hidden or 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
| name: CI Pipeline | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| DOTNET_VERSION: '10.0.x' | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Restore | |
| run: dotnet restore API.Dialitech.slnx | |
| - name: Build | |
| run: dotnet build API.Dialitech.slnx --no-restore -c Release | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-output | |
| path: | | |
| API.Dialitech/bin/Release/net10.0 | |
| API.Dialitech.Domain/bin/Release/net10.0 | |
| API.Dialitech.Application/bin/Release/net10.0 | |
| API.Dialitech.Infrastructure/bin/Release/net10.0 | |
| unit-tests: | |
| name: Unit Tests | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Restore | |
| run: dotnet restore API.Dialitech.slnx | |
| - name: Run Unit Tests | |
| run: dotnet test API.Dialitech.UnitTest/API.Dialitech.UnitTest.csproj --no-restore -c Release --logger "trx" --results-directory TestResults | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: unit-test-results | |
| path: TestResults | |
| if: always() | |
| integration-tests: | |
| name: Integration Tests | |
| needs: build | |
| runs-on: ubuntu-latest | |
| services: | |
| mongodb: | |
| image: mongo:7 | |
| ports: | |
| - 27017:27017 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Restore | |
| run: dotnet restore API.Dialitech.slnx | |
| - name: Run Integration Tests | |
| run: dotnet test API.Dialitech.IntegrationTest/API.Dialitech.IntegrationTest.csproj --no-restore -c Release --logger "trx" --results-directory TestResults | |
| env: | |
| MongoDbSettings__ConnectionString: mongodb://localhost:27017 | |
| MongoDbSettings__DatabaseName: DialitechDB_Test_CI | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: integration-test-results | |
| path: TestResults | |
| if: always() | |
| security-tests: | |
| name: Security Tests | |
| needs: build | |
| runs-on: ubuntu-latest | |
| services: | |
| mongodb: | |
| image: mongo:7 | |
| ports: | |
| - 27017:27017 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Restore | |
| run: dotnet restore API.Dialitech.slnx | |
| - name: Run Security Tests | |
| run: dotnet test API.Dialitech.SecurityTest/API.Dialitech.SecurityTest.csproj --no-restore -c Release --logger "trx" --results-directory TestResults | |
| env: | |
| MongoDbSettings__ConnectionString: mongodb://localhost:27017 | |
| MongoDbSettings__DatabaseName: DialitechDB_Test_Security_CI | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: security-test-results | |
| path: TestResults | |
| if: always() | |
| vulnerability-scan: | |
| name: Vulnerability Scan | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Restore | |
| run: dotnet restore API.Dialitech.slnx | |
| - name: List vulnerable packages | |
| run: dotnet list API.Dialitech.slnx package --vulnerable 2>&1 || true | |
| - name: Run Trivy vulnerability scanner | |
| uses: aquasecurity/trivy-action@master | |
| with: | |
| scan-type: 'fs' | |
| scan-ref: '.' | |
| format: 'table' | |
| exit-code: '1' | |
| severity: 'HIGH,CRITICAL' | |
| docker: | |
| name: Build Docker Image | |
| needs: [unit-tests, integration-tests, security-tests, vulnerability-scan] | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: API.Dialitech/Dockerfile | |
| push: false | |
| tags: api-dialitech:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |