1- # Take a screenshot of the DVR-Scan UI and upload it as an artifact .
1+ # Take screenshots of the DVR-Scan UI on Windows, Linux, and macOS and upload them as artifacts .
22name : Screenshot UI
33
44on :
88 ffmpeg_version : " 7.1"
99
1010jobs :
11- run-ui-and- screenshot :
11+ screenshot-windows :
1212 runs-on : windows-latest
13+ env :
14+ UV_SYSTEM_PYTHON : 1
1315 strategy :
1416 matrix :
1517 python-version : ["3.12"]
1618 resolution :
1719 - {width: 1920, height: 1080, scale: 100}
18- - {width: 2560, height: 1440, scale: 150}
19- - {width: 3840, height: 2160, scale: 200}
20+ - {width: 1920, height: 1080, scale: 150}
21+ - {width: 1920, height: 1080, scale: 200}
22+ # - {width: 2560, height: 1440, scale: 150} # Does not work
23+ # - {width: 3840, height: 2160, scale: 200}
2024
2125 steps :
2226 - uses : actions/checkout@v4
4953 run : |
5054 7z e ffmpeg-${{ env.ffmpeg_version }}-full_build.7z ffmpeg.exe -r
5155
52- - name : Set screen resolution to ${{ matrix.resolution.width }}x${{ matrix.resolution.height }}
53- 54- with :
55- width : ${{ matrix.resolution.width }}
56- height : ${{ matrix.resolution.height }}
57-
58- - name : Set display scaling to ${{ matrix.resolution.scale }}%
56+ - name : Set display properties (${{ matrix.resolution.width }}x${{ matrix.resolution.height }} @ ${{ matrix.resolution.scale }})
5957 run : |
58+ Set-DisplayResolution -Width ${{ matrix.resolution.width }} -Height ${{ matrix.resolution.height }} -Force
6059 Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "LogPixels" -Value ([int]($env:SCALE * 96 / 100))
6160 Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "Win8DpiScaling" -Value 1
6261 Rundll32.exe user32.dll, UpdatePerUserSystemParameters
@@ -76,13 +75,119 @@ jobs:
7675 $bitmap = New-Object System.Drawing.Bitmap $bounds.Width, $bounds.Height
7776 $graphics = [System.Drawing.Graphics]::FromImage($bitmap)
7877 $graphics.CopyFromScreen($bounds.Location, [System.Drawing.Point]::Empty, $bounds.Size)
79- $bitmap.Save("dvr-scan-screenshot-${{ matrix.resolution.scale }}.png", [System.Drawing.Imaging.ImageFormat]::Png)
78+ $bitmap.Save("dvr-scan-screenshot-windows-${{ matrix.resolution.width }}x${{ matrix.resolution.height }}- ${{ matrix.resolution.scale }}.png", [System.Drawing.Imaging.ImageFormat]::Png)
8079 $graphics.Dispose()
8180 $bitmap.Dispose()
8281 shell : powershell
8382
8483 - name : Upload Screenshot
8584 uses : actions/upload-artifact@v4
8685 with :
87- name : dvr-scan-screenshot-${{ matrix.resolution.scale }}
88- path : dvr-scan-screenshot-${{ matrix.resolution.scale }}.png
86+ name : dvr-scan-screenshot-windows-${{ matrix.resolution.width }}x${{ matrix.resolution.height }}-${{ matrix.resolution.scale }}
87+ path : dvr-scan-screenshot-windows-${{ matrix.resolution.width }}x${{ matrix.resolution.height }}-${{ matrix.resolution.scale }}.png
88+
89+ screenshot-linux :
90+ runs-on : ubuntu-latest
91+ env :
92+ UV_SYSTEM_PYTHON : 1
93+ strategy :
94+ matrix :
95+ python-version : ["3.12"]
96+ resolution :
97+ - {width: 1920, height: 1080}
98+ - {width: 2560, height: 1440}
99+ - {width: 3840, height: 2160}
100+
101+ steps :
102+ - uses : actions/checkout@v4
103+
104+ - name : Set up Python ${{ matrix.python-version }}
105+ uses : actions/setup-python@v5
106+ with :
107+ python-version : ${{ matrix.python-version }}
108+ cache : ' pip'
109+
110+ - name : Install uv and set the python version
111+ uses : astral-sh/setup-uv@v4
112+ with :
113+ version : " 0.5.11"
114+ python-version : ${{ matrix.python-version }}
115+
116+ - name : Install System Dependencies
117+ run : |
118+ sudo apt-get update
119+ sudo apt-get install -y xvfb scrot
120+
121+ - name : Install Python Dependencies
122+ run : |
123+ uv pip install --upgrade pip build wheel virtualenv setuptools
124+ uv pip install -r requirements.txt
125+
126+ - name : Run UI Test
127+ run : |
128+ # Start Xvfb in the background on display :99
129+ Xvfb :99 -screen 0 ${{ matrix.resolution.width }}x${{ matrix.resolution.height }}x24 &
130+
131+ # Set the DISPLAY environment variable for the following commands
132+ export DISPLAY=:99
133+
134+ # Run the application in the background
135+ python -m dvr_scan.app &
136+
137+ # Wait for the application to launch
138+ sleep 10
139+
140+ # Take a screenshot
141+ scrot -d 0 "dvr-scan-screenshot-linux-${{ matrix.resolution.width }}x${{ matrix.resolution.height }}.png"
142+
143+ - name : Upload Screenshot
144+ uses : actions/upload-artifact@v4
145+ with :
146+ name : dvr-scan-screenshot-linux-${{ matrix.resolution.width }}x${{ matrix.resolution.height }}
147+ path : " dvr-scan-screenshot-linux-${{ matrix.resolution.width }}x${{ matrix.resolution.height }}.png"
148+
149+ # TODO: Resolution matrix
150+ screenshot-macos :
151+ runs-on : macos-latest
152+ env :
153+ UV_SYSTEM_PYTHON : 1
154+ strategy :
155+ matrix :
156+ python-version : ["3.12"]
157+
158+ steps :
159+ - uses : actions/checkout@v4
160+
161+ - name : Set up Python ${{ matrix.python-version }}
162+ uses : actions/setup-python@v5
163+ with :
164+ python-version : ${{ matrix.python-version }}
165+ cache : ' pip'
166+
167+ - name : Install uv and set the python version
168+ uses : astral-sh/setup-uv@v4
169+ with :
170+ version : " 0.5.11"
171+ python-version : ${{ matrix.python-version }}
172+
173+ - name : Install Python Dependencies
174+ run : |
175+ uv pip install --upgrade pip build wheel virtualenv setuptools
176+ uv pip install -r requirements.txt
177+
178+ - name : Run UI Test
179+ run : |
180+ # Run the application in the background
181+ python -m dvr_scan.app &
182+
183+ # Wait for the application to launch
184+ sleep 10
185+
186+ # Take a screenshot
187+ screencapture "dvr-scan-screenshot-macos.png"
188+
189+ - name : Upload Screenshot
190+ uses : actions/upload-artifact@v4
191+ with :
192+ name : dvr-scan-screenshot-macos
193+ path : " dvr-scan-screenshot-macos.png"
0 commit comments