Skip to content

Commit

Permalink
Refactoring over ci.
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Li authored and Adam Li committed Jun 9, 2021
1 parent 9a70b3b commit 903ca53
Show file tree
Hide file tree
Showing 33 changed files with 1,463 additions and 855 deletions.
Binary file removed .DS_Store
Binary file not shown.
173 changes: 173 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
version: 2
jobs:
build_docs:
docker:
- image: circleci/python:3.8.5-buster
steps:
- restore_cache:
keys:
- source-cache-realtime
- checkout
- run:
name: Complete checkout
command: |
if ! git remote -v | grep upstream; then
git remote add upstream git://github.com/mne-tools/mne-connectivity.git
fi
git fetch upstream
- save_cache:
key: source-cache-realtime
paths:
- ".git"
- run:
name: Set BASH_ENV
command: |
set -e
echo "set -e" >> $BASH_ENV
echo "export OPENBLAS_NUM_THREADS=4" >> $BASH_ENV
echo "export XDG_RUNTIME_DIR=/tmp/runtime-circleci" >> $BASH_ENV
wget -q -O tools/get_minimal_commands.sh https://raw.githubusercontent.com/mne-tools/mne-python/main/tools/get_minimal_commands.sh
source tools/get_minimal_commands.sh
echo "source ${PWD}/tools/get_minimal_commands.sh" >> $BASH_ENV
echo "export PATH=~/.local/bin/:$PATH" >> $BASH_ENV
echo "BASH_ENV:"
cat $BASH_ENV
mkdir -p ~/mne_data
- run:
name: Merge with upstream
command: |
echo $(git log -1 --pretty=%B) | tee gitlog.txt
echo ${CI_PULL_REQUEST//*pull\//} | tee merge.txt
if [[ $(cat merge.txt) != "" ]]; then
echo "Merging $(cat merge.txt)";
git pull --ff-only upstream "refs/pull/$(cat merge.txt)/merge";
fi
- restore_cache:
keys:
- pip-cache

- run:
name: Get Python running
command: |
pip install --user --upgrade --progress-bar off pip numpy
pip install --user --upgrade --progress-bar off -r requirements.txt
pip install --user --upgrade --progress-bar off "sphinxcontrib-bibtex==2.0.0" "https://api.github.com/repos/mne-tools/mne-python/zipball/main" "https://api.github.com/repos/rtfd/sphinx_rtd_theme/zipball/master" "https://api.github.com/repos/sphinx-gallery/sphinx-gallery/zipball/master" memory_profiler
- save_cache:
key: pip-cache
paths:
- ~/.cache/pip

# Look at what we have and fail early if there is some library conflict
- run:
name: Check installation
command: |
which python
python -c "import mne; mne.sys_info()"
LIBGL_DEBUG=verbose python -c "import matplotlib.pyplot as plt; plt.figure()"
python -c "import mne; mne.set_config('MNE_LOGGING_LEVEL', 'info')"
python -c "import mne; level = mne.get_config('MNE_LOGGING_LEVEL'); assert level.lower() == 'info', repr(level)"
# Load our data
- restore_cache:
keys:
- data-cache

- run:
name: Get data
command: |
python setup.py develop --user
mkdir -p ~/mne_data
python -c "import mne; print(mne.datasets.sample.data_path(update_path=True))";
# Build docs
- run:
name: make html
command: |
cd doc;
make html;
# Save the JUnit file
- store_test_results:
path: doc/_build/test-results
- store_artifacts:
path: doc/_build/test-results
destination: test-results

# Save the outputs
- store_artifacts:
path: doc/_build/html/
destination: dev
- persist_to_workspace:
root: doc/_build
paths:
- html

# Keep these separate, maybe better in terms of size limitations (?)
- save_cache:
key: data-cache
paths:
- ~/.mne
- ~/mne_data/MNE-sample-data

deploy:
docker:
- image: circleci/python:3.6-jessie
steps:
- attach_workspace:
at: /tmp/build
- restore_cache:
keys:
- website-cache
- run:
name: Fetch docs
command: |
set -e
mkdir -p ~/.ssh
echo -e "Host *\nStrictHostKeyChecking no" > ~/.ssh/config
chmod og= ~/.ssh/config
if [ ! -d ~/mne-tools.github.io ]; then
git clone git@github.com:/mne-tools/mne-tools.github.io.git ~/mne-tools.github.io --depth=1
fi
- run:
name: Deploy docs
command: |
set -e;
if [ "${CIRCLE_BRANCH}" == "master" ]; then
git config --global user.email "circle@mne.com";
git config --global user.name "Circle CI";
cd ~/mne-tools.github.io;
git checkout master
git remote -v
git fetch origin
git reset --hard origin/master
git clean -xdf
echo "Deploying dev docs for ${CIRCLE_BRANCH}.";
rm -Rf mne-realtime;
cp -a /tmp/build/html mne-realtime;
git add -A;
git commit -m "CircleCI update of mne-realtime docs (${CIRCLE_BUILD_NUM}).";
git push origin master;
else
echo "No deployment (build: ${CIRCLE_BRANCH}).";
fi
- save_cache:
key: website-cache
paths:
- ~/mne-tools.github.io

workflows:
version: 2

default:
jobs:
- build_docs
- deploy:
requires:
- build_docs
filters:
branches:
only:
- master
21 changes: 21 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Configuration for coverage.py

[run]
branch = True
source = mne_realtime
include = */mne_realtime/*
omit =
*/setup.py

[report]
exclude_lines =
pragma: no cover
def __repr__
if self.debug:
if settings.DEBUG
raise AssertionError
raise NotImplementedError
if 0:
if __name__ == .__main__.:
if self.verbose:
show_missing = True
12 changes: 12 additions & 0 deletions .github/workflows/circle_artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
on: [status]
jobs:
circleci_artifacts_redirector_job:
runs-on: ubuntu-20.04
name: Run CircleCI artifacts redirector
steps:
- name: GitHub Action step
uses: larsoner/circleci-artifacts-redirector-action@master
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
artifact-path: 0/dev/index.html
circleci-jobs: build_docs
45 changes: 45 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: 'linux / pip'
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'

jobs:
job:
name: 'py3.9'
runs-on: ubuntu-20.04
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'
name: 'Setup python'
- shell: bash -el {0}
run: |
wget -q -O tools/get_minimal_commands.sh https://raw.githubusercontent.com/mne-tools/mne-python/main/tools/get_minimal_commands.sh
source ./tools/get_minimal_commands.sh
name: 'Install neuromag2ft'
- shell: bash -el {0}
run: neuromag2ft --version
name: 'Test neuromag2ft'
- shell: bash -el {0}
run: ./tools/pip_dependencies.sh
name: 'Install MNE-Realtime'
- shell: bash -el {0}
run: mne sys_info
name: Print config
- shell: bash -el {0}
run: python -c "import mne; print(mne.datasets.testing.data_path(verbose=True))"
name: 'Get test data'
- shell: bash -el {0}
run: pytest mne_realtime
name: 'Run tests'
- uses: codecov/codecov-action@v1
if: success()
name: 'Upload coverage to CodeCov'
40 changes: 40 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: 'macos / conda'
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'

jobs:
job:
name: 'py3.6'
runs-on: macos-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: '3.7'
auto-update-conda: true
environment-file: 'environment.yml'
activate-environment: 'mne_realtime'
name: 'Setup conda'
- shell: bash -el {0}
run: ./tools/pip_dependencies.sh
name: 'Install MNE-Realtime'
- shell: bash -el {0}
run: mne sys_info
name: Print config
- shell: bash -el {0}
run: python -c "import mne; print(mne.datasets.testing.data_path(verbose=True))"
name: 'Get test data'
- shell: bash -el {0}
run: pytest mne_realtime
name: 'Run tests'
- uses: codecov/codecov-action@v1
if: success()
name: 'Upload coverage to CodeCov'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ __pycache__/
# C extensions
*.so

.DS_Store

# Distribution / packaging
.Python
build/
Expand Down
19 changes: 6 additions & 13 deletions doc/api.rst
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
:orphan:

################
mne-realtime API
mne-connectivity API
################

:py:mod:`mne_realtime`:
:py:mod:`mne_connectivity`:

.. automodule:: mne_realtime
.. automodule:: mne_connectivity
:no-members:
:no-inherited-members:

MNE-Realtime
============
MNE-Connectivity
================

.. currentmodule:: mne_realtime
.. currentmodule:: mne_connectivity

.. autosummary::
:toctree: generated/

FieldTripClient
LSLClient
MockLSLStream
MockRtClient
RtEpochs
RtClient
StimServer
StimClient
1 change: 1 addition & 0 deletions doc/authors.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. _Adam Li: https://github.com/adam2392
12 changes: 6 additions & 6 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from sphinx_gallery.sorting import FileNameSortKey
from numpydoc import docscrape
import mne # noqa
from mne_realtime import __version__
from mne_connectivity import __version__

# -- General configuration ------------------------------------------------

Expand Down Expand Up @@ -76,9 +76,9 @@
master_doc = 'index'

# General information about the project.
project = u'MNE-Realtime'
project = u'MNE-Connectivity'
td = date.today()
copyright = u'2012-%s, MNE Developers. Last updated on %s' % (td.year,
copyright = u'2021-%s, MNE Developers. Last updated on %s' % (td.year,
td.isoformat())

nitpicky = True
Expand Down Expand Up @@ -129,7 +129,7 @@
html_style = 'css/project-template.css'

# A list of ignored prefixes for module index sorting.
modindex_common_prefix = ['mne_realtime.']
modindex_common_prefix = ['mne_connectivity.']

# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
Expand Down Expand Up @@ -218,7 +218,7 @@
#html_file_suffix = None

# Output file base name for HTML help builder.
htmlhelp_basename = 'mne-realtime-doc'
htmlhelp_basename = 'mne-connectivity-doc'


# -- Options for LaTeX output ---------------------------------------------
Expand Down Expand Up @@ -411,7 +411,7 @@ def reset_warnings(gallery_conf, fname):
'Montage': 'mne.channels.Montage', 'Forward': 'mne.Forward',
'DigMontage': 'mne.channels.DigMontage',
# mne_realtime
'RtEpochs': 'mne_realtime.RtEpochs',
# 'RtEpochs': 'mne_realtime.RtEpochs',
}
numpydoc_xref_ignore = {
# words
Expand Down
Loading

0 comments on commit 903ca53

Please sign in to comment.