From 01426ea9eb68ddae599ccd8b332c5b929fa5b616 Mon Sep 17 00:00:00 2001 From: ZProger Date: Wed, 2 Sep 2026 02:35:45 +0300 Subject: [PATCH] =?UTF-8?q?ci:=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20GitHub=20Actions=20=D0=B4=D0=BB=D1=8F=20=D1=82?= =?UTF-8?q?=D0=B5=D1=81=D1=82=D0=BE=D0=B2=20=D0=B1=D1=8D=D0=BA=D0=B5=D0=BD?= =?UTF-8?q?=D0=B4=D0=B0=20=D0=B8=20=D1=81=D0=B1=D0=BE=D1=80=D0=BA=D0=B8=20?= =?UTF-8?q?=D1=84=D1=80=D0=BE=D0=BD=D1=82=D0=B5=D0=BD=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Раньше пул-реквесты никак не проверялись автоматически — сломанный PR можно было смержить, ничего бы не показало проблему. Теперь на каждый PR и пуш в main гоняются 115 backend-тестов (реальный Postgres в сервис- контейнере, та же схема, что и в tests/README.md) и сборка фронтенда (tsc + vite build). --- .github/workflows/ci.yml | 66 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..feb01df --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,66 @@ +name: CI + +# Runs on every pull request and on pushes to main, so a broken PR shows a +# red check before it's mergeable (enable "Require status checks to pass" +# in branch protection for main to actually block the merge button on it). +on: + pull_request: + push: + branches: [main] + +jobs: + backend-tests: + runs-on: ubuntu-latest + services: + # A real Postgres, not sqlite — tests/conftest.py creates/migrates/ + # drops a dedicated aurum_test database against it, same as the local + # `docker compose exec backend pytest` workflow in tests/README.md. + postgres: + image: postgres:16-alpine + env: + POSTGRES_USER: aurum + POSTGRES_PASSWORD: aurum + POSTGRES_DB: aurum + ports: + - 5432:5432 + options: >- + --health-cmd "pg_isready -U aurum" + --health-interval 5s + --health-timeout 5s + --health-retries 10 + env: + AURUM_POSTGRES_USER: aurum + AURUM_POSTGRES_PASSWORD: aurum + AURUM_POSTGRES_DB: aurum + AURUM_POSTGRES_HOST: localhost + AURUM_POSTGRES_PORT: 5432 + defaults: + run: + working-directory: backend + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: pip + cache-dependency-path: backend/requirements-dev.txt + - run: pip install -r requirements-dev.txt + - run: pytest -v + + frontend-build: + runs-on: ubuntu-latest + defaults: + run: + working-directory: frontend + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "22" + cache: npm + cache-dependency-path: frontend/package-lock.json + - run: npm ci + # tsc -b (type-check) then vite build — catches both a broken build + # and a type error a PR might introduce, same as `npm run build` + # locally before shipping a change. + - run: npm run build