Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MRG: CircleCI 2.0 #350

Merged
merged 10 commits into from May 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
72 changes: 72 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,72 @@
version: 2
jobs:
build:
docker:
- image: circleci/python:3.6-stretch
steps:
# Get our data and merge with upstream
- checkout
- run: echo $(git log -1 --pretty=%B) | tee gitlog.txt
- run: echo ${CI_PULL_REQUEST//*pull\//} | tee merge.txt
- run: sudo apt-get install libglu1-mesa
- run: wget https://github.com/downloads/AVbin/AVbin/install-avbin-linux-x86-64-v10
- run: sudo sh ./install-avbin-linux-x86-64-v10
- run:
command: |
if [[ $(cat merge.txt) != "" ]]; then
echo "Merging $(cat merge.txt)";
git pull --ff-only origin "refs/pull/$(cat merge.txt)/merge";
fi
- run: echo "export DISPLAY=:99" >> $BASH_ENV
- run: echo "export _EXPYFUN_SILENT=true" >> $BASH_ENV
- run: echo "export PATH=~/.local/bin:$PATH" >> $BASH_ENV
- run: /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1400x900x24 -ac +extension GLX +render -noreset;
- run: pip install --quiet --upgrade --user pip
- run: pip install --quiet --upgrade --user numpy scipy matplotlib sphinx pillow pandas h5py mne pyglet==1.2.4 psutil sphinx_bootstrap_theme numpydoc https://api.github.com/repos/sphinx-gallery/sphinx-gallery/zipball/master
- run: python -c "import mne; mne.sys_info()"
- run: python setup.py develop --user
- run: cd doc && make html

- store_artifacts:
path: doc/_build/html/
destination: html

- persist_to_workspace:
root: doc/_build
paths:
- html


deploy:
docker:
- image: circleci/python:3.6-stretch
steps:
- attach_workspace:
at: /tmp/_build
- run:
name: upload
command: |
echo "Deploying docs."
git clone https://github.com/LABSN/labsn.github.io.git ~/labsn.github.io --depth=1
git config --global user.email "circle@labsn.github.io"
git config --global user.name "Circle CI"
cd ~/labsn.github.io
git checkout master
git pull origin master
rm -Rf ~/labsn.github.io/expyfun
cp -a /tmp/_build/html ~/labsn.github.io/expyfun
git add -A
git commit -m "CircleCI update of docs (${CIRCLE_BUILD_NUM})."
git push origin master

workflows:
version: 2
build_and_deploy:
jobs:
- build
- deploy:
requires:
- build
filters:
branches:
only: master
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -66,3 +66,5 @@ env/

# pycharm
.idea/

.pytest_cache/
8 changes: 4 additions & 4 deletions .travis.yml
Expand Up @@ -50,8 +50,8 @@ before_install:
- conda update --yes conda
- conda create -n testenv --yes --quiet pip python=$PYTHON
- source activate testenv
- conda install --yes scipy matplotlib nose coverage setuptools
- pip install -q coveralls
- conda install --yes scipy matplotlib nose coverage setuptools pytest pytest-cov
- pip install -q coveralls pytest-sugar
# install AVbin
- if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
curl -L https://github.com/downloads/AVbin/AVbin/AVbin10.pkg -o AVbin10.pkg;
Expand All @@ -61,7 +61,7 @@ before_install:
dbus-launch pulseaudio --start;
fi;
# Only install these deps if necessary (slow on Py3k)
- pip install -q nose-timer flake8 pyglet mne six; # mne is a dependency now that resample is taken from it
- pip install -q flake8 pyglet mne; # mne is a dependency now that resample is taken from it
# Full dependencies (pandas, mne-python, h5py, joblib)
- if [ "${DEPS}" == "full" ]; then
conda install --yes --quiet pandas h5py;
Expand All @@ -72,7 +72,7 @@ install:
- python setup.py develop

script:
- nosetests --with-timer --timer-top-n=10 --with-coverage
- pytest expyfun
- make flake

after_success:
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Expand Up @@ -8,7 +8,7 @@ environment:
global:
PYTHON: "C:\\conda"
MINICONDA_VERSION: "latest"
CONDA_DEPENDENCIES: "numpy scipy matplotlib coverage nose setuptools h5py pandas"
CONDA_DEPENDENCIES: "numpy scipy matplotlib coverage nose setuptools h5py pandas pytest pytest-cov"
PIP_DEPENDENCIES: "pyglet mne tdtpy"

matrix:
Expand All @@ -35,4 +35,4 @@ build: false # Not a C# project, build stuff at the test step instead.

test_script:
# Run the project tests
- "nosetests.exe"
- "pytest expyfun"
57 changes: 0 additions & 57 deletions circle.yml

This file was deleted.

25 changes: 8 additions & 17 deletions doc/Makefile
Expand Up @@ -15,9 +15,8 @@ ALLSPHINXOPTS = -d _build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html_stable to make standalone HTML files (stable version)"
@echo " html_dev to make standalone HTML files (dev version)"
@echo " html_dev-pattern to make standalone HTML files for one example dir (dev version)"
@echo " html to make standalone HTML files"
@echo " html-pattern to make standalone HTML files for one example"
@echo " *-noplot to make standalone HTML files without plotting"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " pickle to make pickle files"
Expand All @@ -35,25 +34,17 @@ clean:
-rm -rf auto_tutorials
-rm -rf generated

html_stable:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html_stable
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html
@echo
@echo "Build finished. The HTML pages are in _build/html_stable."

html_dev:
BUILD_DEV_HTML=1 $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html
@echo
@echo "Build finished. The HTML pages are in _build/html"
@echo "Build finished. The HTML pages are in _build/html."

html_dev-pattern:
BUILD_DEV_HTML=1 $(SPHINXBUILD) -D plot_gallery=1 -D sphinx_gallery_conf.filename_pattern=$(PATTERN) -b html $(ALLSPHINXOPTS) _build/html
html-pattern:
$(SPHINXBUILD) -D plot_gallery=1 -D sphinx_gallery_conf.filename_pattern=$(PATTERN) -b html $(ALLSPHINXOPTS) _build/html
@echo
@echo "Build finished. The HTML pages are in _build/html"

html_dev-noslow:
BUILD_DEV_HTML=1 $(SPHINXBUILD) -D plot_gallery=fast -b html $(ALLSPHINXOPTS) _build/html

html_dev-noplot:
html-noplot:
BUILD_DEV_HTML=1 $(SPHINXBUILD) -D plot_gallery=0 -b html $(ALLSPHINXOPTS) _build/html
@echo
@echo "Build finished. The HTML pages are in _build/html."
Expand Down
12 changes: 6 additions & 6 deletions expyfun/_experiment_controller.py
Expand Up @@ -783,12 +783,12 @@ def load_video(self, file_name, pos=(0, 0), units='norm', center=True):
try:
self.video = Video(self, file_name, pos, units)
except MediaFormatException:
err = ('Something is wrong; probably you tried to load a '
'compressed video file but you do not have AVbin installed.'
' Download and install it; if you are on Windows, you may '
'also need to manually copy the AVbin .dll file(s) from '
'C:\Windows\system32 to C:\Windows\SysWOW64.')
raise RuntimeError(err)
raise RuntimeError(
r'Something is wrong; probably you tried to load a '
r'compressed video file but you do not have AVbin installed.'
r' Download and install it; if you are on Windows, you may '
r'also need to manually copy the AVbin .dll file(s) from '
r'C:\Windows\system32 to C:\Windows\SysWOW64.')

def delete_video(self):
self.video._delete()
Expand Down
2 changes: 1 addition & 1 deletion expyfun/_externals/decorator.py
Expand Up @@ -60,7 +60,7 @@ def __iter__(self):
def get_init(cls):
return cls.__init__.__func__

DEF = re.compile('\s*def\s*([_\w][_\w\d]*)\s*\(')
DEF = re.compile(r'\s*def\s*([_\w][_\w\d]*)\s*\(')

# basic functionality
class FunctionMaker(object):
Expand Down
3 changes: 3 additions & 0 deletions expyfun/_git.py
Expand Up @@ -83,6 +83,9 @@ def download_version(version='current', dest_dir=None):
sys.path.insert(0, expyfun_dir)
orig_stdout = sys.stdout
try:
# on pytest with Py3k this can be problematic
if 'setup' in sys.modules:
del sys.modules['setup']
import setup
reload(setup)
setup_version = setup.git_version()
Expand Down
8 changes: 5 additions & 3 deletions expyfun/_utils.py
Expand Up @@ -530,9 +530,11 @@ def fetch_data_file(fname):
if not op.isfile(fname_out):
try:
with open(fname_out, 'wb') as fid:
www = this_urlopen(fname_url, timeout=10.0)
fid.write(www.read())
www.close()
www = this_urlopen(fname_url, timeout=30.0)
try:
fid.write(www.read())
finally:
www.close()
except Exception:
os.remove(fname_out)
raise
Expand Down
4 changes: 1 addition & 3 deletions expyfun/analyze/_viz.py
Expand Up @@ -493,7 +493,5 @@ def plot_screen(screen, ax=None):
plt.figure()
ax = plt.axes([0, 0, 1, 1])
ax.imshow(screen)
ax.set_xticks([])
ax.set_yticks([])
plt.box('off')
ax.axis('off')
return ax
7 changes: 0 additions & 7 deletions expyfun/tests/test_experiment_controller.py
Expand Up @@ -12,8 +12,6 @@
fake_mouse_click, requires_opengl21)
from expyfun.stimuli import get_tdt_rates

warnings.simplefilter('always')

std_args = ['test'] # experiment name
std_kwargs = dict(output_dir=None, full_screen=False, window_size=(1, 1),
participant='foo', session='01', stim_db=0.0, noise_db=0.0,
Expand Down Expand Up @@ -176,12 +174,10 @@ def test_ec(ac=None, rd=None):
stim_fs=100., suppress_resamp=suppress,
**std_kwargs) as ec:
pass
warnings.simplefilter('ignore') # ignore dummy TDT warning
with ExperimentController(*std_args, audio_controller=this_ac,
response_device=this_rd,
trigger_controller=this_tc,
stim_fs=this_fs, **std_kwargs) as ec:
warnings.simplefilter('always')
assert_true(ec.participant == std_kwargs['participant'])
assert_true(ec.session == std_kwargs['session'])
assert_true(ec.exp_name == std_args[0])
Expand Down Expand Up @@ -259,7 +255,6 @@ def test_ec(ac=None, rd=None):
ec.load_buffer(noise) # should go unchecked
ec.set_rms_checking('wholefile')
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter('always')
ec.load_buffer(click) # should pass
assert_equal(len(w), 0)
ec.load_buffer(noise)
Expand Down Expand Up @@ -395,13 +390,11 @@ def test_tdtpy_failure(ac=None, rd=None):
@_hide_window
def test_button_presses_and_window_size():
"""Test EC window_size=None and button press capture."""
warnings.simplefilter('ignore') # esc as quit key
with ExperimentController(*std_args, audio_controller='pyglet',
response_device='keyboard', window_size=None,
output_dir=None, full_screen=False, session='01',
participant='foo', trigger_controller='dummy',
force_quit='escape', version='dev') as ec:
warnings.simplefilter('always')
ec.listen_presses()
ec.get_presses()
assert_equal(ec.get_presses(), [])
Expand Down