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