From d48bab832f7ffab2a27d6ce2b4e649c8bbddafd9 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Thu, 19 Feb 2026 23:55:17 +0500 Subject: [PATCH 1/2] =?UTF-8?q?CI=20=D0=B4=D0=BB=D1=8F=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B8=20=D1=82=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D0=BE=D0=B2=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=20=D0=B2=D0=BD?= =?UTF-8?q?=D0=B5=D1=81=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC=20=D0=B8=D0=B7=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=B2=20master?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 63 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 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..57c0161 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,63 @@ +name: CI + +on: + workflow_dispatch: + push: + branches: ["master"] + pull_request: + +jobs: + tests: + runs-on: ubuntu-latest + + services: + postgres: + image: postgres:16 + env: + POSTGRES_DB: subflux_test + POSTGRES_USER: subflux + POSTGRES_PASSWORD: subflux + ports: + - 5432:5432 + options: >- + --health-cmd="pg_isready -U subflux -d subflux_test" + --health-interval=5s + --health-timeout=5s + --health-retries=20 + + env: + PYTHONUNBUFFERED: "1" + DJANGO_SETTINGS_MODULE: config.settings + DATABASE_URL: postgresql://subflux:subflux@127.0.0.1:5432/subflux_test + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: "pip" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install pytest pytest-django + + - name: Wait for Postgres + run: | + for i in {1..30}; do + pg_isready -h 127.0.0.1 -p 5432 -U subflux -d subflux_test && break + sleep 1 + done + + # Прогон миграций перед тестами + - name: Django migrate (CI) + run: | + python manage.py migrate --noinput + + - name: Run tests + run: | + pytest -q \ No newline at end of file From 3658165d762ea5777a22e8a43c8edc262250627b Mon Sep 17 00:00:00 2001 From: Nikolay Petukhov Date: Fri, 20 Feb 2026 00:17:53 +0500 Subject: [PATCH 2/2] Update ci.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Замена DATABASE_URL на параметры для БД --- .github/workflows/ci.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 57c0161..03e97d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,7 +28,12 @@ jobs: env: PYTHONUNBUFFERED: "1" DJANGO_SETTINGS_MODULE: config.settings - DATABASE_URL: postgresql://subflux:subflux@127.0.0.1:5432/subflux_test + + POSTGRES_NAME: subflux_test + POSTGRES_USER: subflux + POSTGRES_PASSWORD: subflux + POSTGRES_HOST: 127.0.0.1 + POSTGRES_PORT: "5432" steps: - name: Checkout @@ -60,4 +65,4 @@ jobs: - name: Run tests run: | - pytest -q \ No newline at end of file + pytest -q