Apply suggestions from code review #617
Workflow file for this run
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 | |
- switch-phantoms-to-s3 | |
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: | |
REAL_ECAT_TEST_PATH: ${{ github.workspace }}/OpenNeuroPET-Phantoms/sourcedata/SiemensHRRT-JHU/Hoffman.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 Phantoms | |
id: cache-phantoms | |
uses: actions/cache@v2 | |
with: | |
path: US-sourced-OpenNeuroPET-Phantoms.zip | |
key: ${{ runner.os }}-phantoms | |
- name: Set up python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: | | |
cd pypet2bids | |
python -m pip install --upgrade pip | |
pip install poetry | |
poetry install --with dev | |
- name: Collect ECAT and other phantoms | |
if: steps.cache-phantoms.outputs.cache-hit != 'true' | |
run: "wget https://openneuropet.s3.amazonaws.com/US-sourced-OpenNeuroPET-Phantoms.zip" | |
- name: Decompress ECAT and other phantoms | |
run: "unzip US-sourced-OpenNeuroPET-Phantoms.zip" | |
- 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: Test CLI --help | |
run: | | |
cd pypet2bids/ | |
poetry run python3 -m pypet2bids.ecat_cli --help | |
- name: Test CLI Ecat Dump | |
run: | | |
cd pypet2bids/ | |
poetry run python3 -m pypet2bids.ecat_cli ${{ env.REAL_ECAT_TEST_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/ && poetry run python3 -m tests.test_ecatread" | |
- name: Run All Other Python Tests w/ Pytest | |
run: | | |
cd pypet2bids | |
poetry run pytest -k 'not write_pixel_data' -k 'not test_convert_pmod_to_blood' tests/ |