mirror of
https://github.com/EDeev/quizlab.git
synced 2026-10-07 20:49:34 +03:00
CI: API в Docker отдаёт тесты, образы caddy/ собираются, Qt-клиент на Linux и Windows; релиз — клиент для Windows и AppImage
This commit is contained in:
parent
405580b3b3
commit
e1e5c8a028
2 changed files with 145 additions and 0 deletions
65
.github/workflows/ci.yml
vendored
Normal file
65
.github/workflows/ci.yml
vendored
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
api:
|
||||||
|
name: API в Docker (lab-2/local)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Сборка и запуск
|
||||||
|
working-directory: lab-2/local
|
||||||
|
run: |
|
||||||
|
cp .env.example .env
|
||||||
|
docker compose up -d --build --wait postgres_service
|
||||||
|
docker compose up -d --build
|
||||||
|
- name: API отдаёт сгенерированные тесты
|
||||||
|
run: |
|
||||||
|
for i in $(seq 1 30); do
|
||||||
|
curl -sf http://localhost/api/quiz/ -o quiz.json && break
|
||||||
|
sleep 3
|
||||||
|
done
|
||||||
|
python3 -c "
|
||||||
|
import json
|
||||||
|
d = json.load(open('quiz.json'))
|
||||||
|
items = d['results'] if isinstance(d, dict) else d
|
||||||
|
assert items, 'список тестов пуст'
|
||||||
|
print('тестов:', d.get('count', len(items)) if isinstance(d, dict) else len(items))"
|
||||||
|
- name: Журнал при ошибке
|
||||||
|
if: failure()
|
||||||
|
working-directory: lab-2/local
|
||||||
|
run: docker compose logs --tail 50
|
||||||
|
|
||||||
|
images:
|
||||||
|
name: Образы caddy/ собираются
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- working-directory: lab-2/caddy
|
||||||
|
run: cp .env.example .env && docker compose build
|
||||||
|
|
||||||
|
client:
|
||||||
|
name: Qt-клиент (${{ matrix.os }})
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: jurplel/install-qt-action@v4
|
||||||
|
with:
|
||||||
|
version: "6.8.*"
|
||||||
|
cache: true
|
||||||
|
- name: Зависимости сборки (Linux)
|
||||||
|
if: runner.os == 'Linux'
|
||||||
|
run: sudo apt-get update -qq && sudo apt-get install -y -qq libgl1-mesa-dev libxkbcommon-dev
|
||||||
|
- name: Сборка
|
||||||
|
working-directory: lab-3
|
||||||
|
run: |
|
||||||
|
cmake -B build -DCMAKE_BUILD_TYPE=Release
|
||||||
|
cmake --build build --config Release
|
||||||
80
.github/workflows/release.yml
vendored
Normal file
80
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,80 @@
|
||||||
|
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
|
||||||
|
Compress-Archive -Path dist/quizlab-client -DestinationPath quizlab-client-windows-x64.zip
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: windows
|
||||||
|
path: quizlab-client-windows-x64.zip
|
||||||
|
- name: Файл в релиз
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
run: gh release upload "${{ github.ref_name }}" quizlab-client-windows-x64.zip --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
|
||||||
|
- 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
|
||||||
Loading…
Add table
Reference in a new issue