Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
aab3ccc
_
jeromedockes Apr 4, 2025
9c64ec5
_
jeromedockes Apr 4, 2025
a4b3888
TEMP remove pushing only if main
jeromedockes Apr 4, 2025
ce40e2c
_
jeromedockes Apr 4, 2025
a28d22c
_
jeromedockes Apr 4, 2025
3382333
_
jeromedockes Apr 6, 2025
60d1c84
_
jeromedockes Apr 6, 2025
fa452d5
_
jeromedockes Apr 6, 2025
ea8612c
_
jeromedockes Apr 6, 2025
aaf01f1
_
jeromedockes Apr 6, 2025
fd2c324
_
jeromedockes Apr 6, 2025
5983f58
_
jeromedockes Apr 6, 2025
5d70356
_
jeromedockes Apr 6, 2025
0a56678
_
jeromedockes Apr 6, 2025
9702968
_
jeromedockes Apr 6, 2025
8209e79
_
jeromedockes Apr 6, 2025
5679b8f
_
jeromedockes Apr 6, 2025
be4bd2e
_
jeromedockes Apr 6, 2025
220634b
_
jeromedockes Apr 6, 2025
25bb12a
_
jeromedockes Apr 6, 2025
38fd4ee
_
jeromedockes Apr 6, 2025
d061281
_
jeromedockes Apr 7, 2025
84a9289
_
jeromedockes Apr 9, 2025
e2c1a41
_
jeromedockes Apr 9, 2025
bf78842
fast doc
lionelkusch Apr 18, 2025
050b541
test \n \n [doc quick]
lionelkusch Apr 18, 2025
c42f7c9
test
lionelkusch Apr 18, 2025
c84c25b
fix bug
lionelkusch Apr 18, 2025
b43eee6
test
lionelkusch Apr 18, 2025
0908c70
fix format
lionelkusch Apr 18, 2025
aa69c2b
congigure for a commit
lionelkusch Apr 18, 2025
54929a8
fix error
lionelkusch Apr 18, 2025
70c38d5
try next
lionelkusch Apr 18, 2025
3891bdc
fix command
lionelkusch Apr 18, 2025
2322b32
fix variable
lionelkusch Apr 18, 2025
86dd8b0
try with gitaction
lionelkusch Apr 18, 2025
1c1574d
[doc quick]
lionelkusch Apr 18, 2025
6127af7
[doc quick]
lionelkusch Apr 18, 2025
b026d3d
[doc quick]
lionelkusch Apr 18, 2025
8124d5f
[doc quick]
lionelkusch Apr 18, 2025
ec24975
[doc quick]
lionelkusch Apr 18, 2025
7df7719
[doc quick]
lionelkusch Apr 18, 2025
eaa9252
[doc quick]
lionelkusch Apr 18, 2025
3555561
[doc quick]
lionelkusch Apr 18, 2025
4b307bf
[doc quick]
lionelkusch Apr 18, 2025
163ad14
[doc quick]
lionelkusch Apr 18, 2025
c8e8409
[doc quick]
lionelkusch Apr 18, 2025
f95fe7f
[doc quick]
lionelkusch Apr 18, 2025
145ee76
[doc quick]
lionelkusch Apr 18, 2025
d5fa4ee
[doc quick]
lionelkusch Apr 18, 2025
622328d
[doc quick]
lionelkusch Apr 18, 2025
cdaca13
[doc quick]
lionelkusch Apr 18, 2025
28c4dc8
[doc quick]
lionelkusch Apr 18, 2025
86b5225
[doc quick]
lionelkusch Apr 18, 2025
f7d60ff
[doc quick]
lionelkusch Apr 18, 2025
1aa3066
[doc quick]
lionelkusch Apr 18, 2025
0caf70a
[doc quick]
lionelkusch Apr 18, 2025
02993b4
[doc quick]
lionelkusch Apr 18, 2025
423c8a0
[doc quick]
lionelkusch Apr 18, 2025
d9f48cb
[doc quick]
lionelkusch Apr 18, 2025
73f1285
[doc quick]
lionelkusch Apr 18, 2025
b8890d4
[doc quick]
lionelkusch Apr 18, 2025
9b00392
[doc quick]
lionelkusch Apr 18, 2025
68b2a3f
add new script
lionelkusch Apr 18, 2025
7efa06d
[doc quick]
lionelkusch Apr 18, 2025
0873748
[doc quick]
lionelkusch Apr 18, 2025
5be0561
[doc quick]
lionelkusch Apr 18, 2025
e500086
[doc quick]
lionelkusch Apr 18, 2025
7d4b1ae
[doc quick]
lionelkusch Apr 18, 2025
49c2aad
[doc quick]
lionelkusch Apr 18, 2025
777c419
[doc quick]
lionelkusch Apr 22, 2025
cb9be9f
[doc quick]
lionelkusch Apr 22, 2025
066355a
[doc quick]
lionelkusch Apr 22, 2025
fa0efeb
[doc quick]
lionelkusch Apr 22, 2025
b21e7bb
[doc quick]
lionelkusch Apr 22, 2025
f4499dd
[doc quick]
lionelkusch Apr 22, 2025
6e1d858
[doc quick]
lionelkusch Apr 22, 2025
597b01f
[doc quick]
lionelkusch Apr 22, 2025
393395a
[doc quick]
lionelkusch Apr 22, 2025
66d659d
[doc quick]
lionelkusch Apr 22, 2025
1d2194f
[doc quick]
lionelkusch Apr 22, 2025
dc38f29
[doc quick]
lionelkusch Apr 22, 2025
2e0f18d
[doc quick]
lionelkusch Apr 22, 2025
878b2d4
[doc quick]
lionelkusch Apr 22, 2025
b23ad51
[doc quick]
lionelkusch Apr 22, 2025
f88b67f
[doc quick]
lionelkusch Apr 22, 2025
7f76afd
[doc quick]
lionelkusch Apr 22, 2025
7dce52f
[doc quick]
lionelkusch Apr 22, 2025
f73dd93
[doc quick]
lionelkusch Apr 22, 2025
c777a26
[doc quick]
lionelkusch Apr 22, 2025
511c0da
[doc quick]
lionelkusch Apr 22, 2025
d158811
[doc quick]
lionelkusch Apr 22, 2025
3eaedf3
[doc quick]
lionelkusch Apr 22, 2025
1e742eb
[doc quick]
lionelkusch Apr 22, 2025
8d5526c
[doc quick]
lionelkusch Apr 22, 2025
fcf10fa
[doc quick]
lionelkusch Apr 22, 2025
43ce7c1
donwload_doc in circleci
lionelkusch Apr 22, 2025
bd07c8d
[doc quick]
lionelkusch Apr 22, 2025
36aa808
[doc quick]
lionelkusch Apr 22, 2025
08e9ad9
[doc quick]
lionelkusch Apr 22, 2025
6de0465
[doc quick]
lionelkusch Apr 22, 2025
d9b082b
[doc quick]
lionelkusch Apr 22, 2025
ba58420
[doc quick]
lionelkusch Apr 22, 2025
561997b
[doc quick]
lionelkusch Apr 22, 2025
8f267da
[doc quick]
lionelkusch Apr 22, 2025
ed56f0e
[doc quick]
lionelkusch Apr 22, 2025
923277b
[doc quick]
lionelkusch Apr 22, 2025
19cff2c
[doc quick]
lionelkusch Apr 22, 2025
3af9566
[doc quick]
lionelkusch Apr 22, 2025
40d35bd
[doc quick]
lionelkusch Apr 22, 2025
7591b8e
[doc quick]
lionelkusch Apr 22, 2025
a30b6e6
[doc quick]
lionelkusch Apr 22, 2025
8cc38be
[doc quick]
lionelkusch Apr 22, 2025
52caed7
[doc quick]
lionelkusch Apr 22, 2025
19f9a10
[doc quick]
lionelkusch Apr 22, 2025
b0ef723
[doc quick]
lionelkusch Apr 22, 2025
f84d9c6
[doc quick]
lionelkusch Apr 22, 2025
a2faa2d
[doc quick]
lionelkusch Apr 22, 2025
2d9efbb
[doc quick]
lionelkusch Apr 22, 2025
83fb185
[doc quick]
lionelkusch Apr 22, 2025
2c91357
[doc quick]
lionelkusch Apr 22, 2025
9209b0d
[doc quick]
lionelkusch Apr 22, 2025
160d1bc
[doc quick]
lionelkusch Apr 23, 2025
8ca680b
[doc quick]
lionelkusch Apr 23, 2025
4f0283e
refactor file
lionelkusch Apr 23, 2025
7c2db8b
fix issue with uv
lionelkusch Apr 23, 2025
b6d36df
fix uv issue
lionelkusch Apr 23, 2025
c2b5905
create a virtual environment
lionelkusch Apr 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 107 additions & 61 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,112 @@
---
version: 2.1

parameters:
# Parameters required to trigger the execution of the "host_docs" job
GITHUB_RUN_URL:
type: string
default: none

workflows:
version: 2
build-doc-and-deploy:
# default build and deployment of the documentation
jobs:
- build_doc
- deploy:
requires:
- build_doc

host_and_deploy_doc:
# action trigger by updating the link og github
when:
not:
equal: [none, << pipeline.parameters.GITHUB_RUN_URL >>]
# The jobs should run only when triggered by the workflow
jobs:
- host_docs

jobs:
python3:
docker:
- image: cimg/python:3.9
environment:
- USERNAME: "jeromedockes"
- ORGANIZATION: "hidimstat"
- DOC_REPO: "hidimstat.github.io"
- DOC_URL: ""
- EMAIL: "jerome@dockes.org"
- MINICONDA_PATH: ~/miniconda
- CONDA_ENV_NAME: testenv
- PYTHON_VERSION: "3.12"
- OMP_NUM_THREADS: 2
steps:
- checkout
- run: ./build_tools/circle/checkout_merge_commit.sh
- restore_cache:
key: saved-cache
- run:
command: ./build_tools/circle/build_doc.sh
no_output_timeout: 40m
- store_artifacts:
path: doc_conf/_build/html
destination: doc_conf
- store_artifacts:
path: ~/log.txt
destination: log.txt
# Persists generated documentation so that it can be attached and deployed
# in the 'deploy' step.
- persist_to_workspace:
root: doc_conf/_build/html
paths: .
- save_cache:
key: saved-cache
paths:
- /home/circleci/nilearn_data
- /home/circleci/sklearn_data
# download some data from github
host_docs:
machine:
image: ubuntu-2204:current
environment:
GITHUB_ARTIFACT_URL: << pipeline.parameters.GITHUB_RUN_URL >>
steps:
- checkout
- run:
name: "unzip artifact"
command: |
set -x -e
wget $GITHUB_ARTIFACT_URL
unzip DocHTML.zip -d DocHTML
- store_artifacts:
path: DocHTML/
destination: html

deploy:
docker:
- image: cimg/python:3.9
steps:
- checkout
- run: ./build_tools/circle/checkout_merge_commit.sh
# Attach documentation generated in the 'python3' step so that it can be
# deployed.
- attach_workspace:
at: doc_conf/_build/html
- run: ls -ltrh doc_conf/_build/html
- deploy:
command: |
if [[ "${CIRCLE_BRANCH}" =~ ^main$|^[0-9]+\.[0-9]+\.X$ ]]; then
bash build_tools/circle/push_doc.sh doc_conf/_build/html
fi
# create the documentation on circleci and push it to github
build_doc:
docker:
- image: cimg/python:3.13
steps:
- checkout
- run:
name: "checkout to the good commit"
command: ./build_tools/circle/checkout_merge_commit.sh
- restore_cache:
key: saved-cache
- run:
name: "build documentation"
command: ./build_tools/circle/build_doc.sh
no_output_timeout: 40m
- store_artifacts:
path: doc_conf/_build/html
destination: doc_conf
- store_artifacts:
path: ~/log.txt
destination: log.txt
# Persists generated documentation so that it can be attached and deployed
# in the 'deploy' step.
- persist_to_workspace:
root: doc_conf/_build/html
paths: .
- save_cache:
# cache some library
key: saved-cache
paths:
- /home/circleci/nilearn_data
- /home/circleci/sklearn_data

# deploy docmuentation on github
# require to add a ssh key in circleci
deploy:
docker:
- image: cimg/deploy:2025.01
environment:
ORGANIZATION: lionelkusch
DOC_REPO: lionelkusch.github.io
EMAIL: actions@github.com
USERNAME: GitHub actions
steps:
- checkout
- add_ssh_keys:
fingerprints:
- "SHA256:SSOrd4ijaSJjqXxqBZTZ1d6oxXtMr+TpE1CWZSfqh7k"
- run:
command: ./build_tools/circle/checkout_merge_commit.sh
# Attach documentation generated in the 'build_doc' step so that it can be
# deployed.
- attach_workspace:
at: doc_conf/_build/html
- run:
command: |
mkdir -p ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts
ls -ltrh doc_conf/_build/html
- deploy:
command: |
#if [[ "${CIRCLE_BRANCH}" =~ ^main$|^[0-9]+\.[0-9]+\.X$ ]]; then
bash build_tools/circle/push_doc.sh doc_conf/_build/html
#fi

workflows:
version: 2
build-doc-and-deploy:
jobs:
- python3
- deploy:
requires:
- python3
72 changes: 68 additions & 4 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: Documentation

on:
pull_request:
push:
branches: main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

Expand All @@ -19,6 +17,8 @@ permissions:
jobs:
build_docs:
runs-on: ubuntu-latest
outputs:
url_doc: ${{ steps.upload_doc.outputs.artifact-url}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -31,13 +31,14 @@ jobs:
- name: Sphinx build
id: build-docs
run: |
sphinx-build -b html doc_conf doc/_build/html
cd doc_conf; make html-noplot
- name: Upload documentation
id: upload_doc
if: steps.build-docs.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: DocHTML
path: doc/_build/html
path: doc_conf/_build/html

deploy_on_main:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -68,3 +69,66 @@ jobs:
directory: hidimstat
github_token: ${{ secrets.GITHUB_TOKEN }}

deploy_documentation:
name: Deploy documentation
runs-on: ubuntu-latest
needs: [build_docs]
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Add SSH key
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
mkdir -p ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts
echo "${{ secrets.ACTIONS_SSH_DEPLOY }}" > ~/.ssh/github_actions
chmod 600 ~/.ssh/github_actions
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add ~/.ssh/github_actions

- uses: actions/download-artifact@v4
with:
name: DocHTML
path: doc/_build/html

- name: deploy
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
COMMIT_SHA: ${{ github.event.head_commit.id }}
run: |
export ORGANIZATION="lionelkusch"
export DOC_REPO="lionelkusch.github.io"
git config --global user.email "actions@github.com"
git config --global user.name "GitHub actions"
./build_tools/circle/push_doc.sh doc/_build/html

push_on_circle_ci:
runs-on: ubuntu-latest
# Run the job only if the "DocumentationBuilder" workflow succeeded
# Prevents this workflow from running on a fork.
# To test this workflow on a fork remove the `github.repository == nilearn/nilearn` condition
needs: [build_docs]
steps:
- name: Trigger hosting job on circle ci
run: |
set -x -a
# get the number of the PR
# $(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
PULL_REQUEST_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')

# get the branch of the PR
BRANCH=pull/$PULL_REQUEST_NUMBER/head

# get URL for download artifact without identification
GITHUB_RUN_URL="https://nightly.link/$(echo ${{needs.build_docs.outputs.url_doc}} | cut -d/ -f4-8)/DocHTML.zip"

# Send the information to circleci
curl --request POST \
--url https://circleci.com/api/v2/project/gh/${{ github.repository }}/pipeline \
--header "Circle-Token: ${{ secrets.CIRCLE_CI }}" \
--header "content-type: application/json" \
--header "x-attribution-actor-id: github_actions" \
--header "x-attribution-login: github_actions" \
--data \{\"branch\":\"$BRANCH\",\"parameters\":\{\"GITHUB_RUN_URL\":\"$GITHUB_RUN_URL\"\}\}
25 changes: 20 additions & 5 deletions .github/workflows/circleci-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,32 @@ permissions:
statuses: write

jobs:
circleci_artifacts_redirector_job:
circleci_artifacts_redirector_host_doc:
runs-on: ubuntu-latest
# For testing this action on a fork, remove the "github.repository =="" condition.
if: "github.repository == 'mind-inria/hidimstat' && github.event.context == 'ci/circleci: python3'"
if: "github.event.context == 'ci/circleci: host_docs'"
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.CIRCLE_CI }}
artifact-path: 0/doc_conf/index.html
circleci-jobs: python3
job-title: Check the rendered docs here!
artifact-path: 0/html/index.html
circleci-jobs: host_docs
job-title: Check the rendered github docs here!

circleci_artifacts_redirector_job_build_doc:
runs-on: ubuntu-latest
# For testing this action on a fork, remove the "github.repository =="" condition.
if: "github.event.context == 'ci/circleci: build_doc'"
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.CIRCLE_CI }}
artifact-path: 0/html/index.html
circleci-jobs: host_docs
job-title: Check the rendered circleci docs here!
24 changes: 4 additions & 20 deletions build_tools/circle/build_doc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,26 +91,10 @@ else
make_args="html"
fi

# deactivate circleci virtualenv and setup a miniconda env instead
if [[ `type -t deactivate` ]]; then
deactivate
fi

# Install dependencies with miniconda
wget "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh" -O miniconda.sh
chmod +x miniconda.sh && bash ./miniconda.sh -b -p "miniconda"
export PATH="miniconda/bin:$PATH"

# Configure the conda environment and put it in the path using the
# provided versions
mamba create -n $CONDA_ENV_NAME --yes python="${PYTHON_VERSION:-*}" \
numpy="${NUMPY_VERSION:-*}" scipy="${SCIPY_VERSION:-*}" \
pytest coverage matplotlib="${MATPLOTLIB_VERSION:-*}" sphinx \
seaborn statsmodels pillow cython joblib pandas="${PANDAS_VERSION:-*}"

source activate $CONDA_ENV_NAME

pip install -e ".[doc]"
python -m venv .venv
source .venv/bin/activate
pip install uv
uv pip install -e ".[doc]"

# The pipefail is requested to propagate exit code
set -o pipefail && cd doc_conf && make $make_args 2>&1 | tee ~/log.txt
Expand Down
14 changes: 9 additions & 5 deletions build_tools/circle/push_doc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
# The behavior of the script is controlled by environment variable defined
# in the circle.yml in the top level folder of the project.

set -e
set -x

GENERATED_DOC_DIR=$1

if [[ -z "$GENERATED_DOC_DIR" ]]; then
Expand All @@ -21,27 +24,28 @@ then
else
# Strip off .X
dir="${CIRCLE_BRANCH::-2}"
# TODO remove
dir=dev
fi

MSG="Pushing the docs to $dir/ for branch: $CIRCLE_BRANCH, commit $CIRCLE_SHA1"

cd $HOME
if [ ! -d $DOC_REPO ];
then git clone --depth 1 --no-checkout -b main "git@github.com:"$ORGANIZATION"/"$DOC_REPO".git";
then git clone "git@github.com:"$ORGANIZATION"/"$DOC_REPO".git";
fi
cd $DOC_REPO
git config core.sparseCheckout true
echo $dir > .git/info/sparse-checkout
pwd

git checkout main
git reset --hard origin/main
git rm -rf $dir/ && rm -rf $dir/
cp -R $GENERATED_DOC_DIR $dir
touch $dir/.nojekyll
git config --global user.email $EMAIL
git config --global user.name $USERNAME
git config --global push.default matching
git add -f $dir/
git commit -m "$MSG" $dir
git push origin main
git push

echo $MSG