forked from psychopy/psychopy
-
Notifications
You must be signed in to change notification settings - Fork 1
205 lines (178 loc) · 7.42 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
name: pytest
on:
workflow_dispatch: # manual
pull_request:
branches: [ release, dev ]
permissions:
contents: read
jobs:
testsuite:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13, ubuntu-latest]
python-version: ['3.8', '3.10']
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 Linux system 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: Pre-Install
run: |
python -m pip install --upgrade pip
pip install wheel
pip install six # for configobj and wxpython
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 add -G tests
# 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: |
if [ "${{ runner.os }}" == "macOS" ]
then
# for pocketsphinx we need this adapted package:
brew install swig vlc portaudio portmidi liblo sdl2
fi
# install optional components
pip install psychopy-sounddevice psychopy-pyo psychopy-legacy-mic psychopy-connect psychopy-crs psychopy-emotiv psychopy-gammasci psychopy-mri-emulator
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: Set nice level (linux)
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
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
xvfb-run -a --server-args="-screen 0 1024x768x24" python psychopy/tests/test_gui/test_DlgFromDictWx.py
- name: Test with pytest
run: |
if [ "${{ runner.os }}" == "Linux" ]
then
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
else
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
fi
- name: upload failed app data
if: always()
uses: actions/upload-artifact@v4
with:
name: prefs_files_${{ matrix.os }}_${{ matrix.python-version }}
path: |
~/.psychopy3
!~/.psychopy3/versions
!~/.psychopy3/fonts
- name: upload failed screenshots
if: always()
uses: actions/upload-artifact@v4
with:
name: failed_test_data_${{ github.run_id }}_${{ matrix.python-version }}_${{ matrix.os }}
path: |
psychopy/tests/fails
!**/*.mp4
!psychopy/tests/**/*.data
!**/*.wav
- name: Upload coverage to Codecov
if: always()
uses: codecov/codecov-action@v4
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
# - name: test docs to pdf
# if: runner.os=='Linux'
# 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 ..