From a92a8fb5a99643c8b1b1850a71087f68a3da901b Mon Sep 17 00:00:00 2001 From: Jason Kai Date: Thu, 16 Nov 2023 09:04:08 -0500 Subject: [PATCH] Add spacing between steps in actions --- .github/workflows/bump_version.yml | 10 +- .github/workflows/dags.yml | 9 +- .github/workflows/python-testing.yml | 242 +++++++++++++++------------ 3 files changed, 138 insertions(+), 123 deletions(-) diff --git a/.github/workflows/bump_version.yml b/.github/workflows/bump_version.yml index 0ab3e332..54261f07 100644 --- a/.github/workflows/bump_version.yml +++ b/.github/workflows/bump_version.yml @@ -38,25 +38,24 @@ jobs: - name: Update version in pyproject uses: jacobtomlinson/gha-find-replace@master 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 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 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 }} @@ -70,6 +69,3 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} tags: false - - - diff --git a/.github/workflows/dags.yml b/.github/workflows/dags.yml index e3f27d3d..1560d637 100644 --- a/.github/workflows/dags.yml +++ b/.github/workflows/dags.yml @@ -33,6 +33,7 @@ jobs: 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 @@ -41,10 +42,11 @@ jobs: 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 @@ -55,12 +57,9 @@ jobs: 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 with: github_token: ${{ secrets.GITHUB_TOKEN }} - - - diff --git a/.github/workflows/python-testing.yml b/.github/workflows/python-testing.yml index 0137ab6a..cfa78fd7 100644 --- a/.github/workflows/python-testing.yml +++ b/.github/workflows/python-testing.yml @@ -11,21 +11,23 @@ on: # branches: [ main ] jobs: - quality: runs-on: ubuntu-latest steps: - name: Clone repo uses: actions/checkout@master + - name: Setup Python uses: actions/setup-python@v4 with: - python-version: '3.8' + python-version: "3.8" + - uses: actions/cache@v3 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-3.8 restore-keys: ${{ runner.os }}-pip-3.8 + - name: Install non-python dependencies run: | sudo apt-get install -y graphviz-dev @@ -37,6 +39,7 @@ jobs: with: virtualenvs-create: true virtualenvs-in-project: true + - name: Disable Poetry modern installation run: | poetry config installer.modern-installation false @@ -71,124 +74,141 @@ jobs: run: poetry run black hippunfold --check - name: snakefmt run: poetry run snakefmt hippunfold --check - - test: + test: runs-on: ubuntu-latest - needs: [ 'quality' ] + needs: ["quality"] strategy: matrix: - python-version: ['3.8'] + python-version: ["3.8"] + steps: - - uses: actions/checkout@master - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ matrix.python-version }} - restore-keys: ${{ runner.os }}-pip-${{ matrix.python-version }} - - name: Install non-python dependencies - run: | - sudo apt-get install -y graphviz-dev - #---------------------------------------------- - # ----- install & configure poetry ----- - #---------------------------------------------- - - name: Install Poetry - uses: snok/install-poetry@v1 - with: - virtualenvs-create: true - virtualenvs-in-project: true - - name: Disable Poetry modern installation - run: | - poetry config installer.modern-installation false - #---------------------------------------------- - # load cached venv if cache exists - #---------------------------------------------- - - name: Load cached venv - id: cached-poetry-dependencies - uses: actions/cache@v3 - with: - path: .venv - key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }} - #---------------------------------------------- - # install dependencies if cache does not exist - #---------------------------------------------- - - name: Install dependencies - if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' - run: poetry install --no-interaction --no-root - #---------------------------------------------- - # install your root project, if required - #---------------------------------------------- - - name: Install library - run: poetry install --no-interaction - - name: Set-up env for hippunfold - run: | - echo "HIPPUNFOLD_CACHE_DIR=`pwd`/test_data/fake_models" >> $GITHUB_ENV - - name: Test single T2w bids - run: | - poetry run hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w - - name: Test running on existing folder - run: | - mkdir test_newout - poetry run hippunfold test_data/bids_singleT2w test_newout participant -np --modality T2w - - name: Test single T2w bids, right hemi - run: | - poetry run hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w --hemi R - - name: Test single T2w bids, left hemi - run: | - poetry run hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w --hemi L - - name: Test multiple T2w bids - run: | - poetry run hippunfold test_data/bids_multiT2w test_out participant -np --modality T2w - - name: Test T1w bids - run: | - poetry run hippunfold test_data/bids_T1w test_out participant -np --modality T1w - - name: Test hipp b500 bids - run: | - poetry run hippunfold test_data/bids_hippb500 test_out participant -np --modality hippb500 - - name: Test T1w multi-session/longitudinal bids - run: | - poetry run hippunfold test_data/bids_T1w_longitudinal test_out participant -np --modality T1w - - name: Test single T2w multi-session/longitudinal bids - run: | - poetry run hippunfold test_data/bids_singleT2w_longitudinal test_out participant -np --modality T2w - - name: Test manual seg T2w bids - run: | - poetry run hippunfold test_data/bids_segT2w test_out participant -np --modality segT2w - - name: Test cropseg bids, with path override - run: | - poetry run hippunfold . test_out participant -np --modality cropseg --path_cropseg test_data/data_cropseg/sub-{subject}_hemi-{hemi}_dseg.nii.gz - - name: Test cropseg bids, with path override, left hemi - run: | - poetry run hippunfold . test_out participant -np --modality cropseg --path_cropseg test_data/data_cropseg_1hemi/sub-{subject}_hemi-{hemi}_dseg.nii.gz --hemi L - - name: Test T2w with T1w template registration - run: | - poetry run hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w --t1_reg_template - - name: Test T2w with T1w output space - run: | - poetry run hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w --output_space T1w - - name: Test modality T2w with myelin map - run: | - poetry run hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w --generate-myelin-map - - name: Test modality T1w with myelin map - run: | - poetry run hippunfold test_data/bids_singleT2w test_out participant -np --modality T1w --generate-myelin-map - - name: Test modality T1w with magdeburg atlas - run: | - poetry run hippunfold test_data/bids_T1w test_out participant -np --modality T1w --atlas magdeburg - - name: Test modality T1w with freesurfer atlas - run: | - poetry run hippunfold test_data/bids_T1w test_out participant -np --modality T1w --atlas freesurfer - - name: Test modality T1w with bigbrain and freesurfer atlas - run: | - poetry run hippunfold test_data/bids_T1w test_out participant -np --modality T1w --atlas bigbrain freesurfer + - uses: actions/checkout@master + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ matrix.python-version }} + restore-keys: ${{ runner.os }}-pip-${{ matrix.python-version }} + - name: Install non-python dependencies + run: | + sudo apt-get install -y graphviz-dev + #---------------------------------------------- + # ----- install & configure poetry ----- + #---------------------------------------------- + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + - name: Disable Poetry modern installation + run: | + poetry config installer.modern-installation false + #---------------------------------------------- + # load cached venv if cache exists + #---------------------------------------------- + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v3 + with: + path: .venv + key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }} + #---------------------------------------------- + # install dependencies if cache does not exist + #---------------------------------------------- + - name: Install dependencies + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-interaction --no-root + #---------------------------------------------- + # install your root project, if required + #---------------------------------------------- + - name: Install library + run: poetry install --no-interaction + + - name: Set-up env for hippunfold + run: | + echo "HIPPUNFOLD_CACHE_DIR=`pwd`/test_data/fake_models" >> $GITHUB_ENV + + - name: Test single T2w bids + run: | + poetry run hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w + + - name: Test running on existing folder + run: | + mkdir test_newout + poetry run hippunfold test_data/bids_singleT2w test_newout participant -np --modality T2w + + - name: Test single T2w bids, right hemi + run: | + poetry run hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w --hemi R + + - name: Test single T2w bids, left hemi + run: | + poetry run hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w --hemi L + + - name: Test multiple T2w bids + run: | + poetry run hippunfold test_data/bids_multiT2w test_out participant -np --modality T2w + + - name: Test T1w bids + run: | + poetry run hippunfold test_data/bids_T1w test_out participant -np --modality T1w + + - name: Test hipp b500 bids + run: | + poetry run hippunfold test_data/bids_hippb500 test_out participant -np --modality hippb500 + + - name: Test T1w multi-session/longitudinal bids + run: | + poetry run hippunfold test_data/bids_T1w_longitudinal test_out participant -np --modality T1w + + - name: Test single T2w multi-session/longitudinal bids + run: | + poetry run hippunfold test_data/bids_singleT2w_longitudinal test_out participant -np --modality T2w + + - name: Test manual seg T2w bids + run: | + poetry run hippunfold test_data/bids_segT2w test_out participant -np --modality segT2w + + - name: Test cropseg bids, with path override + run: | + poetry run hippunfold . test_out participant -np --modality cropseg --path_cropseg test_data/data_cropseg/sub-{subject}_hemi-{hemi}_dseg.nii.gz + + - name: Test cropseg bids, with path override, left hemi + run: | + poetry run hippunfold . test_out participant -np --modality cropseg --path_cropseg test_data/data_cropseg_1hemi/sub-{subject}_hemi-{hemi}_dseg.nii.gz --hemi L + + - name: Test T2w with T1w template registration + run: | + poetry run hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w --t1_reg_template + + - name: Test T2w with T1w output space + run: | + poetry run hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w --output_space T1w + + - name: Test modality T2w with myelin map + run: | + poetry run hippunfold test_data/bids_singleT2w test_out participant -np --modality T2w --generate-myelin-map + - name: Test modality T1w with myelin map + run: | + poetry run hippunfold test_data/bids_singleT2w test_out participant -np --modality T1w --generate-myelin-map + - name: Test modality T1w with magdeburg atlas + run: | + poetry run hippunfold test_data/bids_T1w test_out participant -np --modality T1w --atlas magdeburg + - name: Test modality T1w with freesurfer atlas + run: | + poetry run hippunfold test_data/bids_T1w test_out participant -np --modality T1w --atlas freesurfer + + - name: Test modality T1w with bigbrain and freesurfer atlas + run: | + poetry run hippunfold test_data/bids_T1w test_out participant -np --modality T1w --atlas bigbrain freesurfer