Skip to content

fix: enforce soft-delete across queries, patch XSS, restore edge cases #2

fix: enforce soft-delete across queries, patch XSS, restore edge cases

fix: enforce soft-delete across queries, patch XSS, restore edge cases #2

Workflow file for this run

name: CI/CD
on:
push:
branches: [ main ]
tags: ['v*']
pull_request:
branches: [ main ]
env:
REGISTRY: ghcr.io
IMAGE_PREFIX: ghcr.io/${{ github.repository }}
jobs:
backend-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Set up Python
run: uv python install 3.12
- name: Install dependencies
run: |
cd backend
uv venv
uv pip install -r requirements.txt -r requirements-dev.txt pytest-cov
- name: Run tests with coverage
run: |
cd backend
source .venv/bin/activate
export PYTHONPATH=$PYTHONPATH:.
pytest --cov=app --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./backend/coverage.xml
flags: backend
token: ${{ secrets.CODECOV_TOKEN }}
continue-on-error: true
frontend-tests:
runs-on: ubuntu-latest
steps:
- 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 dependencies
run: |
cd frontend
npm ci
- name: Lint
run: |
cd frontend
npm run lint
- name: Run tests with coverage
run: |
cd frontend
npm test -- --coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./frontend/coverage/clover.xml
flags: frontend
token: ${{ secrets.CODECOV_TOKEN }}
continue-on-error: true
build-and-push:
needs: [backend-tests, frontend-tests]
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
component: [backend, frontend]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_PREFIX }}/${{ matrix.component }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=
- name: Build and push ${{ matrix.component }}
uses: docker/build-push-action@v6
with:
context: ./${{ matrix.component }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max