Skip to content

Commit 0784774

Browse files
test(tray): add system tray tests (#4221)
1 parent 3893c5b commit 0784774

16 files changed

Lines changed: 652 additions & 41 deletions

File tree

.github/workflows/ci-linux.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,20 @@ jobs:
151151
152152
./appimagelint-x86_64.AppImage ./artifacts/sunshine.AppImage
153153
154-
- name: Install test deps
154+
- name: Install screenshot dependency
155155
run: |
156156
sudo apt-get update -y
157-
sudo apt-get install -y \
158-
x11-xserver-utils \
159-
xvfb
157+
sudo apt-get install -y imagemagick
160158
161159
# clean apt cache
162160
sudo apt-get clean
163161
sudo rm -rf /var/lib/apt/lists/*
164162
163+
- name: Setup virtual desktop
164+
uses: LizardByte/actions/actions/virtual_desktop@d0ae7f82215a479fe2b74f4088c53ee6460513dd # v2026.728.214955
165+
with:
166+
environment: mate
167+
165168
- name: Setup python
166169
id: python
167170
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
@@ -182,12 +185,17 @@ jobs:
182185
- name: Run tests
183186
id: test
184187
working-directory: build/tests
185-
run: |
186-
export DISPLAY=:1
187-
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
188-
sleep 5 # give Xvfb time to start
188+
run: ./test_sunshine --gtest_color=yes --gtest_output=xml:test_results.xml
189189

190-
./test_sunshine --gtest_color=yes --gtest_output=xml:test_results.xml
190+
- name: Upload system tray screenshots
191+
if: >-
192+
always() &&
193+
(steps.test.outcome == 'success' || steps.test.outcome == 'failure')
194+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
195+
with:
196+
name: sunshine-screenshots-${{ matrix.name }}
197+
path: build/tests/screenshots
198+
if-no-files-found: error
191199

192200
- name: Generate gcov report
193201
id: test_report

.github/workflows/ci-macos.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ jobs:
9494
qtbase \
9595
qtsvg
9696
97+
- name: Configure macOS screen recording
98+
uses: LizardByte/tray/.github/actions/configure-macos-screen-recording@master
99+
97100
- name: Setup Python
98101
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
99102
with:
@@ -182,6 +185,16 @@ jobs:
182185
working-directory: build/tests
183186
run: ./test_sunshine --gtest_color=yes --gtest_output=xml:test_results.xml
184187

188+
- name: Upload system tray screenshots
189+
if: >-
190+
always() &&
191+
(steps.test.outcome == 'success' || steps.test.outcome == 'failure')
192+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
193+
with:
194+
name: sunshine-screenshots-${{ matrix.name }}
195+
path: build/tests/screenshots
196+
if-no-files-found: error
197+
185198
- name: Generate gcov report
186199
id: test_report
187200
# any except canceled or skipped

.github/workflows/ci-windows.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,12 +348,34 @@ jobs:
348348
shell: msys2 {0}
349349
run: cat ./build/cpack_artifacts/_CPack_Packages/win64/WIX/wix.log || true
350350

351+
- name: Initialize tray icon
352+
working-directory: build/tests
353+
env:
354+
SUNSHINE_CONFIGURE_TRAY_ICONS: '1'
355+
run: >-
356+
./test_sunshine.exe
357+
--gtest_color=yes
358+
--gtest_filter=SystemTrayTest.InitializesTrayForWorkflowConfiguration
359+
360+
- name: Configure Windows tray screenshots
361+
uses: LizardByte/tray/.github/actions/configure-windows-tray-screenshots@master
362+
351363
- name: Run tests
352364
id: test
353365
shell: msys2 {0}
354366
working-directory: build/tests
355367
run: ./test_sunshine.exe --gtest_color=yes --gtest_output=xml:test_results.xml
356368

369+
- name: Upload system tray screenshots
370+
if: >-
371+
always() &&
372+
(steps.test.outcome == 'success' || steps.test.outcome == 'failure')
373+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
374+
with:
375+
name: sunshine-screenshots-${{ matrix.name }}
376+
path: build/tests/screenshots
377+
if-no-files-found: error
378+
357379
- name: Generate gcov report
358380
id: test_report
359381
# any except canceled or skipped
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Publish Screenshots
3+
4+
on:
5+
workflow_run:
6+
workflows: ["CI"]
7+
types:
8+
- completed
9+
10+
permissions: {}
11+
12+
jobs:
13+
publish:
14+
if: github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == 'failure'
15+
permissions:
16+
actions: read
17+
contents: write
18+
pull-requests: write
19+
statuses: write
20+
uses: LizardByte/tray/.github/workflows/_publish-screenshots.yml@master
21+
with:
22+
artifact-name-prefix: sunshine-screenshots-
23+
source-run-id: ${{ github.event.workflow_run.id }}

cmake/packaging/common.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ foreach(asset ${ALL_ASSETS}) # Copy assets to build directory, excluding the we
2929
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/assets")
3030
endforeach()
3131

32+
# Copy the primary application icon into the built web assets for the system tray.
33+
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/assets/web/images")
34+
configure_file(
35+
"${CMAKE_SOURCE_DIR}/sunshine.svg"
36+
"${CMAKE_CURRENT_BINARY_DIR}/assets/web/images/logo-sunshine.svg"
37+
COPYONLY)
38+
3239
# install built vite assets
3340
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/assets/web"
3441
DESTINATION "${SUNSHINE_ASSETS_DIR}")

cmake/packaging/linux.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,6 @@ set(CPACK_RPM_PACKAGE_AUTOREQ ON)
145145
install(FILES "${CMAKE_SOURCE_DIR}/sunshine.svg"
146146
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps"
147147
RENAME "${PROJECT_FQDN}.svg")
148-
install(FILES "${CMAKE_SOURCE_DIR}/sunshine.svg"
149-
DESTINATION "${SUNSHINE_ASSETS_DIR}/web/images"
150-
RENAME "logo-sunshine.svg")
151148

152149
# tray icon
153150
if(${SUNSHINE_TRAY} STREQUAL 1)

packaging/linux/Arch/PKGBUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ makedepends=(
7474

7575
checkdepends=(
7676
'gcovr'
77+
'imagemagick'
7778
)
7879

7980
optdepends=(

packaging/linux/copr/Sunshine.spec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ BuildRequires: systemd-udev
7474
BuildRequires: uv
7575
%{?sysusers_requires_compat}
7676
# for unit tests
77+
BuildRequires: ImageMagick
7778
BuildRequires: xorg-x11-server-Xvfb
7879
%endif
7980

@@ -99,6 +100,7 @@ BuildRequires: udev
99100
BuildRequires: vulkan-devel
100101
%endif
101102
# for unit tests
103+
BuildRequires: ImageMagick
102104
BuildRequires: xvfb-run
103105
%endif
104106

packaging/linux/flatpak/dev.lizardbyte.app.Sunshine.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ cleanup:
3636

3737
modules:
3838
# Test dependencies
39+
- "modules/imagemagick.json"
3940
- "modules/xvfb/xvfb.json"
4041

4142
# Build dependencies
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "imagemagick",
3+
"cleanup": [
4+
"*"
5+
],
6+
"config-opts": [
7+
"--disable-docs",
8+
"--disable-static",
9+
"--with-modules=no",
10+
"--with-perl=no",
11+
"--with-x"
12+
],
13+
"sources": [
14+
{
15+
"type": "archive",
16+
"url": "https://download.imagemagick.org/archive/releases/ImageMagick-7.1.2-29.tar.xz",
17+
"sha256": "bab096dc4b3089be4c0ebfdb90a232b85b7d982a99f722b30512fb243ea1e4ce"
18+
}
19+
]
20+
}

0 commit comments

Comments
 (0)