forked from psychopy/psychopy
-
Notifications
You must be signed in to change notification settings - Fork 1
289 lines (247 loc) · 9.99 KB
/
pytests.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
name: pytest
on:
push:
branches: [ release, dev ]
pull_request:
branches: [ release, dev ]
permissions:
contents: read
jobs:
testsuite_mac:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [macos-latest]
python-version: [3.8]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Pre-Install
run: |
python -m pip install --upgrade pip
pip install wheel
pip install six # for configobj and wxpython
pip install distro # used by createInitFile
pip install attrdict3 # used by wxpython setup
python ./building/plat_custom_installs.py
pip install pdm
pdm config python.use_venv false # don't need/want venv in a vm!
pdm install # fetch dependendices in lock file
pdm install -G tests
pdm build
# install with pip both the main and [tests] group
pip install . --prefer-binary # install with pip
pip install '.[tests]' --prefer-binary # optional dependency group
- name: Install plugins
run: |
# for pocketsphinx we need this adapted package:
brew install swig vlc portaudio portmidi liblo sdl2
# install optional components
pip install psychopy-sounddevice psychopy-pyo psychopy-legacy-mic psychopy-connect psychopy-crs psychopy-emotiv psychopy-gammasci psychopy-mri-emulator psychopy-visionscience
pip install moviepy
# - name: test docs to pdf
# run: |
# pip install sphinx sphinxcontrib-napoleon
# brew install basictex # or mactex
# # update path after brew install
# eval "$(/usr/libexec/path_helper)"
# sudo tlmgr update --self
# sudo tlmgr install latexmk
# sudo tlmgr install collection-fontsrecommended
# sudo tlmgr install collection-fontsextra
# cd docs
# make latexpdf
# cd ..
# - name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test gui toolkits Qt
run: |
# quick test of the gui toolkits (without pytest swallowing errors)
python psychopy/tests/test_gui/test_DlgFromDictQt.py
# always fails due to lack of pythonw
# - name: Test gui toolkits Wx
# if: always()
# run: |
# # quick test of the gui toolkits (without pytest swallowing errors)
# pythonw psychopy/tests/test_gui/test_DlgFromDictWx.py
- name: Test with pytest
run: |
pytest --ignore="psychopy/tests/test_app" --ignore="psychopy/tests/test_preferences" --ignore="psychopy/tests/test_experiment/needs_wx" -m "not needs_sound and not needs_wx and not emulator" --cov=psychopy -v psychopy
- name: upload failed app data
if: always()
uses: actions/upload-artifact@v3
with:
name: prefs for ${{ matrix.os }}_${{ matrix.python-version }}
path: |
~/.psychopy3
!~/.psychopy3/versions
!~/.psychopy3/fonts
- name: upload failed screenshots
if: always()
uses: actions/upload-artifact@v3
with:
name: test artifacts
path: |
psychopy/tests/fails
!**/*.mp4
!psychopy/tests/**/*.data
!**/*.wav
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
# - name: test docs to pdf
# run: |
# pip install sphinx sphinxcontrib-napoleon
# brew install basictex
# # update path after brew install
# eval "$(/usr/libexec/path_helper)"
# # go to the folder and make
# cd docs
# make latexpdf
# cd ..
# - name: Check bdist/sdist
# # checks whether different forms of build work (e.g. missing files in sdist)
# run: |
# python setup.py build
# # Build & install sdist
# python setup.py sdist --formats=gztar
# pip install --no-deps dist/PsychoPy-*.tar.gz
# pip uninstall --yes psychopy
# # Build & install wheel
# python setup.py bdist_wheel
# pip install --no-deps dist/PsychoPy-*.whl
# # uninstall the build (but not the dependencies)
# pip uninstall --yes psychopy
testsuite_ubuntu:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # debugging builds lets see them all!
matrix:
os: [ubuntu-latest]
python-version: [3.8]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: get_month
if: runner.os=='Linux'
id: month
run: echo "::set-output name=month::$(date +'%Y-%m')"
- name: cache wxPython for linux
if: runner.os=='Linux'
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ matrix.os }}-py${{ matrix.python-version }}-${{ steps.get_month.outputs.month }}
- name: Install apt-get dependencies
if: runner.os=='Linux'
run: |
# mostly for wxPython:
sudo apt-get update
sudo apt-get install -y -qq python3-dev libgtk-3-dev
sudo apt-get install -y -qq libgstreamer1.0-0 gstreamer1.0-plugins-base
sudo apt-get install -y -qq libwebkit2gtk-4.0-dev
sudo apt-get install -y -qq libpng-dev libjpeg-dev libtiff-dev libnotify-dev libsm-dev
sudo apt-get install -y -qq libsdl2-dev libsdl2-mixer-2.0-0 libsdl2-image-2.0-0 libsdl2-2.0-0
sudo apt-get install -y -qq libportaudio2
# virtual frame buffer
sudo apt install llvm-13-dev # for xvfb
sudo apt install xvfb xauth libgl1-mesa-dri
# set up fake sound device?
# sudo apt-get install -y -qq libasound2-dev alsa-utils alsa-oss
# sudo apt-get install -y linux-modules-extra-$(uname -r) # needed for modprobe snd-dummy
# sudo sh .github/workflows/prep_dummy_soundcard.sh # couldn't find that file
# for PyQt:
sudo apt-get install -y -qq libdbus-1-3
sudo apt-get install -y -qq '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
export LIBGL_ALWAYS_INDIRECT=0
export QT_DEBUG_PLUGINS=1 # let us know about missing dependencies?
- name: Install packaging and testing libs
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov flake8 xmlschema
pip install wheel
pip install six # for configobj and wxpython
pip install distro # used by createInitFile
pip install pdm
- name: Install wxPython from source for linux
if: runner.os=='Linux'
run: |
# these are needed to build wxPython
pip install attrdict3 # used by wxpython setup
pip install pip install -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04/ wxPython
pdm remove wxpython # no longer needed in the pdm
- name: Install main dependencies (pdm) and PsychoPy (pip)
run: |
pdm install # fetch dependendices in lock file
pdm build # test that we can build the sdist.tar.gz and whl files
pip install .
- name: Install PsychoPy plugins
run: |
# install optional components
pip install psychopy-sounddevice psychopy-pyo psychopy-legacy-mic psychopy-connect psychopy-crs psychopy-emotiv psychopy-gammasci psychopy-mri-emulator psychopy-visionscience
pip install moviepy
- name: Set nice level
if: runner.os=='Linux'
run: |
# sudo setcap cap_sys_nice=eip ${{ env.pythonLocation }}/python
export PYTHON_EXECUTABLE=`python -c "import os; import sys; print(os.path.realpath(sys.executable))"`
sudo setcap cap_sys_nice+ep ${PYTHON_EXECUTABLE}
getcap ${PYTHON_EXECUTABLE} # did it work?
- name: Test gui toolkits Qt
if: runner.os=='Linux'
run: |
# quick test of the gui toolkits (without pytest swallowing errors)
xvfb-run -a --server-args="-screen 0 1024x768x24" python psychopy/tests/test_gui/test_DlgFromDictQt.py
- name: Test gui toolkits Wx
if: runner.os=='Linux'
run: |
# quick test of the gui toolkits (without pytest swallowing errors)
xvfb-run -a --server-args="-screen 0 1024x768x24" python psychopy/tests/test_gui/test_DlgFromDictWx.py
- name: Test with pytest
run: |
xvfb-run -a --server-args="-screen 0 1024x768x24" pytest -m "not needs_sound and not needs_wx and not needs_qt and not needs_pygame and not emulator" --cov=psychopy -v psychopy
- name: upload failed app data
if: always()
uses: actions/upload-artifact@v3
with:
name: prefs for ${{ matrix.os }}_${{ matrix.python-version }}
path: |
~/.psychopy3
!~/.psychopy3/versions
!~/.psychopy3/fonts
- name: upload failed screenshots
if: always()
uses: actions/upload-artifact@v3
with:
name: test artifacts
path: |
psychopy/tests/fails
!**/*.mp4
!psychopy/tests/**/*.data
!**/*.wav
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
# - name: test docs to pdf
# run: |
# sudo apt-get install -y python3-sphinx
# which sphinx-build
# which python
# python -c "import psychopy; psychopy"
# # sudo apt-get install -y latexmk xindy texlive-latex-recommended texlive-xetex texlive-latex-extra texlive-fonts-recommended texlive-fonts-extra
# # cd docs
# # make latexpdf
# # cd ..