Skip to content

use static image for qsmxt #97

use static image for qsmxt

use static image for qsmxt #97

# This workflows executes new or modified example notebooks.
name: test_changed_notebooks
defaults:
run:
shell: bash # To override PowerShell on Windows
on:
# Trigger the workflow on push or PR to any branch
push:
paths:
- '**/*.ipynb'
pull_request:
paths:
- '**/*.ipynb'
# don't trigger for draft PRs
types: [ opened, synchronize, reopened, ready_for_review ]
# Trigger the workflow on manual dispatch
workflow_dispatch:
jobs:
select-runner:
runs-on: ubuntu-22.04
outputs:
runner: ${{ steps.select_runner.outputs.runner }}
steps:
- uses: actions/checkout@v3
- name: Select runner
id: select_runner
run: |
if [ "${{ github.repository }}" = "NeuroDesk/example-notebooks" ]; then
echo "runner=cirun-oracle--${{ github.run_id }}" >> $GITHUB_OUTPUT
else
echo "runner=ubuntu-22.04" >> $GITHUB_OUTPUT
fi
test-notebooks:
needs: select-runner
runs-on: ${{ needs.select-runner.outputs.runner }}
strategy:
fail-fast: false
matrix:
notebooks: ["functional_imaging/fmriprep_example.ipynb", "functional_imaging/nipype_fsl_all_levels_flanker.ipynb", "structural_imaging/freesurfer_example.ipynb", "structural_imaging/qsmxt_example.ipynb", "structural_imaging/nipype_module_example.ipynb", "structural_imaging/sct_toolbox_example.ipynb"]
steps:
- uses: actions/checkout@v3
- name: Test singularity and cvmfs before pushing to neurocommand
run:
/bin/bash .github/workflows/setup_cvmfs.sh
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install jupyter-book ghp-import graphviz ipyniivue
- name: Run ${{ matrix.notebooks }}
shell: bash
working-directory: ./books
run: |
echo ${{ github.workspace }}
echo $GITHUB_WORKSPACE
export PATH=$HOME/.local/bin:$PATH
echo "PATH=$PATH"
export LD_PRELOAD=
echo "LD_PRELOAD=$LD_PRELOAD"
export APPTAINER_BINDPATH=${{ github.workspace }},/cvmfs
echo "APPTAINER_BINDPATH=$APPTAINER_BINDPATH"
export LMOD_CMD=/usr/share/lmod/lmod/libexec/lmod
export MPLCONFIGDIR=${{ github.workspace }}/matplotlib-mpldir
export MODULEPATH=$(find /cvmfs/neurodesk.ardc.edu.au/neurodesk-modules/ -maxdepth 1 -mindepth 1 -type d -exec realpath {} \; | tr '\n' ':')
echo "MODULEPATH=$MODULEPATH"
sed -i 's/timeout:.*/timeout: 200/' _config.yml
echo "NOTEBOOK=$(basename -s .ipynb ${{ matrix.notebooks }})" >> $GITHUB_ENV
echo "DIRNAME=$(dirname ${{ matrix.notebooks }})" >> $GITHUB_ENV
jb build ${{ matrix.notebooks }}
- name: Restructure
shell: bash
run: |
tree ./books/_build/**/**/html
mkdir -p ./books/_build/**/**/html/$DIRNAME
cp -R ./books/_build/**/**/html/_static ./books/_build/**/**/html/$DIRNAME
if [ -d ./books/_build/**/**/html/_images ]; then
cp -R ./books/_build/**/**/html/_images ./books/_build/**/**/html/$DIRNAME
fi
cp ./books/_build/**/**/html/$NOTEBOOK.html ./books/_build/**/**/html/$DIRNAME
- name: Push to GitHub Pages
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./books/_build/**/**/html
keep_files: true
cname: www.neurodesk.org
build-structure:
needs: [ select-runner, test-notebooks ]
runs-on: ${{ needs.select-runner.outputs.runner }}
steps:
- uses: actions/checkout@v3
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install jupyter-book ghp-import graphviz ipyniivue
- name: Run all
shell: bash
working-directory: ./books
run: |
export PATH=$HOME/.local/bin:$PATH
sed -i 's/execute_notebooks: .*/execute_notebooks: off/' _config.yml
sed -i 's/allow_errors: .*/allow_errors: false/' _config.yml
sed -i 's/stderr_output: .*/stderr_output: remove/' _config.yml
sed -i 's/timeout:.*/timeout: 1/' _config.yml
sed -i 's/nb_execution_show_tb:.*/nb_execution_show_tb: False/' _config.yml
cat _config.yml
jb build .
- name: Push to GitHub Pages
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./books/_build/html
keep_files: true
cname: www.neurodesk.org