-
Notifications
You must be signed in to change notification settings - Fork 63
187 lines (153 loc) · 5.85 KB
/
screenshot.yml
File metadata and controls
187 lines (153 loc) · 5.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# Take screenshots of the DVR-Scan UI on Windows, Linux, and macOS and upload them as artifacts.
name: Screenshot UI
on:
workflow_dispatch:
env:
ffmpeg_version: "8.0"
jobs:
screenshot-windows:
runs-on: windows-latest
env:
UV_SYSTEM_PYTHON: 1
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v4
with:
version: "0.5.11"
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
uv pip install --upgrade pip build wheel virtualenv setuptools
uv pip install -r requirements.txt
- name: Download FFMPEG
uses: dsaltares/fetch-gh-release-asset@1.1.2
with:
repo: 'GyanD/codexffmpeg'
version: 'tags/${{ env.ffmpeg_version }}'
file: 'ffmpeg-${{ env.ffmpeg_version }}-full_build.7z'
- name: Extract FFMPEG
run: |
7z e ffmpeg-${{ env.ffmpeg_version }}-full_build.7z ffmpeg.exe -r
# - name: Set display properties (${{ matrix.resolution.width }}x${{ matrix.resolution.height }} @ ${{ matrix.resolution.scale }})
# run: |
# Set-DisplayResolution -Width ${{ matrix.resolution.width }} -Height ${{ matrix.resolution.height }} -Force
# Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "LogPixels" -Value ([int]($env:SCALE * 96 / 100))
# Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "Win8DpiScaling" -Value 1
# Rundll32.exe user32.dll, UpdatePerUserSystemParameters
# env:
# SCALE: ${{ matrix.resolution.scale }}
# shell: powershell
- name: Run DVR-Scan
run: |
python -m dvr_scan.app &
- name: Take Screenshot
run: |
Add-Type -AssemblyName System.Windows.Forms
Start-Sleep -Seconds 10
$bounds = [System.Windows.Forms.SystemInformation]::VirtualScreen
$bitmap = New-Object System.Drawing.Bitmap $bounds.Width, $bounds.Height
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
$graphics.CopyFromScreen($bounds.Location, [System.Drawing.Point]::Empty, $bounds.Size)
$bitmap.Save("dvr-scan-screenshot-windows.png", [System.Drawing.Imaging.ImageFormat]::Png)
$graphics.Dispose()
$bitmap.Dispose()
shell: powershell
- name: Upload Screenshot
uses: actions/upload-artifact@v4.6.0
with:
name: dvr-scan-screenshot-windows
path: dvr-scan-screenshot-windows.png
screenshot-linux:
runs-on: ubuntu-latest
env:
UV_SYSTEM_PYTHON: 1
strategy:
matrix:
python-version: ["3.12"]
resolution:
- {width: 1920, height: 1080}
- {width: 2560, height: 1440}
- {width: 3840, height: 2160}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v4
with:
version: "0.5.11"
python-version: ${{ matrix.python-version }}
- name: Install System Dependencies
run: |
sudo apt-get update
sudo apt-get install -y xvfb scrot
- name: Install Python Dependencies
run: |
uv pip install --upgrade pip build wheel virtualenv setuptools
uv pip install -r requirements.txt
- name: Run UI Test
run: |
# Start Xvfb in the background on display :99
Xvfb :99 -screen 0 ${{ matrix.resolution.width }}x${{ matrix.resolution.height }}x24 &
# Set the DISPLAY environment variable for the following commands
export DISPLAY=:99
# Run the application in the background
python -m dvr_scan.app &
# Wait for the application to launch
sleep 10
# Take a screenshot
scrot -d 0 "dvr-scan-screenshot-linux-${{ matrix.resolution.width }}x${{ matrix.resolution.height }}.png"
- name: Upload Screenshot
uses: actions/upload-artifact@v4.6.0
with:
name: dvr-scan-screenshot-linux-${{ matrix.resolution.width }}x${{ matrix.resolution.height }}
path: "dvr-scan-screenshot-linux-${{ matrix.resolution.width }}x${{ matrix.resolution.height }}.png"
# TODO: Resolution matrix
screenshot-macos:
runs-on: macos-latest
env:
UV_SYSTEM_PYTHON: 1
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v4
with:
version: "0.5.11"
python-version: ${{ matrix.python-version }}
- name: Install Python Dependencies
run: |
uv pip install --upgrade pip build wheel virtualenv setuptools
uv pip install -r requirements.txt
- name: Run UI Test
run: |
# Run the application in the background
python -m dvr_scan.app &
# Wait for the application to launch
sleep 10
# Take a screenshot
screencapture "dvr-scan-screenshot-macos.png"
- name: Upload Screenshot
uses: actions/upload-artifact@v4.6.0
with:
name: dvr-scan-screenshot-macos
path: "dvr-scan-screenshot-macos.png"