mirror of
https://github.com/EDeev/quizlab.git
synced 2026-10-07 20:49:34 +03:00
107 lines
5 KiB
YAML
107 lines
5 KiB
YAML
name: Release
|
||
|
||
on:
|
||
push:
|
||
tags: ["v*"]
|
||
workflow_dispatch:
|
||
|
||
jobs:
|
||
windows:
|
||
name: Qt-клиент для Windows
|
||
runs-on: windows-latest
|
||
permissions:
|
||
contents: write
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
- uses: jurplel/install-qt-action@v4
|
||
with:
|
||
version: "6.8.*"
|
||
cache: true
|
||
- name: Сборка
|
||
working-directory: lab-3
|
||
run: |
|
||
cmake -B build
|
||
cmake --build build --config Release
|
||
- name: Программа с библиотеками Qt
|
||
run: |
|
||
New-Item -ItemType Directory dist/quizlab-client | Out-Null
|
||
Copy-Item lab-3/build/Release/lab-3.exe dist/quizlab-client/quizlab-client.exe
|
||
windeployqt --release --no-translations --no-system-d3d-compiler --no-opengl-sw dist/quizlab-client/quizlab-client.exe
|
||
# рантайм 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/ }
|
||
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
|
||
with:
|
||
name: windows
|
||
path: |
|
||
quizlab-client-windows-x64.zip
|
||
quizlab-client-setup.exe
|
||
- name: Файл в релиз
|
||
if: startsWith(github.ref, 'refs/tags/')
|
||
env:
|
||
GH_TOKEN: ${{ github.token }}
|
||
run: gh release upload "${{ github.ref_name }}" quizlab-client-windows-x64.zip quizlab-client-setup.exe --clobber
|
||
|
||
linux:
|
||
name: Qt-клиент для Linux (AppImage)
|
||
runs-on: ubuntu-22.04
|
||
permissions:
|
||
contents: write
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
- uses: jurplel/install-qt-action@v4
|
||
with:
|
||
version: "6.8.*"
|
||
cache: true
|
||
- run: sudo apt-get update -qq && sudo apt-get install -y -qq libgl1-mesa-dev libxkbcommon-dev libxcb-cursor0
|
||
- name: Сборка
|
||
working-directory: lab-3
|
||
run: |
|
||
cmake -B build -DCMAKE_BUILD_TYPE=Release
|
||
cmake --build build
|
||
- name: AppImage
|
||
env:
|
||
APPIMAGE_EXTRACT_AND_RUN: "1"
|
||
OUTPUT: quizlab-client-linux-x86_64.AppImage
|
||
run: |
|
||
wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
|
||
wget -q https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
|
||
chmod +x linuxdeploy*.AppImage
|
||
mkdir -p appdir
|
||
cp lab-3/build/lab-3 quizlab-client
|
||
cp lab-3/icons/app.svg quizlab-client.svg
|
||
printf '[Desktop Entry]\nType=Application\nName=Quiz Client\nExec=quizlab-client\nIcon=quizlab-client\nCategories=Education;\n' > quizlab-client.desktop
|
||
export QMAKE=$(which qmake)
|
||
./linuxdeploy-x86_64.AppImage --appdir appdir -e quizlab-client -d quizlab-client.desktop -i quizlab-client.svg --plugin qt --output appimage
|
||
- name: Проверка — AppImage запускается и работает 5 секунд
|
||
run: |
|
||
sudo apt-get install -y -qq xvfb
|
||
xvfb-run -a ./quizlab-client-linux-x86_64.AppImage --appimage-extract-and-run > run.log 2>&1 &
|
||
sleep 5
|
||
cat run.log
|
||
pgrep -f quizlab-client > /dev/null || { echo "клиент завершился"; exit 1; }
|
||
echo "клиент работает"
|
||
- uses: actions/upload-artifact@v4
|
||
with:
|
||
name: linux
|
||
path: quizlab-client-linux-x86_64.AppImage
|
||
- name: Файл в релиз
|
||
if: startsWith(github.ref, 'refs/tags/')
|
||
env:
|
||
GH_TOKEN: ${{ github.token }}
|
||
run: gh release upload "${{ github.ref_name }}" quizlab-client-linux-x86_64.AppImage --clobber
|