fix forking all branches #7
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 Pipeline | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: 'frontend/package-lock.json' | |
| - name: Install backend dependencies | |
| run: pip install -r ns-python-react-exercise/backend/requirements.txt | |
| - name: Install frontend dependencies | |
| run: | | |
| cd ns-python-react-exercise/frontend | |
| npm ci | |
| - name: Run backend linters | |
| run: | | |
| cd ns-python-react-exercise/backend | |
| flake8 . | |
| black --check . | |
| - name: Run frontend linter | |
| run: | | |
| cd ns-python-react-exercise/frontend | |
| npm run lint | |
| backend_tests: | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| services: | |
| db: | |
| image: postgres:18.1 | |
| env: | |
| POSTGRES_DB: fintech_db | |
| POSTGRES_USER: fintech_user | |
| POSTGRES_PASSWORD: fintech_password | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U fintech_user -d fintech_db" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install backend dependencies | |
| run: pip install -r ns-python-react-exercise/backend/requirements.txt | |
| - name: Run backend tests | |
| run: | | |
| cd ns-python-react-exercise | |
| pytest | |
| env: | |
| DATABASE_URL: postgresql://fintech_user:fintech_password@localhost:5432/fintech_db | |
| SECRET_KEY: test-secret-key | |
| frontend_e2e_tests: | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: 'frontend/package-lock.json' | |
| - name: Install frontend dependencies | |
| run: | | |
| cd ns-python-react-exercise/frontend | |
| npm ci | |
| - name: Install Playwright Browsers | |
| run: | | |
| cd ns-python-react-exercise/frontend | |
| npx playwright install --with-deps | |
| - name: Build and start services | |
| run: | | |
| cd ns-python-react-exercise | |
| docker-compose up -d --build | |
| - name: Run Playwright tests | |
| run: | | |
| cd ns-python-react-exercise/frontend | |
| npx playwright test |