ci/cd fix #9
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 | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:12 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: strbook_test | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install Dependencies | |
| run: | | |
| npm ci | |
| cd backend && npm ci | |
| - name: Run Frontend Linting | |
| run: npm run lint || true | |
| - name: Run Frontend Tests | |
| run: npm test -- --coverage --watchAll=false | |
| - name: Run Backend Tests | |
| run: cd backend && npm test | |
| - name: Build Frontend | |
| run: npm run build | |
| - name: Upload Build Artifact | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: build | |
| path: build/ |