Pull Request for Implement Notification System #17
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, develop ] | |
| workflow_dispatch: | |
| env: | |
| NODE_VERSION: '18' | |
| # Database configuration - commented out as not currently used | |
| # POSTGRES_USER: postgres | |
| # POSTGRES_PASSWORD: password | |
| # POSTGRES_DB: chainremit_db | |
| # DATABASE_URL: postgresql://postgres:password@localhost:5432/chainremit_db | |
| jobs: | |
| quality: | |
| name: Code Quality | |
| 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' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Lint | |
| run: npm run lint | |
| - name: Check formatting | |
| run: npm run format -- --check | |
| - name: Security audit | |
| run: npm audit fix | |
| test: | |
| name: Tests | |
| needs: quality | |
| runs-on: ubuntu-latest | |
| # Database service - commented out as not currently used | |
| # services: | |
| # postgres: | |
| # image: postgres:14 | |
| # env: | |
| # POSTGRES_USER: ${{ env.POSTGRES_USER }} | |
| # POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }} | |
| # POSTGRES_DB: ${{ env.POSTGRES_DB }} | |
| # ports: | |
| # - 5432:5432 | |
| # options: >- | |
| # --health-cmd pg_isready | |
| # --health-interval 10s | |
| # --health-timeout 5s | |
| # --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run unit tests | |
| run: npm run test | |
| # Database-dependent tests - commented out | |
| # - name: Run e2e tests | |
| # run: npm run test:e2e | |
| # env: | |
| # DATABASE_URL: ${{ env.DATABASE_URL }} | |
| # - name: Upload coverage reports | |
| # uses: codecov/codecov-action@v3 | |
| # with: | |
| # token: ${{ secrets.CODECOV_TOKEN }} | |
| build: | |
| name: Build | |
| needs: test | |
| 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' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist | |
| # Deployment jobs remain commented out as they were | |
| # deploy-staging: | |
| # name: Deploy to Staging | |
| # needs: build | |
| # if: github.ref == 'refs/heads/develop' | |
| # runs-on: ubuntu-latest | |
| # environment: | |
| # name: staging | |
| # url: https://staging-api.chainremit.com | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - name: Download build artifacts | |
| # uses: actions/download-artifact@v3 | |
| # with: | |
| # name: dist | |
| # path: dist | |
| # - name: Configure AWS credentials | |
| # uses: aws-actions/configure-aws-credentials@v4 | |
| # with: | |
| # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| # aws-region: ${{ secrets.AWS_REGION }} | |
| # - name: Deploy to AWS Elastic Beanstalk | |
| # run: | | |
| # aws elasticbeanstalk create-application-version \ | |
| # --application-name chainremit-backend \ | |
| # --version-label "staging-${{ github.sha }}" \ | |
| # --source-bundle S3Bucket="${{ secrets.EB_BUCKET }}",S3Key="staging-${{ github.sha }}.zip" | |
| # aws elasticbeanstalk update-environment \ | |
| # --environment-name chainremit-staging \ | |
| # --version-label "staging-${{ github.sha }}" | |
| # deploy-production: | |
| # name: Deploy to Production | |
| # needs: build | |
| # if: github.ref == 'refs/heads/main' | |
| # runs-on: ubuntu-latest | |
| # environment: | |
| # name: production | |
| # url: https://api.chainremit.com | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # - name: Download build artifacts | |
| # uses: actions/download-artifact@v3 | |
| # with: | |
| # name: dist | |
| # path: dist | |
| # - name: Configure AWS credentials | |
| # uses: aws-actions/configure-aws-credentials@v4 | |
| # with: | |
| # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| # aws-region: ${{ secrets.AWS_REGION }} | |
| # - name: Deploy to AWS Elastic Beanstalk | |
| # run: | | |
| # aws elasticbeanstalk create-application-version \ | |
| # --application-name chainremit-backend \ | |
| # --version-label "prod-${{ github.sha }}" \ | |
| # --source-bundle S3Bucket="${{ secrets.EB_BUCKET }}",S3Key="prod-${{ github.sha }}.zip" | |
| # aws elasticbeanstalk update-environment \ | |
| # --environment-name chainremit-production \ | |
| # --version-label "prod-${{ github.sha }}" |