From 031082f4c0a466f07f23707af6b1b4bcdc6ee94b Mon Sep 17 00:00:00 2001 From: Egor Deev Date: Mon, 5 Oct 2026 18:42:17 +0000 Subject: [PATCH] =?UTF-8?q?requirements.txt,=20CI=20=D0=B8=20=D1=81=D0=B1?= =?UTF-8?q?=D0=BE=D1=80=D0=BA=D0=B0=20.exe=20=D0=B2=20=D1=80=D0=B5=D0=BB?= =?UTF-8?q?=D0=B8=D0=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI: ruff и запуск окна в offscreen-режиме с чтением базы. По тегу v* GitHub Actions собирает SchoolTable.exe (PyInstaller) и кладёт в релиз архив с exe, пустой базой и иконкой. --- .github/workflows/ci.yml | 32 ++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 25 +++++++++++++++++++++++++ requirements.txt | 1 + 3 files changed, 58 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml create mode 100644 requirements.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ed9777d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,32 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - run: sudo apt-get update -qq && sudo apt-get install -y -qq libegl1 libxkbcommon0 libdbus-1-3 + - run: pip install ruff==0.14.0 -r requirements.txt + - name: Ruff (синтаксис и ошибки) + run: ruff check --select E9,F main.py + - name: Окно открывается и читает базу + env: + QT_QPA_PLATFORM: offscreen + run: | + python -c " + import sys + from PyQt5.QtWidgets import QApplication, QMessageBox + QMessageBox.about = staticmethod(lambda *a: sys.exit('ошибка: ' + a[2])) + import main + app = QApplication(sys.argv) + w = main.MyWidget() + assert w.Mon_school.rowCount() == 8 + print('ok')" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1095a60 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,25 @@ +name: Release + +on: + push: + tags: ["v*"] + +jobs: + exe: + runs-on: windows-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - run: pip install pyinstaller -r requirements.txt + - name: Сборка .exe + run: pyinstaller --onefile --windowed --icon image.ico --name SchoolTable main.py + - name: Архив с программой, пустой базой и иконкой + run: Compress-Archive -Path dist/SchoolTable.exe, table.db, image.ico -DestinationPath SchoolTable-windows.zip + - name: Файл в релиз + env: + GH_TOKEN: ${{ github.token }} + run: gh release upload "${{ github.ref_name }}" SchoolTable-windows.zip --clobber diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..cc995cd --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +PyQt5==5.15.11