Refactor frontend structure and enhance deployment workflows #11
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: | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| frontend: | |
| name: Frontend lint and build | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: frontend | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Lint frontend | |
| run: npm run lint | |
| - name: Build frontend | |
| run: npm run build | |
| backend: | |
| name: Backend sanity checks | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: backend | |
| env: | |
| BOT_TOKEN: "123456:TEST_TOKEN_FOR_CI" | |
| DATABASE_URL: "postgresql+asyncpg://user:pass@localhost:5432/santagym" | |
| REDIS_URL: "redis://localhost:6379/0" | |
| JWT_SECRET: "ci-jwt-secret" | |
| WEBHOOK_URL: "https://api.example.com" | |
| FRONTEND_URL: "https://example.com" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install Poetry | |
| uses: abatilo/actions-poetry@v4 | |
| with: | |
| poetry-version: "1.8.3" | |
| - name: Configure Poetry virtualenv | |
| run: poetry config virtualenvs.in-project true | |
| - name: Install backend dependencies | |
| run: poetry install --no-interaction --no-ansi --no-root | |
| - name: Compile backend sources | |
| run: poetry run python -m compileall app | |
| - name: Import API app | |
| run: poetry run python -c "from app.main_api import app; print(app.title)" | |
| - name: Render Alembic migration SQL | |
| run: poetry run alembic upgrade head --sql > /tmp/alembic.sql | |
| docker: | |
| name: Docker build validation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Validate docker compose config | |
| run: docker compose config | |
| - name: Validate local compose config | |
| run: docker compose --env-file .env.local.example -f docker-compose.yml -f docker-compose.local.yml config | |
| - name: Validate server compose config | |
| run: docker compose --env-file .env.server.example -f docker-compose.yml -f docker-compose.server.yml config | |
| - name: Build backend image | |
| run: docker build -f backend/Dockerfile backend | |
| - name: Build frontend image | |
| run: docker build -f frontend/Dockerfile frontend |