Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
locook03 committed Sep 26, 2023
2 parents c209dcd + e8acafc commit ed198f3
Show file tree
Hide file tree
Showing 89 changed files with 2,231 additions and 3,225 deletions.
213 changes: 95 additions & 118 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,156 +2,145 @@
version: 2.1

jobs:
docs-build:
build_doc:
docker:
- image: circleci/python:3.8.5-buster
environment:
CODECOV_TOKEN: "895aebcc-753e-49f2-b964-b70d38d471c4"
- image: cimg/base:stable-20.04
steps:
- checkout

# make sure pandoc is on the system
- run: sudo apt update && sudo apt install -y pandoc optipng

# restore cache from last build. Unless __init__.py has changed since then
- restore_cache:
name: Restore .git
keys:
- data-cache-0-{{ checksum "./mne_hfo/__init__.py" }}

# Also restore pip cache to speed up installations
- restore_cache: # ensure this step occurs *before* installing dependencies
keys:
# when lock file changes, use increasingly general patterns to restore cache
- pip-packages-v1-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- pip-packages-v1-{{ .Branch }}-
- pip-packages-v1-

- run:
name: Setup Python environment via Pipenv
command: |
sudo pip install --upgrade pip
sudo pip install pipenv
pipenv install --skip-lock --dev
pipenv run pip install --upgrade --progress-bar off https://github.com/mne-tools/mne-python/zipball/main
- run:
name: Run style check
command: |
pipenv run make pep
- run:
name: Build the documentation
command: |
pipenv run make build-doc
- persist_to_workspace:
root: docs/_build
paths: html

- store_artifacts:
path: docs/_build/html/
destination: dev

- save_cache:
key: pip-packages-v1-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
paths:
- "~/.local/share/virtualenvs/venv"

docs-build-test:
docker:
- image: circleci/python:3.8.1-buster
environment:
CODECOV_TOKEN: "895aebcc-753e-49f2-b964-b70d38d471c4"
steps:
- restore_cache:
keys:
- source-cache-hfo

- source-cache-hfo
- checkout

- run:
name: Complete checkout
command: |
if ! git remote -v | grep upstream; then
git remote add upstream git://github.com/mne-tools/mne-hfo.git
git remote add upstream https://github.com/mne-tools/mne-hfo.git
fi
git remote set-url upstream https://github.com/mne-tools/mne-hfo.git
git fetch upstream
- save_cache:
name: Save .git
key: source-cache-hfo
paths:
- ".git"

# make sure pandoc is on the system
- run: sudo apt update && sudo apt install -y pandoc

# Load pip cache
- run:
name: Check-skip
command: |
set -e
export COMMIT_MESSAGE=$(git log --format=oneline -n 1);
if [[ -v CIRCLE_PULL_REQUEST ]] && ([[ "$COMMIT_MESSAGE" == *"[skip circle]"* ]] || [[ "$COMMIT_MESSAGE" == *"[circle skip]"* ]]); then
echo "Skip detected, exiting job ${CIRCLE_JOB} for PR ${CIRCLE_PULL_REQUEST}."
circleci-agent step halt;
fi
- 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
- run:
name: Set BASH_ENV
command: |
set -e
curl https://raw.githubusercontent.com/mne-tools/mne-python/main/tools/setup_xvfb.sh -o setup_xvfb.sh
chmod +x setup_xvfb.sh
./setup_xvfb.sh
sudo apt install -qq graphviz optipng python3.9-venv python3-venv libxft2
python3.9 -m venv ~/python_env
echo "set -e" >> $BASH_ENV
echo "export OPENBLAS_NUM_THREADS=4" >> $BASH_ENV
echo "export XDG_RUNTIME_DIR=/tmp/runtime-circleci" >> $BASH_ENV
echo "export PATH=~/.local/bin/:$PATH" >> $BASH_ENV
echo "export DISPLAY=:99" >> $BASH_ENV
echo "source ~/python_env/bin/activate" >> $BASH_ENV
mkdir -p ~/.local/bin
ln -s ~/python_env/bin/python ~/.local/bin/python
echo "BASH_ENV:"
cat $BASH_ENV
- run:
name: Setup pandoc
command: sudo apt update && sudo apt install -y pandoc optipng
- restore_cache:
name: Restore pip cache
keys:
- pip-cache
- restore_cache:
name: Restore install-bin-cache
keys:
- user-install-bin-cache

- run:
name: Setup Python environment
name: Get Python running and install dependencies
command: |
python -m pip install --upgrade --progress-bar off --only-binary matplotlib -r requirements.txt
python -m pip install --upgrade --progress-bar off -r requirements_testing.txt
python -m pip install --upgrade --progress-bar off https://github.com/mne-tools/mne-python/zipball/main
python -m pip install --progress-bar off https://github.com/sphinx-gallery/sphinx-gallery/zipball/master
sudo python -m pip install -e .
python -m pip install --progress-bar off --upgrade pip setuptools wheel
python -m pip install --progress-bar off .
python -m pip install --progress-bar off .[doc]
python -m pip install --progress-bar off git+https://github.com/mne-tools/mne-python
- save_cache:
name: Save pip cache
key: pip-cache
paths:
- ~/.cache/pip

- save_cache:
name: Save install-bin-cache
key: user-install-bin-cache
paths:
- ~/.local/lib/python3.8/site-packages
- ~/.local/lib/python3.9/site-packages
- ~/.local/bin

# Look at what we have and fail early if there is some library conflict
- run:
name: Check pip package versions
command: pip freeze
- run:
name: Display MNE infos
command: QT_DEBUG_PLUGINS=1 mne sys_info -pd
- 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)"
python -c "import numpy; numpy.show_config()"
- run:
name: Build the documentation
name: Build documentation
command: |
make build-doc
- persist_to_workspace:
root: docs/_build
paths: html

cd doc
make html
# Save the example test results
- store_test_results:
path: doc/_build/test-results
- store_artifacts:
path: docs/_build/html/
path: doc/_build/test-results
destination: test-results
# Save the SG RST
- store_artifacts:
path: doc/auto_examples.zip
- store_artifacts:
path: doc/generated.zip
# Save the outputs
- store_artifacts:
path: doc/_build/html/
destination: dev

# - run:
# name: Check links
# command: |
# pipenv run make -C doc clean
# pipenv run make -C docs linkcheck
# pipenv run make -C doc linkcheck-grep
# - store_artifacts:
# path: doc/_build/html_stable/
# destination: stable
- persist_to_workspace:
root: doc/_build
paths:
- html
# - html_stable

docs-deploy:
# will only be run on master branch
# will only be run on main branch
docker:
- image: node:8.10.0
steps:
- checkout

- attach_workspace:
at: docs/_build
at: doc/_build

- run:
name: Install and configure dependencies
Expand All @@ -162,32 +151,20 @@ jobs:
- add_ssh_keys:
fingerprints:
- "35:48:e2:58:4c:3f:44:b9:0e:64:40:60:06:d2:1f:bf"
- "6c:24:92:1e:bd:93:77:49:6f:fa:64:f9:ed:1b:d2:69"

- run:
# push built docs into the `dev` directory on the `gh-pages` branch
name: Deploy docs to gh-pages branch
command: gh-pages --dotfiles --message "doc updates [skip ci]" --dist docs/_build/html --dest ./dev
command: gh-pages --dotfiles --message "doc updates [skip ci]" --dist doc/_build/html --dest ./dev

workflows:
commit:
jobs:
- docs-build
- build_doc
- docs-deploy:
requires:
- docs-build
filters:
branches:
only: master

scheduled:
jobs:
- docs-build

triggers:
- schedule:
cron: "0 4 * * *"
- build_doc
filters:
branches:
only:
- master
only: main
5 changes: 5 additions & 0 deletions .codespellignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
raison
ue
f0
fo
Yse
26 changes: 26 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[flake8]
max-line-length = 100

ignore =
# these rules don't play well with black
# whitespace before ':'
E203
# line break before binary operator
W503
E241,E305,W504,W605,E731

exclude =
.git
.github
.venv
.mypy_cache
.pytest_cache
.circleci
paper
setup.py
doc

per-file-ignores =
# __init__.py files are allowed to have unused imports
*/__init__.py:F401
*/**/__init__.py:F401
22 changes: 22 additions & 0 deletions .github/workflows/cffconvert.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: cffconvert

on:
push:
paths:
- CITATION.cff
pull_request:
paths:
- CITATION.cff

jobs:
validate:
name: "validate"
runs-on: ubuntu-latest
steps:
- name: Check out a copy of the repository
uses: actions/checkout@v4

- name: Check whether the citation metadata from CITATION.cff is valid
uses: citation-file-format/[email protected]
with:
args: "--validate"
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
on: [status]
jobs:
circleci_artifacts_redirector_job:
if: "${{ startsWith(github.event.context, 'ci/circleci: build_doc') }}"
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 }}
api-token: ${{ secrets.CIRCLECI_TOKEN }}
artifact-path: 0/dev/index.html
circleci-jobs: docs-build
circleci-jobs: build_doc
job-title: Check the rendered docs here!

Loading

0 comments on commit ed198f3

Please sign in to comment.