Skip to content

Commit

Permalink
Merge branch 'marmunfold' of https://github.com/khanlab/hippunfold in…
Browse files Browse the repository at this point in the history
…to marmunfold
  • Loading branch information
Jordan DeKraker - B. Bernhardt Lab committed Feb 14, 2024
2 parents 2f575dd + 8226a2c commit a637da9
Show file tree
Hide file tree
Showing 11 changed files with 178 additions and 272 deletions.
28 changes: 15 additions & 13 deletions .github/workflows/bump_version.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
---
name: Bump version
on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Checkout main branch
uses: actions/checkout@v4

- name: Update changelog
uses: release-drafter/release-drafter@v5
id: release-drafter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Can replace the below with (until pipeline description) with
# khanlab/actions/.github/workflows/workflow-version_task-semverGithub.yml
# after adding PAT token
- name: Get previous release version
run: |
echo "PREV_VER=$(cat pyproject.toml | grep -o -E '(version\s=\s)([[:punct:]])([0-9]+\.[0-9]+\.[0-9]+.+)([[:punct:]])' | cut -d ' ' -f 3 | tr -d '"')" >> $GITHUB_ENV
Expand All @@ -35,28 +41,27 @@ jobs:
run: |
echo "NEW_BUMP=$(($BUMP_VER + 1))" >> $GITHUB_ENV
- name: Update version in pyproject
uses: jacobtomlinson/gha-find-replace@master
- name: Update version in pyproject.toml
uses: jacobtomlinson/gha-find-replace@v3
with:
include: 'pyproject.toml'
include: "pyproject.toml"
find: 'version = "(?:([0-9]+\.[0-9]+\.[0-9]+.+)|([0-9]+\.[0-9]+\.[0-9]+))"'
replace: 'version = "${{ steps.release-drafter.outputs.name }}-pre.${{ env.NEW_BUMP }}"'

- name: Update version in pipeline_description (not actually used)
uses: jacobtomlinson/gha-find-replace@master
uses: jacobtomlinson/gha-find-replace@v3
with:
include: 'hippunfold/pipeline_description.json'
include: "hippunfold/pipeline_description.json"
find: '"Version": "(?:([0-9]+\.[0-9]+\.[0-9]+.+)|([0-9]+\.[0-9]+\.[0-9]+))"'
replace: '"Version": "${{ steps.release-drafter.outputs.name }}-pre.${{ env.NEW_BUMP }}"'

- name: Update version in config/snakebids.yml
uses: jacobtomlinson/gha-find-replace@master
uses: jacobtomlinson/gha-find-replace@v3
with:
include: 'hippunfold/config/snakebids.yml'
include: "hippunfold/config/snakebids.yml"
find: 'version: "(?:([0-9]+\.[0-9]+\.[0-9]+.+)|([0-9]+\.[0-9]+\.[0-9]+))"'
replace: 'version: "${{ steps.release-drafter.outputs.name }}-pre.${{ env.NEW_BUMP }}"'


- name: Commit updates
env:
SNAKEBIDS_VERSION: ${{ steps.release-drafter.outputs.name }}-pre.${{ env.NEW_BUMP }}
Expand All @@ -66,10 +71,7 @@ jobs:
git diff-index --quiet HEAD || git commit -m "Bump version to $SNAKEBIDS_VERSION" -a
- name: Push changes
uses: ad-m/github-push-action@master
uses: ad-m/github-push-action@v0.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tags: false



33 changes: 13 additions & 20 deletions .github/workflows/dags.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,59 @@
---
name: Generate DAG visualizations

on:
workflow_dispatch:
inputs:
author:
description: "Author"
required: true
default: "github-actions[bot] (user publishing release)"
date:
description: "Date"
required: true
default: "YYYY-MM-DD"
comments:
description: "Comments"

jobs:
generate_dag:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9"]

steps:
- name: Print author
run: |
echo "Author: ${{ github.event.inputs.author }}"
echo "Date: ${{ github.event.inputs.date }}"
echo "Author: ${{ github.triggering_actor }}"
echo "Comments: ${{ github.event.inputs.comments }}"
- uses: actions/checkout@master
- name: Checkout main branch
uses: actions/checkout@v3
with:
ref: refs/heads/master

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

- name: Install non-python dependencies
run: |
sudo apt-get install -y graphviz-dev graphviz
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install snakebids
- name: Set-up env for hippunfold
- name: Set-up env for hippunfold
run: |
echo "HIPPUNFOLD_CACHE_DIR=`pwd`/test_data/fake_models" >> $GITHUB_ENV
echo "HIPPUNFOLD=./hippunfold/run.py" >> $GITHUB_ENV
- name: Generate rulegraph single T2w bids
run: |
$HIPPUNFOLD test_data/bids_singleT2w test_out participant -np --modality T2w --rulegraph | dot -Tsvg > docs/images/rulegraph_T2w.svg
- name: Commit updates
env:
LATEST_VERSION: ${{ steps.release-drafter.outputs.name }}
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git diff-index --quiet HEAD || git add docs/images || commit -m "Add updated dags [skip ci]"
git diff-index --quiet HEAD || git add docs/images || commit -m "Add updated dags [skip ci]"
- name: Push changes
uses: ad-m/github-push-action@master
uses: ad-m/github-push-action@v0.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}



37 changes: 14 additions & 23 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
---
name: Deploy workflow

on:
workflow_dispatch:
inputs:
author:
description: "Author"
required: true
default: "github-actions[bot] (user publishing release)"
date:
description: "Date"
required: true
default: "YYYY-MM-DD"
comments:
description: "Comments"
branch:
Expand All @@ -25,22 +17,24 @@ jobs:
steps:
- name: Print author
run: |
echo "Author: ${{ github.event.inputs.author }}"
echo "Date: ${{ github.event.inputs.date }}"
echo "Author: ${{ github.triggering_actor }}"
echo "Comments: ${{ github.event.inputs.comments }}"
- uses: actions/checkout@master
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}

- name: Draft change log
uses: release-drafter/release-drafter@v5
id: release-drafter
with:
commitish: ${{ github.event.inputs.branch }}
commitish: ${{ github.event.inputs.branch }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Can replace the below with (until pipeline description) with
# khanlab/actions/.github/workflows/workflow-version_task-publishGithub.yml
# after adding PAT token
- name: Set new release version
env:
RD_RELEASE: ${{ steps.release-drafter.outputs.name }}
Expand All @@ -52,27 +46,26 @@ jobs:
fi
- name: Update version in pyproject.toml
uses: jacobtomlinson/gha-find-replace@master
uses: jacobtomlinson/gha-find-replace@v3
with:
include: 'pyproject.toml'
include: "pyproject.toml"
find: 'version = "(?:([0-9]+\.[0-9]+\.[0-9]+.+)|([0-9]+\.[0-9]+\.[0-9]+))"'
replace: 'version = "${{ env.NEW_RELEASE }}"'

- name: Update version in pipeline_description (not actually used)
uses: jacobtomlinson/gha-find-replace@master
uses: jacobtomlinson/gha-find-replace@v3
with:
include: 'hippunfold/pipeline_description.json'
include: "hippunfold/pipeline_description.json"
find: '"Version": "(?:([0-9]+\.[0-9]+\.[0-9]+.+)|([0-9]+\.[0-9]+\.[0-9]+))"'
replace: '"Version": "${{ env.NEW_RELEASE }}"'

- name: Update version in config/snakebids.yml
uses: jacobtomlinson/gha-find-replace@master
uses: jacobtomlinson/gha-find-replace@v3
with:
include: 'hippunfold/config/snakebids.yml'
include: "hippunfold/config/snakebids.yml"
find: 'version: "(?:([0-9]+\.[0-9]+\.[0-9]+.+)|([0-9]+\.[0-9]+\.[0-9]+))"'
replace: 'version: "${{ env.NEW_RELEASE }}"'


- name: Commit updates
env:
LATEST_VERSION: ${{ env.NEW_RELEASE }}
Expand All @@ -82,7 +75,7 @@ jobs:
git diff-index --quiet HEAD || git commit -m "Bump version to $LATEST_VERSION" -a
- name: Push changes
uses: ad-m/github-push-action@master
uses: ad-m/github-push-action@v0.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -92,5 +85,3 @@ jobs:
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


12 changes: 4 additions & 8 deletions .github/workflows/manual_release_drafter.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
---
name: Manual release-drafter update

on:
workflow_dispatch:
inputs:
author:
description: "Author"
required: true
default: "github-actions[bot] (user publishing release)"
comments:
description: "Update release drafter notes"

Expand All @@ -16,11 +12,11 @@ jobs:
steps:
- name: Print workflow information
run: |
echo "Author: ${{ github.event.inputs.author }}"
echo "Date: ${{ github.event.inputs.date }}"
echo "Author: ${{ github.triggering_actor }}"
echo "Comments: ${{ github.event.inputs.comments }}"
- uses: actions/checkout@master
- name: Checkout main branch
uses: actions/checkout@v4

- name: Update changelog
uses: release-drafter/release-drafter@v5
Expand Down
47 changes: 6 additions & 41 deletions .github/workflows/push_container.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,18 @@
---
# 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: Publish Docker image

on:
on:
workflow_dispatch:
release:
types: [published]

jobs:
push_to_registries:
name: Push Docker image to multiple registries
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@master

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

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ github.repository }}
ghcr.io/${{ github.repository }}
flavor: |
latest=auto
- name: Build and push Docker images
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
uses: khanlab/actions/.github/workflows/[email protected]
secrets:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
Loading

0 comments on commit a637da9

Please sign in to comment.