Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

Commit

Permalink
meantime update (#56)
Browse files Browse the repository at this point in the history
* move CI docs CircleCI > GHA
* add makefile
* update docs conf
* fix pillow ver
* CI: triggers & skip drafts
* CI: drop appveyor
  • Loading branch information
Borda authored May 25, 2021
1 parent 80eea24 commit 79a2cc2
Show file tree
Hide file tree
Showing 17 changed files with 164 additions and 207 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci_experiment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ on: # Trigger the workflow on push or pull request, but only for the master bra
branches: [master]
pull_request:
branches: [master]
types: [opened, reopened, ready_for_review, synchronize]

jobs:
pytest:

bash-expt:
if: github.event.pull_request.draft == false
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -34,7 +36,7 @@ jobs:
- name: Set py2.7 dependencies
if: matrix.python-version == 2.7
run: |
cp -r requirements-py27.txt requirements.txt
cp -r require-py27.txt requirements.txt
# Note: This uses an internal pip API and may not always work
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/ci_pkg-install.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
name: Install package

# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
on:
# Trigger the workflow on push or pull request,
# but only for the master branch
- push
- pull_request
on: # Trigger the workflow on push or pull request, but only for the master branch
push:
branches: [master]
pull_request: {}

jobs:
pkg-check:
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/ci_testing.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: CI testing

# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
on: # Trigger the workflow on push or pull request, but only for the master branch
- push
- pull_request
on: # Trigger the workflow on push or pull request, but only for the master branch
push:
branches: [master]
pull_request: {}

jobs:
pytest:
Expand Down Expand Up @@ -38,7 +39,7 @@ jobs:
- name: Set py2.7 dependencies
if: matrix.python-version == 2.7
run: |
cp -r requirements-py27.txt requirements.txt
cp -r require-py27.txt requirements.txt
# required for matplotlib @py2
pip install -U backports.functools_lru_cache
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/docker-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ on: # Trigger the workflow on push or pull request, but only for the master bra
branches: [master]
pull_request:
branches: [master]
types: [opened, reopened, ready_for_review, synchronize]

jobs:

build-push:
if: github.event.pull_request.draft == false
runs-on: ubuntu-20.04
strategy:
matrix:
Expand Down
83 changes: 83 additions & 0 deletions .github/workflows/docs-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: "Docs check"
# https://github.com/marketplace/actions/sphinx-build

on:
- pull_request

jobs:

test-docs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v2
with:
python-version: 3.7

# Note: This uses an internal pip API and may not always work
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y cmake pandoc
pip --version
pip install -r requirements.txt
pip install -r docs/requirements.txt
pip list
shell: bash

- name: Test Documentation
run: |
# First run the same pipeline as Read-The-Docs
cd docs
make doctest
make-docs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- uses: actions/setup-python@v2
with:
python-version: 3.7

# Note: This uses an internal pip API and may not always work
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake pandoc latexmk
sudo apt-get install -y texlive-latex-extra dvipng texlive-pictures
pip --version
pip install -r requirements.txt
pip install -r docs/requirements.txt
pip list
shell: bash

- name: Make Documentation
run: |
cd docs
make clean
make html --debug --jobs 2 SPHINXOPTS="-W"
make latexpdf
- name: Upload built docs
uses: actions/upload-artifact@v2
with:
name: docs-results-${{ runner.os }}-${{ matrix.python-version }}
path: docs/build/html/
if: success()
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ recursive-exclude __pycache__ *.pyc *.pyo *.orig

# Include the README
include *.md
exclude Makefile

# Include the license file
include LICENSE
Expand Down
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.PHONY: test clean docs

clean:
# clean all temp runs
rm -rf .pytest_cache
rm -rf ./docs/build
rm -rf ./docs/source/*.md
rm -rf ./docs/source/api
rm -rf ./docs/source/notebooks

test: clean
pip install --quiet -r requirements.txt
pip install --quiet -r tests/requirements.txt

# run tests with coverage
python -m coverage run --source birl -m pytest birl tests -v
python -m coverage report

docs: clean
pip install --quiet -r docs/requirements.txt
python -m sphinx -b html -W --keep-going docs/source docs/build
71 changes: 0 additions & 71 deletions appveyor.yml

This file was deleted.

6 changes: 3 additions & 3 deletions bm_experiments/bm_DROP.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ def _prepare_img_registration(self, item):

t_start = time.time()
for path_img, col in [(path_im_ref, self.COL_IMAGE_REF), (path_im_move, self.COL_IMAGE_MOVE)]:
item[col + self.COL_IMAGE_EXT_TEMP] = \
convert_image_to_mhd(path_img, path_out_dir=path_reg_dir, overwrite=False,
to_gray=True, scaling=item.get('scaling', 1.))
item[col + self.COL_IMAGE_EXT_TEMP] = convert_image_to_mhd(
path_img, path_out_dir=path_reg_dir, overwrite=False, to_gray=True, scaling=item.get('scaling', 1.)
)
item[self.COL_TIME_CONVERT] = time.time() - t_start
return item

Expand Down
20 changes: 11 additions & 9 deletions bm_experiments/bm_RVSS.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,20 @@ class BmRVSS(ImRegBenchmark):
DIR_OUTPUTS = 'output'
# PATH_SCRIPT_HIST_MATCH_IJM = os.path.join(PATH_IJ_SCRIPTS, 'histogram-matching-for-macro.bsh')
#: command for executing the image registration
COMMAND_REGISTRATION = \
'%(exec_Fiji)s --headless %(path_bsh)s' \
' %(dir_input)s/ %(dir_output)s/ %(dir_output)s/' \
COMMAND_REGISTRATION = (
'%(exec_Fiji)s --headless %(path_bsh)s'
' %(dir_input)s/ %(dir_output)s/ %(dir_output)s/'
' %(ref_name)s %(params)s'
)
#: command for executing the warping image and landmarks
COMMAND_WARP_LANDMARKS = \
'%(exec_Fiji)s --headless %(path_bsh)s' \
' %(source)s %(target)s' \
' %(output)s/' + BmUnwarpJ.NAME_LANDMARKS + \
' %(output)s/' + BmUnwarpJ.NAME_LANDMARKS_WARPED + \
' %(transf)s' \
COMMAND_WARP_LANDMARKS = (
'%(exec_Fiji)s --headless %(path_bsh)s'
' %(source)s %(target)s'
' %(output)s/' + BmUnwarpJ.NAME_LANDMARKS + ' '
' %(output)s/' + BmUnwarpJ.NAME_LANDMARKS_WARPED + ' '
' %(transf)s'
' %(warp)s'
)
#: required parameters in the configuration file for RVSS
REQUIRED_PARAMS_RVSS = ('shrinkingConstraint', 'featuresModelIndex', 'registrationModelIndex')
#: default RVSS parameters
Expand Down
22 changes: 11 additions & 11 deletions bm_experiments/bm_bUnwarpJ.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,12 @@ class BmUnwarpJ(ImRegBenchmark):
# PATH_SCRIPT_HIST_MATCH_IJM = os.path.join(PATH_IJ_SCRIPTS,
# 'histogram-matching-for-macro.bsh')
#: command for executing the image registration
COMMAND_REGISTRATION = \
'%(exec_Fiji)s --headless %(path_bsh)s' \
' %(source)s %(target)s %(params)s' \
' %(output)s/transform-direct.txt' \
COMMAND_REGISTRATION = (
'%(exec_Fiji)s --headless %(path_bsh)s'
' %(source)s %(target)s %(params)s'
' %(output)s/transform-direct.txt'
' %(output)s/transform-inverse.txt'
)
#: internal name of converted landmarks for tranf. script
NAME_LANDMARKS = 'source_landmarks.pts'
#: name of warped moving landmarks by tranf. script
Expand All @@ -114,14 +115,13 @@ class BmUnwarpJ(ImRegBenchmark):
#: resulting direct transformation
NAME_TRANSF_DIRECT = 'transform-direct.txt'
#: command for executing the warping image and landmarks
COMMAND_WARP_LANDMARKS = \
'%(exec_Fiji)s --headless %(path_bsh)s' \
' %(source)s %(target)s' \
' %(output)s/' + NAME_LANDMARKS + \
' %(output)s/' + NAME_LANDMARKS_WARPED + \
' %(transf-inv)s' \
' %(transf-dir)s' \
COMMAND_WARP_LANDMARKS = (
'%(exec_Fiji)s --headless %(path_bsh)s'
' %(source)s %(target)s'
' %(output)s/' + NAME_LANDMARKS + ' %(output)s/' + NAME_LANDMARKS_WARPED + ' %(transf-inv)s'
' %(transf-dir)s'
' %(warp)s'
)
#: required parameters in the configuration file for bUnwarpJ
REQUIRED_PARAMS_BUNWARPJ = (
'mode', 'subsampleFactor', 'minScale', 'maxScale', 'divWeight', 'curlWeight', 'landmarkWeight', 'imageWeight',
Expand Down
Loading

0 comments on commit 79a2cc2

Please sign in to comment.