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
93 changes: 93 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Release (TestPyPI + Docker Hub)

on:
release:
types: [created]

permissions:
contents: read

env:
PYTHON_VERSION: "3.12"
DOCKER_IMAGE: antsx/antspynet

jobs:

tests:
uses: ./.github/workflows/test.yml

build-sdist:
name: Build sdist
needs: [tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_VERSION }}"

- name: Build sdist
run: |
python -m pip install --upgrade pip build
python -m build --sdist --outdir dist

- name: Upload sdist artifact
uses: actions/upload-artifact@v4
with:
name: python-dist
path: dist/*

docker:
name: Build and push Docker image
needs: [tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Compute Docker tags from release
id: meta
run: |
# For a release-triggered workflow, GITHUB_REF_NAME is the tag name (e.g., v0.2.3)
echo "tag=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile
push: true
tags: |
${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.tag }}
${{ env.DOCKER_IMAGE }}:latest

publish-testpypi:
name: Publish sdist to PyPI
runs-on: ubuntu-latest
needs:
- build-sdist
- docker
steps:
- name: Download sdist artifact
uses: actions/download-artifact@v4
with:
name: python-dist
path: dist

- name: Publish to TestPyPI (API token)
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true
verify-metadata: true
13 changes: 2 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: ANTsPyNet Unit Tests

on:
push:
pull_request:

workflow_call:
workflow_dispatch:
env:
USE_SOURCE_BUILD: false # Set to 'false' to use PyPI version of ANTsPy

Expand Down Expand Up @@ -42,14 +41,6 @@ jobs:
pip install antspyx
fi

- name: Cache ANTsXNet model/data downloads
uses: actions/cache@v4
with:
path: ~/.keras/ANTsXNet
key: antsxnet-${{ runner.os }}-${{ hashFiles('**/download_all_data.py') }}
restore-keys: |
antsxnet-${{ runner.os }}-

- name: Install ANTsPyNet and dependencies
run: |
pip install -e .
Expand Down
74 changes: 37 additions & 37 deletions antspynet/utilities/get_antsxnet_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,19 @@ def switch_data(argument):
"biobank": "https://ndownloader.figshare.com/files/22429242",
"croppedMni152": "https://ndownloader.figshare.com/files/22933754",
"croppedMni152Priors": "https://ndownloader.figshare.com/files/27688437",
"deepFlashPriors": "https://figshare.com/ndownloader/files/31208272",
"deepFlashTemplateT1": "https://figshare.com/ndownloader/files/31207795",
"deepFlashTemplateT1SkullStripped": "https://figshare.com/ndownloader/files/31339867",
"deepFlashTemplateT2": "https://figshare.com/ndownloader/files/31207798",
"deepFlashTemplateT2SkullStripped": "https://figshare.com/ndownloader/files/31339870",
"deepFlashTemplate2T1SkullStripped": "https://figshare.com/ndownloader/files/46461451",
"deepFlashTemplate2Labels": "https://figshare.com/ndownloader/files/46461415",
"deepFlashPriors": "https://ndownloader.figshare.com/files/31208272",
"deepFlashTemplateT1": "https://ndownloader.figshare.com/files/31207795",
"deepFlashTemplateT1SkullStripped": "https://ndownloader.figshare.com/files/31339867",
"deepFlashTemplateT2": "https://ndownloader.figshare.com/files/31207798",
"deepFlashTemplateT2SkullStripped": "https://ndownloader.figshare.com/files/31339870",
"deepFlashTemplate2T1SkullStripped": "https://ndownloader.figshare.com/files/46461451",
"deepFlashTemplate2Labels": "https://ndownloader.figshare.com/files/46461415",
"mprage_hippmapp3r": "https://ndownloader.figshare.com/files/24984689",
"protonLobePriors": "https://figshare.com/ndownloader/files/30678452",
"protonLobePriors": "https://ndownloader.figshare.com/files/30678452",
"protonLungTemplate": "https://ndownloader.figshare.com/files/22707338",
"ctLungTemplate": "https://ndownloader.figshare.com/files/22707335",
"luna16LungPriors": "https://ndownloader.figshare.com/files/28253796",
"xrayLungPriors": "https://figshare.com/ndownloader/files/41965815",
"xrayLungPriors": "https://ndownloader.figshare.com/files/41965815",
"priorDktLabels": "https://ndownloader.figshare.com/files/24139802",
"S_template3": "https://ndownloader.figshare.com/files/22597175",
"priorDeepFlashLeftLabels": "https://ndownloader.figshare.com/files/25422098",
Expand All @@ -90,34 +90,34 @@ def switch_data(argument):
"nki": "https://ndownloader.figshare.com/files/25516355",
"nki10": "https://ndownloader.figshare.com/files/25516346",
"oasis": "https://ndownloader.figshare.com/files/25516352",
"magetTemplate": "https://figshare.com/ndownloader/files/41052572",
"magetTemplateBrainMask": "https://figshare.com/ndownloader/files/41052569",
"magetCerebellumTemplate": "https://figshare.com/ndownloader/files/41052581",
"magetCerebellumTemplatePriors": "https://figshare.com/ndownloader/files/41052578",
"magetCerebellumxTemplate0GenericAffine": "https://figshare.com/ndownloader/files/41052575",
"mraTemplate": "https://figshare.com/ndownloader/files/46406695",
"mraTemplateBrainMask": "https://figshare.com/ndownloader/files/46406698",
"mraTemplateVesselPrior": "https://figshare.com/ndownloader/files/46406713",
"hcpaT1Template": "https://figshare.com/ndownloader/files/54248318",
"hcpaT2Template": "https://figshare.com/ndownloader/files/54248324",
"hcpaFATemplate": "https://figshare.com/ndownloader/files/54248321",
"hcpyaT1Template": "https://figshare.com/ndownloader/files/46746142",
"hcpyaT2Template": "https://figshare.com/ndownloader/files/46746334",
"hcpyaFATemplate": "https://figshare.com/ndownloader/files/46746349",
"hcpyaTemplateBrainMask": "https://figshare.com/ndownloader/files/46746388",
"hcpyaTemplateBrainSegmentation": "https://figshare.com/ndownloader/files/46746367",
"hcpinterT1Template": "https://figshare.com/ndownloader/files/49372855",
"hcpinterT2Template": "https://figshare.com/ndownloader/files/49372849",
"hcpinterFATemplate": "https://figshare.com/ndownloader/files/49372858",
"hcpinterTemplateBrainMask": "https://figshare.com/ndownloader/files/49372861",
"hcpinterTemplateBrainSegmentation": "https://figshare.com/ndownloader/files/49372852",
"bsplineT2MouseTemplate": "https://figshare.com/ndownloader/files/44706247",
"bsplineT2MouseTemplateBrainMask": "https://figshare.com/ndownloader/files/44869285",
"DevCCF_P56_MRI-T2_50um": "https://figshare.com/ndownloader/files/44706244",
"DevCCF_P56_MRI-T2_50um_BrainParcellationNickMask": "https://figshare.com/ndownloader/files/44706238",
"DevCCF_P56_MRI-T2_50um_BrainParcellationTctMask": "https://figshare.com/ndownloader/files/47214532",
"DevCCF_P04_STPT_50um": "https://figshare.com/ndownloader/files/46711546",
"DevCCF_P04_STPT_50um_BrainParcellationJayMask": "https://figshare.com/ndownloader/files/46712656"
"magetTemplate": "https://ndownloader.figshare.com/files/41052572",
"magetTemplateBrainMask": "https://ndownloader.figshare.com/files/41052569",
"magetCerebellumTemplate": "https://ndownloader.figshare.com/files/41052581",
"magetCerebellumTemplatePriors": "https://ndownloader.figshare.com/files/41052578",
"magetCerebellumxTemplate0GenericAffine": "https://ndownloader.figshare.com/files/41052575",
"mraTemplate": "https://ndownloader.figshare.com/files/46406695",
"mraTemplateBrainMask": "https://ndownloader.figshare.com/files/46406698",
"mraTemplateVesselPrior": "https://ndownloader.figshare.com/files/46406713",
"hcpaT1Template": "https://ndownloader.figshare.com/files/54248318",
"hcpaT2Template": "https://ndownloader.figshare.com/files/54248324",
"hcpaFATemplate": "https://ndownloader.figshare.com/files/54248321",
"hcpyaT1Template": "https://ndownloader.figshare.com/files/46746142",
"hcpyaT2Template": "https://ndownloader.figshare.com/files/46746334",
"hcpyaFATemplate": "https://ndownloader.figshare.com/files/46746349",
"hcpyaTemplateBrainMask": "https://ndownloader.figshare.com/files/46746388",
"hcpyaTemplateBrainSegmentation": "https://ndownloader.figshare.com/files/46746367",
"hcpinterT1Template": "https://ndownloader.figshare.com/files/49372855",
"hcpinterT2Template": "https://ndownloader.figshare.com/files/49372849",
"hcpinterFATemplate": "https://ndownloader.figshare.com/files/49372858",
"hcpinterTemplateBrainMask": "https://ndownloader.figshare.com/files/49372861",
"hcpinterTemplateBrainSegmentation": "https://ndownloader.figshare.com/files/49372852",
"bsplineT2MouseTemplate": "https://ndownloader.figshare.com/files/44706247",
"bsplineT2MouseTemplateBrainMask": "https://ndownloader.figshare.com/files/44869285",
"DevCCF_P56_MRI-T2_50um": "https://ndownloader.figshare.com/files/44706244",
"DevCCF_P56_MRI-T2_50um_BrainParcellationNickMask": "https://ndownloader.figshare.com/files/44706238",
"DevCCF_P56_MRI-T2_50um_BrainParcellationTctMask": "https://ndownloader.figshare.com/files/47214532",
"DevCCF_P04_STPT_50um": "https://ndownloader.figshare.com/files/46711546",
"DevCCF_P04_STPT_50um_BrainParcellationJayMask": "https://ndownloader.figshare.com/files/46712656"
}
return(switcher.get(argument, "Invalid argument."))

Expand Down
Loading