|
| 1 | +name: FastSurfer Singularity |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + # Checkout repo |
| 8 | + checkout: |
| 9 | + runs-on: ci-gpu |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v2 |
| 12 | + |
| 13 | + # Prepare job: Set up Python, Go, Singularity |
| 14 | + prepare-job: |
| 15 | + runs-on: ci-gpu |
| 16 | + needs: checkout |
| 17 | + steps: |
| 18 | + - name: Set up Python 3.10 |
| 19 | + uses: actions/setup-python@v3 |
| 20 | + with: |
| 21 | + python-version: "3.10" |
| 22 | + - name: Set up Go |
| 23 | + uses: actions/setup-go@v5 |
| 24 | + with: |
| 25 | + go-version: '^1.13.1' # The Go version to download (if necessary) and use. |
| 26 | + - name: Set up Singularity |
| 27 | + uses: eWaterCycle/setup-singularity@v7 |
| 28 | + with: |
| 29 | + singularity-version: 3.8.3 |
| 30 | + |
| 31 | + # Build Docker Image and convert it to Singularity |
| 32 | + build-singularity-image: |
| 33 | + runs-on: ci-gpu |
| 34 | + needs: prepare-job |
| 35 | + steps: |
| 36 | + - name: Build Docker Image and convert to Singularity |
| 37 | + run: | |
| 38 | + cd $RUNNER_SINGULARITY_IMGS |
| 39 | + FILE="fastsurfer-gpu.sif" |
| 40 | + if [ ! -f "$FILE" ]; then |
| 41 | + # If the file does not exist, build the file |
| 42 | + echo "SIF File does not exist. Building file." |
| 43 | + PYTHONPATH=$PYTHONPATH |
| 44 | + cd $PYTHONPATH |
| 45 | + python3 Docker/build.py --device cuda --tag fastsurfer_gpu:cuda |
| 46 | + cd $RUNNER_SINGULARITY_IMGS |
| 47 | + singularity build --force fastsurfer-gpu.sif docker-daemon://fastsurfer_gpu:cuda |
| 48 | + else |
| 49 | + echo "File already exists" |
| 50 | + cd $PYTHONPATH |
| 51 | + fi |
| 52 | +
|
| 53 | + # Run FastSurfer on MRI data |
| 54 | + run-fastsurfer: |
| 55 | + runs-on: ci-gpu |
| 56 | + needs: build-singularity-image |
| 57 | + steps: |
| 58 | + - name: Run FastSurfer |
| 59 | + run: | |
| 60 | + singularity exec --nv \ |
| 61 | + --no-home \ |
| 62 | + --bind $GITHUB_WORKSPACE:/fastsurfer-dev \ |
| 63 | + --env FASTSURFER_HOME=/fastsurfer-dev \ |
| 64 | + -B $RUNNER_FS_MRI_DATA:/data \ |
| 65 | + -B $RUNNER_FS_OUTPUT:/output \ |
| 66 | + -B $RUNNER_FS_LICENSE:/fs_license \ |
| 67 | + $RUNNER_SINGULARITY_IMGS/fastsurfer-gpu.sif \ |
| 68 | + /fastsurfer/run_fastsurfer.sh \ |
| 69 | + --fs_license /fs_license/.license \ |
| 70 | + --t1 /data/subjectx/orig.mgz \ |
| 71 | + --sid subjectX --sd /output \ |
| 72 | + --parallel --3T |
| 73 | +
|
| 74 | + # Test file existence |
| 75 | + test-file-existence: |
| 76 | + runs-on: ci-gpu |
| 77 | + needs: run-fastsurfer |
| 78 | + steps: |
| 79 | + - name: Test File Existence |
| 80 | + run: | |
| 81 | + python3 test/quick_test/test_file_existence.py $RUNNER_FS_OUTPUT_FILES |
| 82 | +
|
| 83 | + # Test for errors in log files |
| 84 | + test-error-messages: |
| 85 | + runs-on: ci-gpu |
| 86 | + needs: [run-fastsurfer, test-file-existence] |
| 87 | + steps: |
| 88 | + - name: Test Log Files For Error Messages |
| 89 | + run: | |
| 90 | + python3 test/quick_test/test_errors.py $RUNNER_FS_OUTPUT_LOGS |
0 commit comments