updated implementation for file search #6
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 Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| env: | |
| DOTNET_VERSION: '8.0.x' | |
| NODE_VERSION: '18.x' | |
| jobs: | |
| test-backend: | |
| name: Backend Tests | |
| 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 dependencies | |
| working-directory: ./backend | |
| run: dotnet restore | |
| - name: Build | |
| working-directory: ./backend | |
| run: dotnet build --no-restore | |
| - name: Test | |
| working-directory: ./backend | |
| run: dotnet test --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./coverage | |
| - name: Upload coverage reports | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| directory: ./backend/coverage | |
| fail_ci_if_error: true | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| test-frontend: | |
| name: Frontend Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: ./frontend/package-lock.json | |
| - name: Install dependencies | |
| working-directory: ./frontend | |
| run: npm ci | |
| - name: Run tests | |
| working-directory: ./frontend | |
| run: npm test -- --coverage --watchAll=false | |
| - name: Run linting | |
| working-directory: ./frontend | |
| run: npm run lint | |
| build-backend: | |
| name: Build Backend Docker Image | |
| needs: test-backend | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./backend | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.repository }}/backend:latest | |
| ghcr.io/${{ github.repository }}/backend:${{ github.sha }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-frontend: | |
| name: Build Frontend Docker Image | |
| needs: test-frontend | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./frontend | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.repository }}/frontend:latest | |
| ghcr.io/${{ github.repository }}/frontend:${{ github.sha }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| deploy-staging: | |
| name: Deploy to Staging | |
| needs: [build-backend, build-frontend] | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/develop' && github.event_name == 'push' | |
| environment: staging | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Deploy to staging | |
| run: | | |
| echo "Deployment to staging would happen here" | |
| # Add actual deployment logic here | |
| deploy-production: | |
| name: Deploy to Production | |
| needs: [build-backend, build-frontend] | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| environment: production | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Deploy to production | |
| run: | | |
| echo "Deployment to production would happen here" | |
| # Add actual deployment logic here |