Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions .github/actions/build-docker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# selected branch and crates a docker image in an artifact (fastsurfer-<github-sha>-docker)
# The build artifact includes the image in docker-image.tar and the name of the image in image_name.env

# This action requires an existing uv installation!

name: 'Build a FastSurfer docker image'
author: 'David Kuegler'
description: 'Build a FastSurfer image'
Expand Down Expand Up @@ -53,8 +55,8 @@ runs:
v="$(bash $bashopts "$FASTSURFER_HOME/run_fastsurfer.sh" --version --py python)"
image_name="fastsurfer:cpu-${v/+/_}"
fi
if [[ -z "$(which python)" ]] ; then echo "ERROR: Cannot find python!" ; fi
cmd=(python "$FASTSURFER_HOME/tools/Docker/build.py" --device cpu --tag "$image_name" --target "${{ inputs.target }}")
if [[ -z "$(uv run python -c 'import sys; print(sys.executable)' 2>/dev/null)" ]] ; then echo "ERROR: Cannot find python!" ; fi
cmd=(uv run python "$FASTSURFER_HOME/tools/Docker/build.py" --device cpu --tag "$image_name" --target "${{ inputs.target }}")
if [[ "${{ inputs.freesurfer-build-image }}" != "rebuild" ]] ; then
cmd+=(--freesurfer_build_image "${{ inputs.freesurfer-build-image }}")
fi
Expand Down
15 changes: 3 additions & 12 deletions .github/actions/run-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,10 @@ runs:
using: "composite"
steps:
- uses: actions/checkout@v4
- name: Setup Python 3.10
uses: actions/setup-python@v5
- name: Setup uv and Python 3.10
uses: astral-sh/setup-uv@v5
with:
python-version: '3.10'
architecture: 'x64'
cache: 'pip' # caching pip dependencies
- name: Install dependencies
shell: bash
run: |
echo "::group::Create python environment"
python -m pip install --progress-bar off --upgrade pip setuptools wheel
python -m pip install --progress-bar off .[quicktest]
echo "::endgroup::"
- name: Download and unpack reference data
shell: bash
env:
Expand Down Expand Up @@ -78,7 +69,7 @@ runs:
then
flags+=(-vv --log_cli_level=DEBUG)
fi
python -m pytest "${flags[@]}" test/quicktest
uv run --extra quicktest python -m pytest "${flags[@]}" test/quicktest
echo "::endgroup::"
- name: Upload the the JUnit XML file as an artifact
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/QUICKTEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This job checks out the repository using the `actions/checkout@v2` action.
### Prepare Job
This job sets up the necessary environments for the workflow. It depends on the successful completion of the `checkout` job. The environments set up in this job include:

- Python 3.10, using the `actions/setup-python@v3` action.
- Python 3.10, using the `astral-sh/setup-uv@v5` action.
- Go, using the `actions/setup-go@v5` action with version `1.13.1`.
- Singularity, using the `eWaterCycle/setup-singularity@v7` action with version `3.8.3`.

Expand Down
19 changes: 8 additions & 11 deletions .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,22 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python 3.10
uses: actions/setup-python@v5
with:
path: 'src'
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: '3.10'
architecture: 'x64'
cache: 'pip' # caching pip dependencies
- name: Install dependencies
run: |
python -m pip install --progress-bar off --upgrade pip setuptools wheel
python -m pip install --progress-bar off .[style]
- name: Run Ruff
run: ruff check .
run: uv run --project src --extra style ruff check src
- name: Run codespell
uses: codespell-project/actions-codespell@master
with:
check_filenames: true
check_hidden: true
skip: './build,./doc/images,./Tutorial,./.git,./.mypy_cache,./.pytest_cache'
ignore_words_file: ./.codespellignore
skip: 'src/build,src/doc/images,src/Tutorial,src/.git,src/.mypy_cache,src/.pytest_cache,src/.venv'
ignore_words_file: src/.codespellignore
path: 'src'
# - name: Run pydocstyle
# run: pydocstyle .
# - name: Run bibclean
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ jobs:
with:
fetch-depth: 0
- name: Set up python environment
uses: actions/setup-python@v6
id: setup-uv
uses: astral-sh/setup-uv@v5
with:
python-version: '3.10'
- name: install dependencies
run: |
python -m pip install py2app tomli
uv venv .venv
uv pip install py2app tomli

# update system to the newest version, not pin pointing package version on purpose
brew update
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,16 @@ jobs:
uses: actions/checkout@v4
with:
path: src
- name: Setup Python 3.12
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: '3.12'
architecture: 'x64'
cache: 'pip' # caching pip dependencies
- name: Install package
run: |
python -m pip install --progress-bar off --upgrade pip setuptools wheel
python -m pip install --progress-bar off src/.[doc]
- name: Build doc
env:
PYTHONPATH: ${{ env.PYTHONPATH != '' && format( '{1}:src', env.PYTHONPATH ) || 'src' }}
TZ: UTC
run: |
sphinx-build -WT --keep-going -j auto src/doc doc-build
uv run --project src --extra doc sphinx-build -WT --keep-going -j auto src/doc doc-build
- name: Upload documentation
uses: actions/upload-artifact@v4
with:
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/quicktest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,11 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ steps.parse.outputs.DOCKER_IMAGE }}
- name: Setup Python 3.11
uses: actions/setup-python@v5
- name: Setup uv and Python 3.11
uses: astral-sh/setup-uv@v5
with:
python-version: '3.11'
# python 3.11 is needed to read pyproject.toml (tomllib)
architecture: 'x64'
# no cache is needed, no installations and no cache is faster
# cache: 'pip' # caching pip dependencies
- name: Get the FreeSurfer version
# we want to build the docker image, get what we want to do for freesurfer (read fslink from install_pruned.sh,
if: steps.parse.outputs.CONTINUE == 'true' && (steps.parse.outputs.DOCKER_IMAGE == 'build-cached' || startsWith(steps.parse.outputs.DOCKER_IMAGE, 'pr/'))
Expand All @@ -155,7 +152,7 @@ jobs:
run: |
# get the FreeSurfer version from pyproject.toml
{
fs_version="$(python ./tools/read_toml.py --file ./pyproject.toml --key tool.freesurfer.version)"
fs_version="$(uv run python ./tools/read_toml.py --file ./pyproject.toml --key tool.freesurfer.version)"
fs_version_short="${fs_version//\./}"
echo "FS_VERSION=$fs_version"
echo "FS_VERSION_SHORT=$fs_version_short"
Expand Down
8 changes: 8 additions & 0 deletions tools/git-hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ else
uv run --extra style codespell --check-filenames --check-hidden --context 3 \
--skip "$skip_files" --ignore-words ./.codespellignore

# if this is a valid git repository and the doc/api/generated or doc-build folder exists, clean them before sphinx-doc
if [[ -d ".git" ]] && [[ -n "$(which git)" ]] && git --git-dir=.git branch --show-current 2>/dev/null >/dev/null \
&& { [[ -d "doc/api/generated" ]] || [[ -d "doc-build" ]]; }
then
echo "INFO: pre-commit hook: cleaning doc/api/generated and doc-build folder"
if [[ -d "doc/api/generated" ]] ; then rm -rf doc/api/generated/* ; fi
if [[ -d "doc-build" ]] ; then rm -rf doc/api/generated/* doc-build/* ; fi
fi
echo "INFO: pre-commit hook: Build sphinx-doc"
uv run --extra doc sphinx-build -j auto -WT --keep-going doc ./doc-build
fi
Expand Down