Skip to content

more robust (and dumb) way to get relative path #123

more robust (and dumb) way to get relative path

more robust (and dumb) way to get relative path #123

Workflow file for this run

name: phantoms
on:
workflow_call:
push:
branches:
- main
pull_request:
branches:
- main
- dev
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
jobs:
phantoms:
runs-on: ${{ matrix.os }}
env:
DCM2NIIX_WIN_PATH: dcm2niix_win/dcm2niix.exe
MATLAB_CODE_PATH: ${{ github.workspace }}/matlab/
METADATA_PATH: ${{ github.workspace }}/metadata/
strategy:
matrix:
os: [ubuntu-20.04]
python: ["3.10"]
fail-fast: false
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Cache Node Posix
if: runner.os != 'Windows' && !env.ACT
uses: actions/cache@v3
with:
path: ~/.npm
key: npm-${{ runner.os }}-${{ env.cache-name }}
- name: Cache Phantoms
if: ${{ !env.ACT }}
id: phantom-cache
uses: actions/cache@v3
env:
cache-name: cache-phantoms
with:
path: PHANTOMS.zip
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('PHANTOMS.zip') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-
${{ runner.os }}-
- name: Install dcm2niix posix
if: runner.os != 'Windows'
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
mkdir dcm2niix_install/ && cd dcm2niix_install/
curl -fLO https://github.com/rordenlab/dcm2niix/releases/download/v1.0.20230411/dcm2niix_lnx.zip
unzip dcm2niix*.zip
echo "${{ github.workspace }}/dcm2niix_install/" >> $GITHUB_PATH
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install dcm2niix
fi
- name: Install dcm2niix windows
if: runner.os == 'Windows'
run: |
curl -fLO https://github.com/rordenlab/dcm2niix/releases/latest/download/dcm2niix_win.zip
powershell -command "Expand-Archive dcm2niix_win.zip"
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'pip'
cache-dependency-path: |
pypet2bids/pyproject.toml
- name: Install Python Dependencies
run: |
cd pypet2bids
pip install .
pip install gdown
- name: Install Poetry Build Package
run: |
make installpoetry
make buildpackage
make installpackage
dcm2niix4pet -h
- name: Set Up Node
uses: actions/setup-node@v3
- name: Install BIDS Validator
run: npm install -g bids-validator
- name: Collect Phantoms from Google Drive
if: ${{ steps.cache-phantoms.outputs.cache-hit != 'true' }} && ${{ !env.ACT }}
run: gdown ${{ secrets.ZIPPED_OPEN_NEURO_PET_PHANTOMS_URL }} -O PHANTOMS.zip
- name: Decompress phantoms windows
if: steps.cache-phantoms.outputs.cache-hit != 'true' && !env.ACT && runner.os == 'Windows'
run: powershell -command "Expand-Archive PHANTOMS.zip"
- name: Decompress phantoms posix
if: steps.cache-phantoms.outputs.cache-hit != 'true' && !env.ACT && runner.os != 'Windows'
run: unzip PHANTOMS.zip
- name: Copy Conversion Scripts from Version Control
run: |
mkdir -p OpenNeuroPET-Phantoms/code/
cp scripts/matlab_conversions.m OpenNeuroPET-Phantoms/code/matlab_conversions.m
cp scripts/python_conversions.sh OpenNeuroPET-Phantoms/code/python_conversions.sh
- name: Debug
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
timeout-minutes: 15
with:
limit-access-to-actor: true
- name: Run Python Conversion Script on Phantoms
run: |
cd OpenNeuroPET-Phantoms/code
bash python_conversions.sh
- name: SetupMatlab
if: ${{ matrix.os == 'ubuntu-20.04' }}
uses: matlab-actions/setup-matlab@v1
- name: Run Matlab Conversion Script on Phantoms
if: ${{ matrix.os == 'ubuntu-20.04' }}
uses: matlab-actions/run-command@v1
with:
command: |
addpath('${{ github.workspace }}/OpenNeuroPET-Phantoms/code')
addpath('${{ env.MATLAB_CODE_PATH }}');
addpath('${{ env.MATLAB_CODE_PATH }}/unit_tests');
addpath('${{ env.MATLAB_CODE_PATH }}/template_txt');
addpath('${{ env.SMALLER_ECAT_PATH }}');
addpath('${{ env.METADATA_PATH }}');
matlab_conversions
- name: Check Parity
run: |
python scripts/compare_jsons.py OpenNeuroPET-Phantoms/python OpenNeuroPET-Phantoms/matlab
- name: Validate Python Conversion
run: |
bids-validator OpenNeuroPET-Phantoms/python
- name: Validate Matlab Conversion
run: |
bids-validator OpenNeuroPET-Phantoms/matlab