1
0
Fork 0
mirror of https://github.com/EDeev/quizlab.git synced 2026-10-07 20:49:34 +03:00

Compare commits

...

2 commits
v1.0.0 ... main

5 changed files with 107 additions and 8 deletions

40
.github/workflows/docker.yml vendored Normal file
View file

@ -0,0 +1,40 @@
name: Docker
on:
push:
tags: ["v*"]
workflow_dispatch:
jobs:
image:
name: Образ ${{ matrix.part }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
part: [backend, nginx]
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# один пакет quizlab, части API различаются тегами: backend-1.2.3 / backend, nginx-1.2.3 / nginx
- id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/edeev/quizlab
flavor: latest=false
tags: |
type=semver,pattern={{version}},prefix=${{ matrix.part }}-
type=raw,value=${{ matrix.part }}
- uses: docker/build-push-action@v6
with:
context: lab-2/local/${{ matrix.part }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View file

@ -30,15 +30,32 @@ jobs:
# рантайм MSVC рядом с программой — чтобы не требовался Visual C++ Redistributable # рантайм MSVC рядом с программой — чтобы не требовался Visual C++ Redistributable
foreach ($d in "msvcp140.dll","msvcp140_1.dll","vcruntime140.dll","vcruntime140_1.dll") { Copy-Item "$env:WINDIR\System32\$d" dist/quizlab-client/ } foreach ($d in "msvcp140.dll","msvcp140_1.dll","vcruntime140.dll","vcruntime140_1.dll") { Copy-Item "$env:WINDIR\System32\$d" dist/quizlab-client/ }
Compress-Archive -Path dist/quizlab-client -DestinationPath quizlab-client-windows-x64.zip Compress-Archive -Path dist/quizlab-client -DestinationPath quizlab-client-windows-x64.zip
- name: Установщик (Inno Setup)
run: |
choco install innosetup --no-progress -y | Out-Null
$v = if ("${{ github.ref_type }}" -eq "tag") { "${{ github.ref_name }}".TrimStart("v") } else { "0.0.0" }
& "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe" /Q "/DAppVersion=$v" lab-3/installer/quizlab-client.iss
- name: Проверка — установщик ставит программу, она запускается
run: |
Start-Process -Wait -FilePath .\quizlab-client-setup.exe -ArgumentList "/VERYSILENT","/CURRENTUSER","/SUPPRESSMSGBOXES","/DIR=$env:RUNNER_TEMP\qc"
$exe = "$env:RUNNER_TEMP\qc\quizlab-client.exe"
if (-not (Test-Path $exe)) { throw "после установки нет quizlab-client.exe" }
$p = Start-Process -FilePath $exe -ArgumentList "-platform","offscreen" -PassThru
Start-Sleep -Seconds 5
if ($p.HasExited) { throw "клиент завершился с кодом $($p.ExitCode)" }
Stop-Process -Id $p.Id -Force
"клиент установлен и работает"
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: windows name: windows
path: quizlab-client-windows-x64.zip path: |
quizlab-client-windows-x64.zip
quizlab-client-setup.exe
- name: Файл в релиз - name: Файл в релиз
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
env: env:
GH_TOKEN: ${{ github.token }} GH_TOKEN: ${{ github.token }}
run: gh release upload "${{ github.ref_name }}" quizlab-client-windows-x64.zip --clobber run: gh release upload "${{ github.ref_name }}" quizlab-client-windows-x64.zip quizlab-client-setup.exe --clobber
linux: linux:
name: Qt-клиент для Linux (AppImage) name: Qt-клиент для Linux (AppImage)

View file

@ -30,7 +30,7 @@ Deployment options in the second lab:
| Folder | Images | PostgreSQL | | Folder | Images | PostgreSQL |
|---|---|---| |---|---|---|
| `local/` | built from source | in a container | | `local/` | built from source | in a container |
| `web_pg/` | prebuilt `git.deev.su/deevev/quizlab` | in a container | | `web_pg/` | prebuilt `git.deev.su/deevev/quizlab` (same as `ghcr.io/edeev/quizlab`) | in a container |
| `web_lite/` | prebuilt `git.deev.su/deevev/quizlab` | external | | `web_lite/` | prebuilt `git.deev.su/deevev/quizlab` | external |
| `caddy/` | built from source, Caddy instead of nginx, HTTPS with a self-signed certificate | in a container | | `caddy/` | built from source, Caddy instead of nginx, HTTPS with a self-signed certificate | in a container |
@ -65,8 +65,9 @@ docker compose up -d # API at http://localhost/api/quiz/
The other options run the same way from their folders. For `caddy/`, run `sh gen-cert.sh` first; the site The other options run the same way from their folders. For `caddy/`, run `sh gen-cert.sh` first; the site
opens at `https://localhost`. opens at `https://localhost`.
A prebuilt client is in the [releases](https://github.com/EDeev/quizlab/releases/latest): `quizlab-client-windows-x64.zip` A prebuilt client is in the [releases](https://github.com/EDeev/quizlab/releases/latest): `quizlab-client-setup.exe` — a
(unpack and run `quizlab-client.exe`) and `quizlab-client-linux-x86_64.AppImage` (`chmod +x` and run). Windows installer (Start menu shortcut), `quizlab-client-windows-x64.zip` — the same without installing (unpack and run
`quizlab-client.exe`), and `quizlab-client-linux-x86_64.AppImage` (`chmod +x` and run).
Building the client from source (needs Qt 6 and CMake): Building the client from source (needs Qt 6 and CMake):

View file

@ -30,7 +30,7 @@ C++17 · Qt 6 (Widgets, Network) · CMake
| Папка | Образы | PostgreSQL | | Папка | Образы | PostgreSQL |
|---|---|---| |---|---|---|
| `local/` | собираются из исходников | в контейнере | | `local/` | собираются из исходников | в контейнере |
| `web_pg/` | готовые из `git.deev.su/deevev/quizlab` | в контейнере | | `web_pg/` | готовые из `git.deev.su/deevev/quizlab` (то же — `ghcr.io/edeev/quizlab`) | в контейнере |
| `web_lite/` | готовые из `git.deev.su/deevev/quizlab` | внешний | | `web_lite/` | готовые из `git.deev.su/deevev/quizlab` | внешний |
| `caddy/` | собираются из исходников, Caddy вместо nginx, HTTPS с самоподписанным сертификатом | в контейнере | | `caddy/` | собираются из исходников, Caddy вместо nginx, HTTPS с самоподписанным сертификатом | в контейнере |
@ -65,8 +65,9 @@ docker compose up -d # API на http://localhost/api/quiz/
Остальные варианты запускаются так же из своих папок. Для `caddy/` сначала выполните `sh gen-cert.sh`, Остальные варианты запускаются так же из своих папок. Для `caddy/` сначала выполните `sh gen-cert.sh`,
сайт откроется на `https://localhost`. сайт откроется на `https://localhost`.
Готовый клиент — в [релизах](https://github.com/EDeev/quizlab/releases/latest): `quizlab-client-windows-x64.zip` Готовый клиент — в [релизах](https://github.com/EDeev/quizlab/releases/latest): `quizlab-client-setup.exe` — установщик
(распакуйте и запустите `quizlab-client.exe`) и `quizlab-client-linux-x86_64.AppImage` (`chmod +x` и запустить). для Windows (ярлык в меню «Пуск»), `quizlab-client-windows-x64.zip` — то же без установки (распакуйте и запустите
`quizlab-client.exe`) и `quizlab-client-linux-x86_64.AppImage` (`chmod +x` и запустить).
Сборка клиента из исходников (нужны Qt 6 и CMake): Сборка клиента из исходников (нужны Qt 6 и CMake):

View file

@ -0,0 +1,40 @@
; Установщик Qt-клиента для Windows (Inno Setup 6). Версия передаётся из CI: ISCC /DAppVersion=1.0.1
#ifndef AppVersion
#define AppVersion "0.0.0"
#endif
[Setup]
AppId={{6F3B2C1E-9A4D-4E7B-8C21-5D0F7A9B3E64}
AppName=Quiz Client
AppVersion={#AppVersion}
AppPublisher=Деев Егор Викторович
AppPublisherURL=https://github.com/EDeev/quizlab
DefaultDirName={autopf}\Quiz Client
DefaultGroupName=Quiz Client
UninstallDisplayIcon={app}\quizlab-client.exe
OutputDir=..\..
OutputBaseFilename=quizlab-client-setup
Compression=lzma2
SolidCompression=yes
WizardStyle=modern
ArchitecturesAllowed=x64compatible
ArchitecturesInstallIn64BitMode=x64compatible
PrivilegesRequiredOverridesAllowed=dialog
[Languages]
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "..\..\dist\quizlab-client\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
[Icons]
Name: "{group}\Quiz Client"; Filename: "{app}\quizlab-client.exe"
Name: "{group}\{cm:UninstallProgram,Quiz Client}"; Filename: "{uninstallexe}"
Name: "{autodesktop}\Quiz Client"; Filename: "{app}\quizlab-client.exe"; Tasks: desktopicon
[Run]
Filename: "{app}\quizlab-client.exe"; Description: "{cm:LaunchProgram,Quiz Client}"; Flags: nowait postinstall skipifsilent