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: Backend CI | ||
| on: | ||
| pull_request: | ||
| paths: | ||
| - "backend/**" | ||
| push: | ||
| branches: [master] | ||
| paths: | ||
| - "backend/**" | ||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: backend | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
| - name: Set up uv | ||
| uses: astral-sh/setup-uv@v4 | ||
| with: | ||
| enable-cache: true | ||
| cache-dependency-glob: "backend/uv.lock" | ||
| - name: Install dependencies | ||
| run: uv sync --dev | ||
| - name: Run ruff | ||
| run: uv run ruff check . | ||
| - name: Run mypy | ||
| run: uv run mypy src tests | ||
| - name: Run pytest with coverage | ||
| run: uv run pytest --cov=src --cov-report=term-missing --cov-fail-under=70 | ||
| deploy: | ||
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | ||
| needs: lint-test | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: backend | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
| - name: Set up uv | ||
| uses: astral-sh/setup-uv@v4 | ||
| with: | ||
| enable-cache: true | ||
| cache-dependency-glob: "backend/uv.lock" | ||
| - name: Set up Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "20" | ||
| - name: Install npm dependencies | ||
| run: npm ci | ||
| - name: Install Python dependencies | ||
| run: uv sync --dev | ||
| - name: Deploy Cloudflare Worker | ||
| env: | ||
| CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }} | ||
| CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} | ||
| CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }} | ||
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} | ||
| run: uv run pywrangler deploy | ||