Skip to content

Commit

Permalink
Merge branch 'main' into 201-bugfix-remove-references-to-sites-where-…
Browse files Browse the repository at this point in the history
…data-originated-from
  • Loading branch information
tomaroberts committed Jul 17, 2023
2 parents 992574c + 8eeca28 commit 820ffbe
Show file tree
Hide file tree
Showing 226 changed files with 6,697 additions and 8,009 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
interval: "monthly"
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ jobs:
uses: actions/checkout@v2

- name: Log in to Docker Hub
uses: docker/login-action@42d299face0c5c43a0487c477f595ac9cf22f1a7
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@e5622373a38e60fb6d795a4421e56882f2d7a681
uses: docker/metadata-action@507c2f2dc502c992ad446e3d7a5dfbe311567a96
with:
images: gsttmriphysics/hazen

- name: Build and push Docker image
uses: docker/build-push-action@a66e35b9cbcf4ad0ea91ffcaf7bbad63ad9e0229
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
push: true
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
114 changes: 114 additions & 0 deletions .github/workflows/test_cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Runs on pull request or release - checks CLI tools are working without raising exception


name: CLI tests

on:
pull_request:
release:

jobs:
test_cli:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.9', '3.10' ]
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install hazen
run: |
pip install .
- name: test snr
if: always() # will always run regardless of whether previous step fails - useful to ensure all CLI functions tested
run: |
hazen snr tests/data/snr/Siemens --report
hazen snr tests/data/snr/Siemens --measured_slice_width 5.0012 --report
- name: test_acr_snr
if: always() # will always run regardless of whether previous step fails - useful to ensure all CLI functions tested
run: |
hazen acr_snr tests/data/acr/Siemens --report
hazen acr_snr tests/data/acr/Siemens --subtract tests/data/acr/Siemens2 --report
- name: test acr_uniformity
if: always() # will always run regardless of whether previous step fails - useful to ensure all CLI functions tested
run: |
hazen acr_uniformity tests/data/acr/Siemens --report
- name: test acr_ghosting
if: always() # will always run regardless of whether previous step fails - useful to ensure all CLI functions tested
run: |
hazen acr_ghosting tests/data/acr/Siemens --report
- name: test acr_slice_position
if: always() # will always run regardless of whether previous step fails - useful to ensure all CLI functions tested
run: |
hazen acr_slice_position tests/data/acr/Siemens --report
- name: test acr_slice_thickness
if: always() # will always run regardless of whether previous step fails - useful to ensure all CLI functions tested
run: |
hazen acr_slice_thickness tests/data/acr/Siemens --report
- name: test acr_geometric_accuracy
if: always() # will always run regardless of whether previous step fails - useful to ensure all CLI functions tested
run: |
hazen acr_geometric_accuracy tests/data/acr/Siemens --report
- name: test acr_spatial_resolution
if: always() # will always run regardless of whether previous step fails - useful to ensure all CLI functions tested
run: |
hazen acr_spatial_resolution tests/data/acr/SiemensMTF --report
- name: test slice_position
if: always() # will always run regardless of whether previous step fails - useful to ensure all CLI functions tested
run: |
hazen slice_position tests/data/slicepos/SLICEPOSITION --report
- name: test slice_width
if: always() # will always run regardless of whether previous step fails - useful to ensure all CLI functions tested
run: |
hazen slice_width tests/data/slicewidth/512_matrix --report
hazen slice_width tests/data/slicewidth/SLICEWIDTH --report
- name: test spatial_resolution
if: always() # will always run regardless of whether previous step fails - useful to ensure all CLI functions tested
run: |
hazen spatial_resolution tests/data/resolution/RESOLUTION/ --report
- name: test uniformity
if: always() # will always run regardless of whether previous step fails - useful to ensure all CLI functions tested
run: |
hazen uniformity tests/data/uniformity --report
- name: test ghosting
if: always() # will always run regardless of whether previous step fails - useful to ensure all CLI functions tested
run: |
hazen ghosting tests/data/ghosting/GHOSTING --report
hazen ghosting tests/data/ghosting/PE_COL_PHANTOM_BOTTOM_RIGHT --report
- name: test snr_map
if: always() # will always run regardless of whether previous step fails - useful to ensure all CLI functions tested
run: |
hazen snr_map tests/data/snr/Siemens --report
- name: test relaxometry
if: always() # will always run regardless of whether previous step fails - useful to ensure all CLI functions tested
run: |
hazen relaxometry tests/data/relaxometry/T1/site1_20200218/plate5 --calc_t1 --plate_number=5 --report
64 changes: 2 additions & 62 deletions .github/workflows/tests_development.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,12 @@ jobs:
defaults:
run:
shell: bash -l {0}
# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
ports:
- 5432:5432
env:
POSTGRES_DB: hazen_test
POSTGRES_USER: test_user
POSTGRES_PASSWORD: test_user_password
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -76,45 +58,3 @@ jobs:
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml

- name: Update the coverage Badge
if: github.event.pull_request.base.ref == 'main' # if pull request is merging into main
uses: schneegans/[email protected]
with:
auth: ${{ secrets.PYTEST_COVERAGE_COMMENT }}
gistID: ba102d5f3e592fcd50451c2eff8a803d
filename: hazen_pytest-coverage-comment.json
label: Test coverage
message: ${{ steps.coverageComment.outputs.coverage }}
color: ${{ steps.coverageComment.outputs.color }}
namedLogo: python

test_cli:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.9', '3.10' ]
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install hazen
run: |
python setup.py install
- name: test snr
if: always() # will always run regardless of whether previous step fails - useful to ensure all CLI functions tested
run: |
hazen snr tests/data/snr/Siemens --report
65 changes: 17 additions & 48 deletions .github/workflows/tests_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,12 @@ jobs:
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.9', '3.10' ]
# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
ports:
- 5432:5432
env:
POSTGRES_DB: hazen_test
POSTGRES_USER: test_user
POSTGRES_PASSWORD: test_user_password
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -56,32 +37,20 @@ jobs:
set -Eeuxo pipefail
pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=hazenlib tests/ | tee pytest-coverage.txt ; echo $?
test_cli:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
python-version: [ '3.9', '3.10' ]
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install hazen
run: |
python setup.py install
- name: Pytest coverage comment
id: coverageComment
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./pytest-coverage.txt
junitxml-path: ./pytest.xml

- name: test snr
if: always() # will always run regardless of whether previous step fails - useful to ensure all CLI functions tested
run: |
hazen snr tests/data/snr/Siemens --report
- name: Update the coverage Badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.PYTEST_COVERAGE_COMMENT }}
gistID: ba102d5f3e592fcd50451c2eff8a803d
filename: hazen_pytest-coverage-comment.json
label: Test coverage
message: ${{ steps.coverageComment.outputs.coverage }}
color: ${{ steps.coverageComment.outputs.color }}
namedLogo: python
Loading

0 comments on commit 820ffbe

Please sign in to comment.