1+ name : " Run sct_run_batch -s process_data.sh"
2+ # The tl;dr purpose of this workflow is to:
3+ # - A) Run the batch processing script part of the the SCT Course
4+ # - B) If run manually, then take some of the output files and package them into tutorial-specific datasets.
5+ #
6+ # In-depth explanation:
7+ # Most of SCT's tutorials depend on files generated by previous steps. (For example, 'sct_register_to_template'
8+ # depends on the segmented spinal cord image file generated by `sct_deepseg`. This creates a dilemma: If we want
9+ # SCT's tutorials to stand alone, we need to provide these intermediate files. But, if we want to run the tutorials
10+ # start to finish in a sequence (e.g. during the SCT Course), it would be confusing if the intermediate files
11+ # were already there.
12+ #
13+ # The solution is to only store the minimally-necessary files in the repository, then generate the intermediate files
14+ # using this workflow. That way, we can provide 2 different downloads:
15+ # - 'sct_course_data.zip': Files required to run the SCT course from start to finish.
16+ # - 'registration.zip', 'segmentation.zip', etc.: Files required by individual tutorials.
17+
18+ on :
19+ pull_request :
20+
21+ jobs :
22+ run-course-script :
23+ runs-on : ubuntu-latest
24+ steps :
25+
26+ - name : Checkout spinalcordtoolbox
27+ uses : actions/checkout@v2
28+ with :
29+ repository : spinalcordtoolbox/spinalcordtoolbox
30+ path : spinalcordtoolbox
31+
32+ # install_sct edits ~/.bashrc, but those environment changes don't get passed to subsequent steps in GH Actions.
33+ # So, we filter through the .bashrc and pass the values to $GITHUB_ENV and $GITHUB_PATH.
34+ # Relevant documentation: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#environment-files
35+ # This workaround should be replaced by https://github.com/spinalcordtoolbox/spinalcordtoolbox/pull/3198#discussion_r568225392
36+ - name : Install spinalcordtoolbox
37+ run : |
38+ cd spinalcordtoolbox
39+ ./install_sct -iy
40+ cat ~/.bashrc | grep "export SCT_DIR" | cut -d " " -f 2 >> $GITHUB_ENV
41+ cat ~/.bashrc | grep "export PATH" | grep -o "/.*" | cut -d ':' -f 1 >> $GITHUB_PATH
42+
43+ - name : " Checkout '${{ github.event.repository.name }}'"
44+ uses : actions/checkout@v2
45+ with :
46+ path : ${{ github.event.repository.name }}
47+
48+ - name : Run sct_run_batch -s process_data.sh
49+ run : |
50+ cd "${{ github.event.repository.name }}/multi_subject"
51+ sct_run_batch -script process_data.sh -d
52+
53+ - name : Assert that script executed without error
54+ run : |
55+ cd "${{ github.event.repository.name }}/multi_subject/output/log"
56+ [ "$(compgen -G "process_data_sub-0*.log")" ] # Log files should exist
57+ [ ! "$(compgen -G "err.process_data_sub-0*.log")" ] # Error files should NOT exist
0 commit comments