feat: added budget proposal #40
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: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| workflow_dispatch: | |
| env: | |
| NODE_VERSION: '18' | |
| POSTGRES_USER: test | |
| POSTGRES_PASSWORD: test | |
| POSTGRES_DB: budgetchain_test | |
| DATABASE_URL: postgresql://test:test@localhost:5432/budgetchain_test | |
| 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 | |
| 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 | |
| # - 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 | |
| # 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.budgetchain.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 budgetchain-backend \ | |
| # --version-label "staging-${{ github.sha }}" \ | |
| # --source-bundle S3Bucket="${{ secrets.EB_BUCKET }}",S3Key="staging-${{ github.sha }}.zip" | |
| # aws elasticbeanstalk update-environment \ | |
| # --environment-name budgetchain-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.budgetchain.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 budgetchain-backend \ | |
| # --version-label "prod-${{ github.sha }}" \ | |
| # --source-bundle S3Bucket="${{ secrets.EB_BUCKET }}",S3Key="prod-${{ github.sha }}.zip" | |
| # aws elasticbeanstalk update-environment \ | |
| # --environment-name budgetchain-production \ | |
| # --version-label "prod-${{ github.sha }}" |