Skip to content

Commit aa5b129

Browse files
authored
Merge pull request #48 from brainprepdesk/dev
Release 2.0.0
2 parents f533c35 + ec3ce1c commit aa5b129

158 files changed

Lines changed: 18552 additions & 6661 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/codespellignore.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
licences

.github/run_examples.py

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/run_unitests.py

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/codespell.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
# Workflow to check common misspellings in text files.
3+
#
4+
# To run this check locally from the repository folder:
5+
#
6+
# .. code-block:: bash
7+
#
8+
# $ codespell --toml pyproject.toml brainprep examples
9+
###
10+
name: "SpellLinter[codespell]"
11+
12+
on:
13+
push:
14+
branches:
15+
- "master"
16+
- "main"
17+
- "dev"
18+
pull_request:
19+
branches:
20+
- "*"
21+
workflow_dispatch:
22+
23+
jobs:
24+
codespell:
25+
26+
runs-on: ${{ matrix.os }}
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
os: [ubuntu-latest]
31+
python-version: [3.12]
32+
33+
steps:
34+
- name: Checkout repository
35+
uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 0
38+
- name: Set up Python ${{ matrix.python-version }}
39+
uses: actions/setup-python@v5
40+
with:
41+
python-version: ${{ matrix.python-version }}
42+
- name: Codespell
43+
uses: codespell-project/actions-codespell@v2
44+
with:
45+
path: examples,brainprep
46+
builtin: clear,rare,en-GB_to_en-US
47+
ignore_words_file: ./.github/codespellignore.txt
48+
skip: ./.git,*.bib,./brainprep/resources/*,./AUTHORS.rst
Lines changed: 68 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,104 @@
1-
name: "DOCUMENTATION"
1+
# Workflow to build doc, upload it as artifact, and deploy it for the
2+
# master, main and dev branches.
3+
#
4+
# To run this check locally from the `doc` folder:
5+
#
6+
# .. code-block:: bash
7+
#
8+
# $ sphinxdoc -v 2 -p $MODULE_DIR -n brainprep -o $MODULE_DIR/doc
9+
# $ cd $MODULE_DIR/doc
10+
# $ make html-strict
11+
###
12+
name: "DocumentationBuilder"
213

314
on:
415
push:
516
branches:
617
- "master"
18+
- "main"
19+
- "dev"
720
pull_request:
821
branches:
922
- "*"
23+
workflow_dispatch:
24+
25+
env:
26+
MIN_PYTHON_VERSION: "3.12"
1027

1128
jobs:
1229

1330
build_and_deploy:
1431

15-
runs-on: ${{ matrix.os }}
16-
if: ${{ github.ref == 'refs/heads/master' }}
32+
runs-on: "ubuntu-latest"
1733
strategy:
1834
fail-fast: false
19-
matrix:
20-
os: [ubuntu-latest]
21-
python-version: [3.12]
35+
env:
36+
FREESURFER_HOME: "/freesurfer/home"
2237

2338
permissions:
2439
contents: write
2540

2641
steps:
42+
- name: Extract branch name
43+
id: extract-branch
44+
shell: bash
45+
run: echo "BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
46+
- name: Identify deploy type
47+
id: deploy-type
48+
run: |
49+
if ${{ github.ref == 'refs/heads/master' ||
50+
github.ref == 'refs/heads/main' }}; then
51+
echo "DEPLOY_TYPE=stable" >> $GITHUB_OUTPUT
52+
elif ${{ github.ref == 'refs/heads/dev' }}; then
53+
echo "DEPLOY_TYPE=dev" >> $GITHUB_OUTPUT
54+
else
55+
echo "DEPLOY_TYPE=pr" >> $GITHUB_OUTPUT
56+
fi
2757
- name: Checkout repository
28-
uses: actions/checkout@v4
58+
uses: actions/checkout@v5
2959
with:
3060
fetch-depth: 0
31-
- name: Set up Python ${{ matrix.python-version }}
32-
uses: actions/setup-python@v5
61+
- name: Set up Python
62+
uses: actions/setup-python@v6
3363
with:
34-
python-version: ${{ matrix.python-version }}
35-
- name: Install dependencies
64+
python-version: ${{ env.MIN_PYTHON_VERSION }}
65+
cache: "pip"
66+
- name: Install Python dependencies
3667
run: |
3768
python -m pip install --upgrade pip
38-
python -m pip install --progress-bar off .
39-
python -m pip install git+https://github.com/AGrigis/pysphinxdoc.git
40-
python -m pip install requests "scipy<=1.15" statsmodels
41-
python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
42-
python -m pip install git+https://github.com/neurospin-deepinsight/brainrise.git
69+
python -m pip install --progress-bar off ".[ci,doc]"
70+
- name: Install apt packages
71+
uses: awalsh128/cache-apt-pkgs-action@latest
72+
with:
73+
packages: dvipng texlive-latex-base texlive-latex-extra build-essential
74+
version: 1.0
75+
- name: Install documentation resources
76+
run: |
77+
DIR=$(pwd)
78+
which python
79+
sphinxdoc -v 2 -p $DIR -n brainprep -o $DIR/doc
4380
- name: Compute documentation
4481
run: |
45-
mkdir -p tmp/doc
46-
sphinxdoc -v 2 -p . -n brainprep -o tmp/doc
47-
cd tmp/doc
48-
make raw-html
49-
ls source/_static
50-
ls build/html/_static
51-
cp -r source/_static/* build/html/_static
52-
cd ../..
82+
DIR=$(pwd)
83+
cd $DIR/doc
84+
echo "Documentation folder: $DIR/doc"
85+
make html-strict
86+
cd $DIR
5387
- name: Upload documentation as an artifact
5488
uses: actions/upload-artifact@v4
89+
env:
90+
DEPLOY_TYPE: ${{ steps.deploy-type.outputs.DEPLOY_TYPE }}
5591
with:
56-
name: html-documentation
57-
retention-days: 15
92+
name: doc-${{ env.DEPLOY_TYPE }}
93+
retention-days: 1
5894
path: |
59-
tmp/doc/build/html
95+
doc/_build/html
6096
- name: Deploy
97+
env:
98+
DEPLOY_TYPE: ${{ steps.deploy-type.outputs.DEPLOY_TYPE }}
99+
if: env.DEPLOY_TYPE != 'pr'
61100
uses: peaceiris/actions-gh-pages@v4
62101
with:
63102
github_token: ${{ secrets.GITHUB_TOKEN }}
64-
publish_dir: tmp/doc/build/html
65-
66-
build:
67-
68-
runs-on: ${{ matrix.os }}
69-
if: ${{ github.ref != 'refs/heads/master' }}
70-
strategy:
71-
fail-fast: false
72-
matrix:
73-
os: [ubuntu-latest]
74-
python-version: [3.12]
75-
76-
permissions:
77-
contents: write
78-
79-
steps:
80-
- name: Checkout repository
81-
uses: actions/checkout@v4
82-
with:
83-
fetch-depth: 0
84-
- name: Set up Python ${{ matrix.python-version }}
85-
uses: actions/setup-python@v5
86-
with:
87-
python-version: ${{ matrix.python-version }}
88-
- name: Install dependencies
89-
run: |
90-
python -m pip install --upgrade pip
91-
python -m pip install --progress-bar off .
92-
python -m pip install git+https://github.com/AGrigis/pysphinxdoc.git
93-
python -m pip install requests "scipy<=1.15" statsmodels
94-
python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
95-
python -m pip install git+https://github.com/neurospin-deepinsight/brainrise.git
96-
- name: Compute documentation
97-
run: |
98-
mkdir -p tmp/doc
99-
sphinxdoc -v 2 -p . -n brainprep -o tmp/doc
100-
cd tmp/doc
101-
make raw-html
102-
ls source/_static
103-
ls build/html/_static
104-
cp -r source/_static/* build/html/_static
105-
cd ../..
103+
publish_dir: doc/_build/html
104+
destination_dir: ./${{ env.DEPLOY_TYPE }}

.github/workflows/pep8.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/pycodestyle.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
# Workflow to check code format.
3+
#
4+
# To run this check locally from the repository folder:
5+
#
6+
# .. code-block:: bash
7+
#
8+
# $ pycodestyle brainprep --ignore="E121,E123,E126,E226,E24,E704,E402,E731,E722,E741,W503,W504,W605,E305,E125"
9+
###
10+
name: "PythonLinter[pycodestyle]"
11+
12+
on:
13+
push:
14+
branches:
15+
- "master"
16+
- "main"
17+
- "dev"
18+
pull_request:
19+
branches:
20+
- "*"
21+
workflow_dispatch:
22+
23+
jobs:
24+
build:
25+
26+
runs-on: ${{ matrix.os }}
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
os: [ubuntu-latest]
31+
python-version: [3.12]
32+
33+
steps:
34+
- name: Checkout repository
35+
uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 0
38+
- name: Set up Python ${{ matrix.python-version }}
39+
uses: actions/setup-python@v5
40+
with:
41+
python-version: ${{ matrix.python-version }}
42+
- name: Install dependencies
43+
run: |
44+
python -m pip install --upgrade pip
45+
python -m pip install pycodestyle
46+
pip install --progress-bar off .
47+
- name: Check Python syntax
48+
run: |
49+
pycodestyle brainprep --ignore="E121,E123,E126,E226,E24,E704,E402,E731,E722,E741,W503,W504,W605,E305,E125"

0 commit comments

Comments
 (0)