Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/psychopy/psychopy into tests…
Browse files Browse the repository at this point in the history
…-codeQL
  • Loading branch information
peircej committed Jul 28, 2023
2 parents 00f22a0 + a23ba5f commit c574351
Show file tree
Hide file tree
Showing 646 changed files with 42,430 additions and 15,325 deletions.
65 changes: 65 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Bug Report
description: File a bug report
labels: 🐞 bug
title: "[Bug]: "
body:
- type: input
id: psychopy-version
attributes:
label: PsychoPy Version
description: What version of PsychoPy are you using?
placeholder: "e.g. 2023.1.3"
validations:
required: true
- type: dropdown
id: os
attributes:
label: What OS are your PsychoPy running on?
description: Please mention the name and version of the Operation System that you are using?
multiple: true
options:
- Windows 10
- Windows 11
- macOS Intel
- macOS Silicon
- Linux-based systems
- Other
validations:
required: true
- type: textarea
id: bug-description
attributes:
label: Bug Description
description: |
Please tell us what happened.
Note: You can attach images or log info by dragging files in this input field.
placeholder: "Describe the issue in detail"
validations:
required: true
- type: textarea
id: expected-behaviour
attributes:
label: Expected Behaviour
description: Please tell us what should have happened instead of the bug.
placeholder: "The correct behavior I expected is..."
validations:
required: true
- type: textarea
id: steps-to-reproduce
attributes:
label: Steps to Reproduce
description: Can you reproduce the bug? If so, please let us know what steps you take to reproduce this bug.
value: |
1.
2.
3.
...
validations:
required: true
- type: textarea
id: bug-additional-context
attributes:
label: Additional context
description: Add any other context about the bug here.
validations:
required: false
51 changes: 51 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Feature Request
description: Request a new feature, or an enhancement to an existing functionality
labels: 🌟 enhancement
title: "[Feature Request]: "
body:
- type: markdown
attributes:
value: |
Please try to describe your request or enhancement as detailed as possible.
- type: textarea
id: feature-short-description
attributes:
label: Description
description: Please describe this feature or enhancement here.
validations:
required: false
- type: textarea
id: feature-purpose
attributes:
label: Purpose
description: What is the purpose of this feature or enhancement, or give some use cases?
validations:
required: false
- type: textarea
id: feature-is-related-to-a-problem
attributes:
label: Is your feature request related to a problem?
description: A clear and concise description of what the problem is, note if it's a bug please report it in [Bug] template.
validations:
required: false
- type: textarea
id: feature-solution-description
attributes:
label: Describe the solution you would like
description: A clear and concise description of what you want to happen.
validations:
required: false
- type: textarea
id: feature-alternative
attributes:
label: Describe alternatives that you have considered
description: A clear and concise description of any alternative solutions or features you've considered.
validations:
required: false
- type: textarea
id: feature-additional-context
attributes:
label: Additional context
description: Add any other context or screenshots about the feature request here.
validations:
required: false
34 changes: 34 additions & 0 deletions .github/workflows/checksum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#! python3

"""Using Python to create a cross-platform function to
compare sha checksums (mostly because windows pwsh annoying) """

import hashlib

def checksum(filename, sha_file, alg='sha256'):
"""Verify a hash and raise error if fails"""
computed_hash = getattr(hashlib, alg)
computed_hash = hashlib.sha256()
with open(filename, 'rb') as f:
computed_hash.update(f.read())
computed_hash = computed_hash.hexdigest()
with open(sha_file) as f:
hash_value = f.read().split()[0]
if computed_hash != hash_value:
raise ValueError(f"The hash did not match:\n"
f" - {filename}: {repr(computed_hash)}\n"
f" - {sha_file}: {repr(hash_value)}")
print(f"Confirmed checksum OK for: {filename}")


if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(
prog = 'checksum.py',
description = 'Checks a hash against a known sha '
'value and raises error if not equal')
parser.add_argument('filename')
parser.add_argument('sha_file')
parser.add_argument('alg', default='sha256')
args = parser.parse_args()
checksum(args.filename, args.sha_file, args.alg)
95 changes: 63 additions & 32 deletions .github/workflows/pytests.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: pytest

on: [push, pull_request]
on:
workflow_dispatch: # manual
pull_request:
branches: [ release, dev ]

permissions:
contents: read
Expand All @@ -17,30 +20,39 @@ jobs:
python-version: [3.8]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Pre-Install
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 attrdict3 # used by wxpython setup
python ./building/plat_custom_installs.py
- name: Install PsychoPy and dependencies
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: |
# for pocketsphinx we need this adapted package:
brew install swig vlc
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
# then use the standard requirements:
pip install .
pip install moviepy
# - name: test docs to pdf
# run: |
Expand Down Expand Up @@ -77,11 +89,11 @@ jobs:

- 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-config=.travis_coveragerc --cov=psychopy -v psychopy
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@v2
uses: actions/upload-artifact@v3
with:
name: prefs for ${{ matrix.os }}_${{ matrix.python-version }}
path: |
Expand All @@ -91,17 +103,18 @@ jobs:
- name: upload failed screenshots
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: test artifacts
path: |
psychopy/tests/data
psychopy/tests/fails
!**/*.mp4
!psychopy/tests/**/*.data
!**/*.wav
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
if: always()
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false

Expand Down Expand Up @@ -141,10 +154,10 @@ jobs:
python-version: [3.8]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -155,7 +168,7 @@ jobs:

- name: cache wxPython for linux
if: runner.os=='Linux'
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ matrix.os }}-py${{ matrix.python-version }}-${{ steps.get_month.outputs.month }}
Expand All @@ -169,10 +182,10 @@ jobs:
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 libsdl-dev libsdl2-mixer-2.0-0 libsdl2-image-2.0-0 libsdl2-2.0-0
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-6.0-dev # for xvfb
sudo apt install llvm-13-dev # for xvfb
sudo apt install xvfb xauth libgl1-mesa-dri
# set up fake sound device?
Expand All @@ -186,12 +199,6 @@ jobs:
export LIBGL_ALWAYS_INDIRECT=0
export QT_DEBUG_PLUGINS=1 # let us know about missing dependencies?
- name: Install wxPython from source for linux
if: runner.os=='Linux'
run: |
# these are needed to build wxPython
pip install pip install -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04/ wxPython
- name: Install packaging and testing libs
run: |
python -m pip install --upgrade pip
Expand All @@ -200,47 +207,71 @@ jobs:
pip install six # for configobj and wxpython
pip install distro # used by createInitFile
- name: Install PsychoPy Dependencies
- name: Install wxPython from https://extras.wxpython.org/wxPython4/extras
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
- name: Install main dependencies (pip)
run: |
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
# to install all dependencies
pip install .
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: always()
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" --cov-config=.travis_coveragerc --cov=psychopy -v psychopy
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@v2
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@v1
if: always()
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false

Expand All @@ -253,4 +284,4 @@ jobs:
# # 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 ..
# # cd ..
Loading

0 comments on commit c574351

Please sign in to comment.