forked from e1miran/Now-Playing-Serato
-
Notifications
You must be signed in to change notification settings - Fork 12
297 lines (286 loc) · 9.26 KB
/
testing.yaml
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# This workflow file generates binaries for both Windows
# and OS X. However, https://github.com/actions/upload-artifact/issues/38
# that basically says that it won't ever preserve permissions.
# That means an archive in an archive since we need to preserve them
# on OS X. Still... better than doing this all by hand.
# yamllint disable rule:line-length
---
name: testing
on: [push] # yamllint disable-line rule:truthy
env:
# API tests
ACOUSTID_TEST_APIKEY: ${{ secrets.ACOUSTID_TEST_APIKEY }} # pragma: allowlist secret
DISCOGS_API_KEY: ${{ secrets.DISCOGS_API_KEY }} # pragma: allowlist secret
FANARTTV_API_KEY: ${{ secrets.FANARTTV_API_KEY }} # pragma: allowlist secret
THEAUDIODB_API_KEY: ${{ secrets.THEAUDIODB_API_KEY }} # pragma: allowlist secret
# needed for upgrade test
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}} # pragma: allowlist secret
jobs:
testing-macos:
runs-on: macos-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: setup python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: install homebrew dependencies
run: |
brew update --preinstall || true
brew install pkg-config icu4c
- name: install python dependencies
run: |
export PATH="$(brew --prefix)/opt/icu4c/bin:$(brew --prefix)/opt/icu4c/sbin:$PATH"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$(brew --prefix)/opt/icu4c/lib/pkgconfig"
python3 --version
python3.11 -m venv /tmp/venv
source /tmp/venv/bin/activate
python3.11 -m pip install --upgrade pip
pip install ".[test,osspecials]"
pip uninstall -y nowplaying
versioningit --write
python3.11 setupnltk.py
- name: tests
shell: bash
run: |
if [[ -n "${ACOUSTID_TEST_APIKEY}" ]]; then
pushd /tmp
curl --location --output fpcalc.tgz \
https://github.com/acoustid/chromaprint/releases/download/v1.5.1/chromaprint-fpcalc-1.5.1-macos-x86_64.tar.gz
tar xvpf fpcalc.tgz
FPCALC=/tmp/chromaprint-fpcalc-1.5.1-macos-x86_64/fpcalc
export FPCALC
popd
fi
source /tmp/venv/bin/activate
pytest --durations=10 -s tests
ls -al .coverage*
coverage xml
- name: artifact mac test
uses: actions/upload-artifact@v4
if: always()
with:
name: macos-coverage
include-hidden-files: true
path: |
.coverage
.coverage.*
.coverage*
coverage.xml
# htmlcov
# - name: codecov
# uses: codecov/codecov-action@v5
# with:
# fail_ci_if_error: true # optional (default = false)
# files: ./coverage.xml # optional
# flags: unittests # optional
# name: codecov-mac11 # optional
# token: ${{ secrets.CODECOV_TOKEN }} # required
# verbose: true # optional (default = false)
testing-win:
runs-on: windows-2019
steps:
- run: Set-MpPreference -DisableRealtimeMonitoring $true
shell: powershell
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: update tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: setup python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: install dependencies
run: |
python fix_win_ver.py
python -m pip install --upgrade pip
pip install ".[test,osspecials]"
pip uninstall -y nowplaying
versioningit --write
python setupnltk.py
- name: tests
shell: bash
run: |
if [[ -n "${ACOUSTID_TEST_APIKEY}" ]]; then
pushd /tmp
curl --location --output fpcalc.zip \
https://github.com/acoustid/chromaprint/releases/download/v1.5.1/chromaprint-fpcalc-1.5.1-windows-x86_64.zip
unzip fpcalc.zip
FPCALC=/tmp/chromaprint-fpcalc-1.5.1-windows-x86_64/fpcalc.exe
export FPCALC
popd
fi
pytest --durations=10 -s tests
coverage xml
- name: artifact windows test
uses: actions/upload-artifact@v4
if: always()
with:
name: win-coverage
include-hidden-files: true
path: |
.coverage
.coverage.*
htmlcov
coverage.xml
# - name: codecov
# uses: codecov/codecov-action@v5
# with:
# fail_ci_if_error: true # optional (default = false)
# files: ./coverage.xml # optional
# flags: unittests # optional
# name: codecov-windows # optional
# token: ${{ secrets.CODECOV_TOKEN }} # required
# verbose: true # optional (default = false)
testing-linux:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.10", "3.11"]
env:
DISPLAY: ':99.0'
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: setup X11xvfb
run: |
sudo apt install \
libxcb-cursor0 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-shape0 \
libxcb-xfixes0 \
libxcb-xinerama0 \
libxkbcommon-x11-0 \
x11-utils
/sbin/start-stop-daemon \
--start --quiet \
--pidfile /tmp/custom_xvfb_99.pid \
--make-pidfile --background \
--exec /usr/bin/Xvfb -- :99 \
-screen 0 1920x1200x24 -ac +extension GLX
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
--no-install-recommends \
--no-install-suggests \
libchromaprint-tools \
libdbus-1-dev \
libegl1 \
python3-dbus \
python3-pip
#
#
# dbus breaks venv so just skip it
# since we are just doing unit tests
#
#
python3 -m venv /tmp/venv
source /tmp/venv/bin/activate
python3 -m pip install --upgrade pip
pip install ".[test,osspecials]"
pip uninstall -y nowplaying
versioningit --write
python setupnltk.py
- name: tests
shell: bash
run: |
if [[ -n "${ACOUSTID_TEST_APIKEY}" ]]; then
pushd /tmp
FPCALC=/usr/bin/fpcalc
export FPCALC
popd
fi
source /tmp/venv/bin/activate
pytest --durations=10 -s
coverage xml
- name: artifact linux test
uses: actions/upload-artifact@v4
if: always()
with:
name: linux-coverage-${{ matrix.python }}
include-hidden-files: true
path: |
.coverage
.coverage.*
htmlcov
coverage.xml
# - name: codecov
# uses: codecov/codecov-action@v5
# with:
# fail_ci_if_error: true # optional (default = false)
# files: ./coverage.xml # optional
# flags: unittests # optional
# name: codecov-linux-${{matrix.python}} # optional
# token: ${{ secrets.CODECOV_TOKEN }} # required
# verbose: true # optional (default = false)
merge:
if: always()
needs:
- testing-macos
- testing-win
- testing-linux
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: setup python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: install dependencies
run: |
python3 -m venv /tmp/venv
source /tmp/venv/bin/activate
python3 -m pip install --upgrade pip
pip install ".[test]"
- name: download coverage files
uses: actions/download-artifact@v4
with:
path: artifacts
- name: display artifacts
run: ls -aR
working-directory: artifacts
- name: merge coverage files
run: |
source /tmp/venv/bin/activate
coverage combine artifacts/*/.coverage artifacts/*/.coverage.*
coverage html
coverage xml
- name: artifact full tests
uses: actions/upload-artifact@v4
if: always()
with:
name: full-coverage
path: |
.coverage
htmlcov
coverage.xml
- name: codecov
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
fail_ci_if_error: true # optional (default = false)
files: ./coverage.xml
flags: unittests # optional
name: codecov-umbrella # optional
token: ${{ secrets.CODECOV_TOKEN }} # required
verbose: true # optional (default = false)