Remove unused .pfx file from the project and update .gitignore to exc… #2
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/CD | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| build-test: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:15.1 | |
| env: | |
| POSTGRES_DB: testdb | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
| redis: | |
| image: redis:7.0 | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 | |
| mailpit: | |
| image: axllent/mailpit:latest | |
| ports: | |
| - 3025:1025 | |
| - 8025:8025 | |
| options: >- | |
| --health-cmd "nc -z localhost 1025" --health-interval 10s --health-timeout 5s --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "8.0.x" | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --no-restore --configuration Release | |
| - name: Run Unit Tests | |
| run: dotnet test ./tests/BookLibraryAPI.UnitTests/BookLibraryAPI.UnitTests.csproj --no-build --configuration Release --logger "trx;LogFileName=unit_tests.trx" | |
| - name: Run Integration Tests | |
| run: dotnet test ./tests/BookLibraryAPI.IntegrationTests/BookLibraryAPI.IntegrationTests.csproj --no-build --configuration Release --logger "trx;LogFileName=integration_tests.trx" | |
| - name: Upload Test Results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results | |
| path: tests/**/*.trx | |
| docker-deploy: | |
| needs: build-test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: abdulwaisa | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push app image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: src/Presentation/BookLibraryAPI.Presentation/Dockerfile | |
| push: true | |
| tags: abdulwaisa/booklibraryapi:latest | |
| - name: Deploy with Docker Compose | |
| run: | | |
| docker compose -f compose.yaml up -d |