forked from RomanHargrave/displaycal
-
Notifications
You must be signed in to change notification settings - Fork 61
189 lines (165 loc) · 6.06 KB
/
pytest.yml
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
188
189
name: Tests
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, unlabeled]
branches:
- develop
push:
branches:
- develop
jobs:
build:
name: Test with Python ${{ matrix.python-version }} and wxPython ${{ matrix.wx-version }}
env:
DISPLAY: :0
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
wx-version:
- "4.1.1"
- "4.2.1"
- "4.2.2"
exclude:
- python-version: "3.11"
wx-version: "4.1.1"
- python-version: "3.12"
wx-version: "4.1.1"
- python-version: "3.12"
wx-version: "4.2.1"
- python-version: "3.13"
wx-version: "4.1.1"
- python-version: "3.13"
wx-version: "4.2.1"
steps:
- uses: actions/checkout@v4
- name: Set Environment Variables
run: |
echo "py_version=$(echo ${{ matrix.python-version }} | tr -d .)" >> $GITHUB_ENV
if [ "${{ matrix.python-version }}" == "3.8" ]; then
echo "add_dir_str=${{ matrix.python-version }}" >> $GITHUB_ENV
elif [ "${{ matrix.python-version }}" == "3.9" ]; then
echo "add_dir_str=${{ matrix.python-version }}" >> $GITHUB_ENV
elif [ "${{ matrix.python-version }}" == "3.10" ]; then
echo "add_dir_str=cpython-310" >> $GITHUB_ENV
elif [ "${{ matrix.python-version }}" == "3.11" ]; then
echo "add_dir_str=cpython-311" >> $GITHUB_ENV
elif [ "${{ matrix.python-version }}" == "3.12" ]; then
echo "add_dir_str=cpython-312" >> $GITHUB_ENV
elif [ "${{ matrix.python-version }}" == "3.13" ]; then
echo "add_dir_str=cpython-313" >> $GITHUB_ENV
fi
- name: Setup xvfb
run: |
sudo apt-get update
sudo apt-get install -y xvfb \
libxkbcommon-x11-0 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-xinerama0 \
libxcb-xinput0 \
libxcb-xfixes0
# start xvfb in the background
sudo /usr/bin/Xvfb $DISPLAY -screen 0 1280x1024x24 &
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: |
sudo apt-get install -y $(grep -o ^[^#][[:alnum:]-]*.* "packages.list")
python3 -m pip install --upgrade pip
pip install wheel
- name: Install wxPython ${{ matrix.wx-version }}
run: |
pip install wxPython==${{ matrix.wx-version }}
- name: Install Python dependencies
run: |
pip install -r requirements-tests.txt
pip install -r requirements-dev.txt
- name: Build DisplayCAL
run: |
sudo chmod a+rw /etc/udev/rules.d
python3 -m build
ls -l dist/
wheel_file=$(ls dist/DisplayCAL-*.whl)
pip install $wheel_file
- name: Test with pytest
run: |
python -m pytest --verbose -n auto -W ignore --color=yes --cov=. --cov-report html
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report-${{ env.py_version }}-${{ matrix.wx-version }}
path: htmlcov
retention-days: 10
windows:
name: Test with Python ${{ matrix.python-version }} on Windows
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
steps:
- uses: actions/checkout@v4
- name: Set Environment Variables
run: |
$py_version = "${{ matrix.python-version }}" -replace '\.', ''
echo "py_version=$py_version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
if ("${{ matrix.python-version }}" -eq "3.8") {
echo "add_dir_str=${{ matrix.python-version }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
} elseif ("${{ matrix.python-version }}" -eq "3.9") {
echo "add_dir_str=${{ matrix.python-version }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
} elseif ("${{ matrix.python-version }}" -eq "3.10") {
echo "add_dir_str=cpython-310" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
} elseif ("${{ matrix.python-version }}" -eq "3.11") {
echo "add_dir_str=cpython-311" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
} elseif ("${{ matrix.python-version }}" -eq "3.12") {
echo "add_dir_str=cpython-312" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: |
python -m pip install --upgrade pip
pip install wheel
# - name: Install wxPython
# run: |
# pip install -U wxPython
- name: Install Python dependencies
run: |
pip install -r requirements-tests.txt -r requirements-dev.txt
- name: Compile C-Extensions
run: |
python -m build
ls -l dist/
$wheel_file = Get-ChildItem -Path dist -Filter DisplayCAL-*.whl
pip install $wheel_file.FullName
$PYPATH = Get-Command python | Select-Object -ExpandProperty Source
$PYDIR = Split-Path $PYPATH
Copy-Item -Path "$PYDIR\Lib\site-packages\DisplayCAL\lib64\python${{ env.py_version }}\RealDisplaySizeMM.*.pyd" -Destination "./DisplayCAL/lib64/python${{ env.py_version }}/"
- name: Test with pytest
run: |
python -m pytest --verbose --cov=. --cov-report html
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report-${{ env.py_version }}-windows
path: htmlcov
retention-days: 10