more robust (and dumb) way to get relative path #222
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: python | |
on: | |
push: | |
pull_request: | |
branches: | |
- main | |
workflow_call: | |
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: | |
Python-Collect-Data-and-Test: | |
runs-on: ${{ matrix.os }} | |
env: | |
ECAT_TEST_FOLDER: "cimbi36" | |
REAL_TEST_ECAT_PATH: cimbi36/Gris_102_19_2skan-2019.04.30.13.04.41_em_3d.v | |
SMALLER_ECAT_PATH: ${{ github.workspace }}/ecat_validation/ECAT7_multiframe.v.gz | |
TEST_ECAT_PATH: ${{ github.workspace }}/ecat_validation/ECAT7_multiframe.v | |
OUTPUT_NIFTI_PATH: ${{ github.workspace}}/pypet2bids/tests/ECAT7_multiframe.nii | |
READ_ECAT_SAVE_AS_MATLAB: ${{ github.workspace }}/pypet2bids/tests/ECAT7_multiframe.mat | |
NIBABEL_READ_ECAT_SAVE_AS_MATLAB: ${{ github.workspace }}/pypet2bids/tests/ECAT7_multiframe.nibabel.mat | |
MATLAB_CODE_PATH: ${{ github.workspace }}/matlab/ | |
strategy: | |
matrix: | |
os: [macOS-latest, ubuntu-latest] | |
python: ['3.8', '3.9', '3.10'] | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v2 | |
- name: Cache ECAT | |
id: cache-ecat | |
uses: actions/cache@v2 | |
with: | |
path: cimbi36 | |
key: ${{ runner.os }}-ecats | |
- name: Set up python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: | | |
cd pypet2bids | |
pip3 install . | |
- name: Install gdown and collect Ecat from Google Drive | |
if: steps.cache-ecat.outputs.cache-hit != 'true' | |
run: "python3 -m pip install gdown && gdown ${{ secrets.CIMBI_ECAT_ON_GOOGLE_DRIVE }} -O ecat_test" | |
- name: Decompress dataset | |
if: steps.cache-ecat.outputs.cache-hit != 'true' | |
run: "tar xvzf ecat_test && rm ecat_test" | |
- name: Test CLI --help | |
run: | | |
cd pypet2bids/ | |
python3 -m pypet2bids.ecat_cli --help | |
- name: Test CLI Ecat Dump | |
run: | | |
cd pypet2bids/ | |
python3 -m pypet2bids.ecat_cli ../${{ env.REAL_TEST_ECAT_PATH }} --dump | |
# the larger real data file uses too much ram for the github runner, we use the small file for | |
# heavy io operations instead | |
- name: Unzip Test File(s) | |
run: | | |
gzip -d ${{ env.SMALLER_ECAT_PATH }} | |
- name: Test ecatread | |
run: "cd pypet2bids/ && python3 -m tests.test_ecatread" | |
- name: Run All Other Python Tests w/ Pytest | |
run: | | |
cd pypet2bids | |
pytest -k 'not write_pixel_data' -k 'not test_convert_pmod_to_blood' tests/ |