chore(backend): Bump Microsoft.EntityFrameworkCore.SqlServer from 8.0… #17
Workflow file for this run
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: Backend CI/CD | ||
|
Check failure on line 1 in .github/workflows/backend-ci.yml
|
||
| on: | ||
| push: | ||
| branches: [ main, develop ] | ||
| paths: | ||
| - 'Backend/**' | ||
| - '.github/workflows/backend-ci.yml' | ||
| pull_request: | ||
| branches: [ main, develop ] | ||
| paths: | ||
| - 'Backend/**' | ||
| - '.github/workflows/backend-ci.yml' | ||
| env: | ||
| DOTNET_VERSION: '8.0.x' | ||
| jobs: | ||
| build-and-test: | ||
| name: Build and Test Backend | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: ${{ env.DOTNET_VERSION }} | ||
| - name: Restore dependencies | ||
| run: dotnet restore | ||
| working-directory: ./Backend | ||
| - name: Build | ||
| run: dotnet build --configuration Release --no-restore | ||
| working-directory: ./Backend | ||
| - name: Run tests | ||
| run: dotnet test --no-restore --verbosity normal --configuration Release | ||
| working-directory: ./Backend | ||
| continue-on-error: true | ||
| - name: Publish | ||
| run: dotnet publish --configuration Release --no-build --output ./publish | ||
| working-directory: ./Backend | ||
| - name: Upload build artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: backend-build | ||
| path: ./Backend/publish | ||
| retention-days: 7 | ||
| code-quality: | ||
| name: Code Quality Analysis | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: ${{ env.DOTNET_VERSION }} | ||
| - name: Restore dependencies | ||
| run: dotnet restore | ||
| working-directory: ./Backend | ||
| - name: Format check | ||
| run: dotnet format --verify-no-changes --verbosity diagnostic | ||
| working-directory: ./Backend | ||
| continue-on-error: true | ||
| - name: Security scan | ||
| uses: anchore/scan-action@v3 | ||
| with: | ||
| path: ./Backend | ||
| fail-build: false | ||
| continue-on-error: true | ||
| docker-build: | ||
| name: Build Docker Image | ||
| runs-on: ubuntu-latest | ||
| needs: build-and-test | ||
| if: github.event_name == 'push' | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
| - name: Log in to Docker Hub | ||
| if: github.ref == 'refs/heads/main' | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: ${{ secrets.DOCKER_USERNAME }} | ||
| password: ${{ secrets.DOCKER_PASSWORD }} | ||
| continue-on-error: true | ||
| - name: Extract metadata | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: ${{ secrets.DOCKER_USERNAME }}/todoapp-backend | ||
| tags: | | ||
| type=ref,event=branch | ||
| type=ref,event=pr | ||
| type=semver,pattern={{version}} | ||
| type=semver,pattern={{major}}.{{minor}} | ||
| type=sha,prefix={{branch}}- | ||
| - name: Build and push Docker image | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: ./Backend | ||
| file: ./Backend/Dockerfile | ||
| push: ${{ github.ref == 'refs/heads/main' && secrets.DOCKER_USERNAME != '' }} | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
| - name: Build Docker image locally | ||
| if: github.ref != 'refs/heads/main' || secrets.DOCKER_USERNAME == '' | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: ./Backend | ||
| file: ./Backend/Dockerfile | ||
| push: false | ||
| tags: todoapp-backend:${{ github.sha }} | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||