mirror of
https://github.com/LizardByte/tray.git
synced 2026-12-06 15:12:48 +09:00
Add a matrix dimension for Qt version and run builds for both Qt5 and Qt6 on Ubuntu. The build job name now includes the Qt version, and qt_version is set per matrix entry. Linux dependency installation is made conditional on QT_VERSION (installing Qt5 or Qt6 packages accordingly) and QT_VERSION is exported into the job environment. Split CMake configure and ninja build into separate steps, make test environment/platformtheme conditional, and append Qt version to artifact names and codecov flags. Update README to document Qt5 and Qt6 package installation commands for supported distros.
350 lines
11 KiB
YAML
350 lines
11 KiB
YAML
---
|
|
name: CI
|
|
permissions: {}
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
concurrency:
|
|
group: "${{ github.workflow }}-${{ github.ref }}"
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
setup_release:
|
|
name: Setup Release
|
|
outputs:
|
|
publish_release: ${{ steps.setup_release.outputs.publish_release }}
|
|
release_body: ${{ steps.setup_release.outputs.release_body }}
|
|
release_commit: ${{ steps.setup_release.outputs.release_commit }}
|
|
release_generate_release_notes: ${{ steps.setup_release.outputs.release_generate_release_notes }}
|
|
release_tag: ${{ steps.setup_release.outputs.release_tag }}
|
|
release_version: ${{ steps.setup_release.outputs.release_version }}
|
|
permissions:
|
|
contents: write
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Setup Release
|
|
id: setup_release
|
|
uses: LizardByte/actions/actions/release_setup@0affa4f7bcb27562658960eee840eff8ff844578 # v2026.328.161128
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
build:
|
|
name: Build (${{ matrix.os }}${{ matrix.qt_version && format(', Qt{0}', matrix.qt_version) || '' }})
|
|
defaults:
|
|
run:
|
|
shell: ${{ matrix.shell }}
|
|
permissions:
|
|
contents: read
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: macos-latest
|
|
shell: "bash"
|
|
qt_version: ''
|
|
- os: ubuntu-latest
|
|
shell: "bash"
|
|
qt_version: '5'
|
|
- os: ubuntu-latest
|
|
shell: "bash"
|
|
qt_version: '6'
|
|
- os: windows-latest
|
|
shell: "msys2 {0}"
|
|
qt_version: ''
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Setup Dependencies Linux
|
|
if: runner.os == 'Linux'
|
|
env:
|
|
QT_VERSION: ${{ matrix.qt_version }}
|
|
run: |
|
|
dependencies=(
|
|
"adwaita-icon-theme"
|
|
"build-essential"
|
|
"cmake"
|
|
"imagemagick"
|
|
"ninja-build"
|
|
"xvfb"
|
|
)
|
|
|
|
if [[ "${QT_VERSION}" == "5" ]]; then
|
|
dependencies+=(
|
|
"libqt5svg5-dev"
|
|
"qt5-gtk-platformtheme"
|
|
"qtbase5-dev"
|
|
)
|
|
elif [[ "${QT_VERSION}" == "6" ]]; then
|
|
dependencies+=(
|
|
"qt6-base-dev"
|
|
"qt6-svg-dev"
|
|
)
|
|
else
|
|
echo "Unsupported QT_VERSION: ${QT_VERSION}"
|
|
exit 1
|
|
fi
|
|
|
|
sudo apt-get update
|
|
sudo apt-get install -y "${dependencies[@]}"
|
|
|
|
- name: Setup virtual desktop
|
|
if: runner.os == 'Linux'
|
|
uses: LizardByte/actions/actions/virtual_desktop@0affa4f7bcb27562658960eee840eff8ff844578 # v2026.328.161128
|
|
with:
|
|
environment: mate
|
|
|
|
- name: Setup Dependencies macOS
|
|
if: runner.os == 'macOS'
|
|
run: |
|
|
brew update
|
|
brew install \
|
|
cmake \
|
|
doxygen \
|
|
graphviz \
|
|
imagemagick \
|
|
ninja \
|
|
node
|
|
|
|
- name: Fix macOS screen recording permissions
|
|
if: runner.os == 'macOS'
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
configure_system_tccdb() {
|
|
local values=$1
|
|
local dbPath="/Library/Application Support/com.apple.TCC/TCC.db"
|
|
local sqlQuery="INSERT OR IGNORE INTO access VALUES($values);"
|
|
sudo sqlite3 "$dbPath" "$sqlQuery"
|
|
}
|
|
|
|
configure_user_tccdb() {
|
|
local values=$1
|
|
local dbPath="$HOME/Library/Application Support/com.apple.TCC/TCC.db"
|
|
local sqlQuery="INSERT OR IGNORE INTO access VALUES($values);"
|
|
sqlite3 "$dbPath" "$sqlQuery"
|
|
}
|
|
|
|
systemValuesArray=(
|
|
"'kTCCServiceScreenCapture','/bin/bash',1,2,0,1,NULL,NULL,NULL,'UNUSED',NULL,0,1599831148"
|
|
)
|
|
for values in "${systemValuesArray[@]}"; do
|
|
configure_system_tccdb "$values,NULL,NULL,'UNUSED',${values##*,}"
|
|
done
|
|
|
|
userValuesArray=(
|
|
"'kTCCServiceScreenCapture','/bin/bash',1,2,0,1,NULL,NULL,NULL,'UNUSED',NULL,0,1583997993"
|
|
)
|
|
for values in "${userValuesArray[@]}"; do
|
|
configure_user_tccdb "$values,NULL,NULL,'UNUSED',${values##*,}"
|
|
done
|
|
|
|
echo "macOS TCC permissions configured."
|
|
|
|
- name: Setup Dependencies Windows
|
|
if: runner.os == 'Windows'
|
|
uses: msys2/setup-msys2@cafece8e6baf9247cf9b1bf95097b0b983cc558d # v2.31.0
|
|
with:
|
|
msystem: ucrt64
|
|
update: true
|
|
install: >-
|
|
doxygen
|
|
mingw-w64-ucrt-x86_64-binutils
|
|
mingw-w64-ucrt-x86_64-cmake
|
|
mingw-w64-ucrt-x86_64-graphviz
|
|
mingw-w64-ucrt-x86_64-imagemagick
|
|
mingw-w64-ucrt-x86_64-ninja
|
|
mingw-w64-ucrt-x86_64-nodejs
|
|
mingw-w64-ucrt-x86_64-toolchain
|
|
|
|
- name: Setup python
|
|
id: setup-python
|
|
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Python Path
|
|
id: python-path
|
|
run: |
|
|
if [ "${{ runner.os }}" = "Windows" ]; then
|
|
# replace backslashes with double backslashes
|
|
python_path=$(echo "${{ steps.setup-python.outputs.python-path }}" | sed 's/\\/\\\\/g')
|
|
else
|
|
python_path=${{ steps.setup-python.outputs.python-path }}
|
|
fi
|
|
|
|
# step output
|
|
echo "python-path=${python_path}"
|
|
echo "python-path=${python_path}" >> "${GITHUB_OUTPUT}"
|
|
|
|
- name: Configure
|
|
run: |
|
|
mkdir -p build
|
|
|
|
if [ "${{ runner.os }}" = "Linux" ]; then
|
|
# Doxygen from Ubuntu is too old, need Doxygen >= 1.10
|
|
DOCS=OFF
|
|
else
|
|
DOCS=ON
|
|
fi
|
|
|
|
cmake \
|
|
-DBUILD_DOCS=${DOCS} \
|
|
-DCMAKE_BUILD_TYPE:STRING=Debug \
|
|
-B build \
|
|
-G Ninja \
|
|
-S .
|
|
|
|
- name: Build
|
|
run: ninja -C build
|
|
|
|
- name: Init tray icon (Windows)
|
|
if: runner.os == 'Windows'
|
|
working-directory: build/tests
|
|
run: ./test_tray --gtest_color=yes --gtest_filter=TrayTest.TestTrayInit
|
|
|
|
- name: Configure Windows
|
|
if: runner.os == 'Windows'
|
|
shell: pwsh
|
|
run: |
|
|
echo "::group::Enable all tray icons"
|
|
Invoke-WebRequest `
|
|
-Uri "https://raw.githubusercontent.com/paulmann/windows-show-all-tray-icons/main/Enable-AllTrayIcons.ps1" `
|
|
-OutFile "Enable-AllTrayIcons.ps1"
|
|
.\Enable-AllTrayIcons.ps1 -Action Enable -Force # Enable with comprehensive method (resets ALL icon settings)
|
|
echo "::endgroup::"
|
|
|
|
echo "::group::Disable Do Not Disturb"
|
|
Add-Type -AssemblyName System.Windows.Forms
|
|
Start-Process "ms-settings:notifications"
|
|
Start-Sleep -Seconds 2
|
|
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
|
|
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
|
|
[System.Windows.Forms.SendKeys]::SendWait(" ")
|
|
echo "::endgroup::"
|
|
|
|
echo "::group::Minimize all windows"
|
|
$shell = New-Object -ComObject Shell.Application
|
|
$shell.MinimizeAll()
|
|
echo "::endgroup::"
|
|
|
|
echo "::group::Set Date - Hack for Quiet Time"
|
|
$newDate = (Get-Date).AddHours(2)
|
|
Set-Date -Date $newDate
|
|
echo "::endgroup::"
|
|
|
|
- name: Run tests
|
|
id: test
|
|
# TODO: tests randomly hang on Linux, https://github.com/LizardByte/tray/issues/45
|
|
timeout-minutes: 3
|
|
working-directory: build/tests
|
|
env:
|
|
QT_QPA_PLATFORMTHEME: ${{ runner.os == 'Linux' && matrix.qt_version == '5' && 'gtk3' || '' }}
|
|
run: ./test_tray --gtest_color=yes --gtest_output=xml:test_results.xml
|
|
|
|
- name: Upload screenshots
|
|
if: >-
|
|
always() &&
|
|
(steps.test.outcome == 'success' || steps.test.outcome == 'failure')
|
|
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
|
with:
|
|
name: tray-screenshots-${{ runner.os }}${{ matrix.qt_version && format('-qt{0}', matrix.qt_version) || '' }}
|
|
path: build/tests/screenshots
|
|
if-no-files-found: error
|
|
|
|
- name: Generate gcov report
|
|
id: test_report
|
|
# any except canceled or skipped
|
|
if: >-
|
|
always() &&
|
|
(steps.test.outcome == 'success' || steps.test.outcome == 'failure')
|
|
working-directory: build
|
|
run: |
|
|
${{ steps.python-path.outputs.python-path }} -m pip install gcovr
|
|
${{ steps.python-path.outputs.python-path }} -m gcovr . -r ../src \
|
|
--exclude-noncode-lines \
|
|
--exclude-throw-branches \
|
|
--exclude-unreachable-branches \
|
|
--verbose \
|
|
--xml-pretty \
|
|
-o coverage.xml
|
|
|
|
- name: Debug coverage file
|
|
run: cat build/coverage.xml
|
|
|
|
- name: Set codecov flags
|
|
id: codecov_flags
|
|
run: |
|
|
flags="${{ runner.os }}${{ matrix.qt_version && format('-qt{0}', matrix.qt_version) || '' }}"
|
|
echo "flags=${flags}" >> "${GITHUB_OUTPUT}"
|
|
|
|
- name: Upload coverage
|
|
# any except canceled or skipped
|
|
if: >-
|
|
always() &&
|
|
steps.test_report.outcome == 'success' &&
|
|
startsWith(github.repository, 'LizardByte/')
|
|
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
|
|
with:
|
|
disable_search: true
|
|
fail_ci_if_error: true
|
|
files: ./build/coverage.xml
|
|
flags: "${{ steps.codecov_flags.outputs.flags }}"
|
|
report_type: coverage
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
verbose: true
|
|
|
|
- name: Upload test results
|
|
# any except canceled or skipped
|
|
if: >-
|
|
always() &&
|
|
(steps.test.outcome == 'success' || steps.test.outcome == 'failure') &&
|
|
startsWith(github.repository, 'LizardByte/')
|
|
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
|
|
with:
|
|
disable_search: true
|
|
fail_ci_if_error: true
|
|
files: ./build/tests/test_results.xml
|
|
flags: "${{ steps.codecov_flags.outputs.flags }}"
|
|
report_type: test_results
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
verbose: true
|
|
|
|
release:
|
|
name: Release
|
|
if:
|
|
always() &&
|
|
needs.setup_release.outputs.publish_release == 'true' &&
|
|
needs.build.result == 'success' &&
|
|
startsWith(github.repository, 'LizardByte/')
|
|
needs:
|
|
- build
|
|
- setup_release
|
|
permissions:
|
|
contents: read
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Create/Update GitHub Release
|
|
if: needs.setup_release.outputs.publish_release == 'true'
|
|
uses: LizardByte/actions/actions/release_create@0affa4f7bcb27562658960eee840eff8ff844578 # v2026.328.161128
|
|
with:
|
|
allowUpdates: false
|
|
artifacts: ''
|
|
body: ${{ needs.setup_release.outputs.release_body }}
|
|
draft: true
|
|
generateReleaseNotes: ${{ needs.setup_release.outputs.release_generate_release_notes }}
|
|
name: ${{ needs.setup_release.outputs.release_tag }}
|
|
prerelease: true
|
|
tag: ${{ needs.setup_release.outputs.release_tag }}
|
|
token: ${{ secrets.GH_BOT_TOKEN }}
|