1- name : MAN quicktest
1+ name : PR quicktest
22
33# File: quicktest.yaml
44# Author: Taha Abdullah
@@ -15,6 +15,9 @@ name: MAN quicktest
1515# - LICENSE: content of a FreeSurfer license file
1616
1717concurrency :
18+ # maybe the group here should actually not depend on the ref (only number would mean there are
19+ # not concurrent runs of the same pr) -- but then we should probably add the branch name (for
20+ # manually triggered workflows)
1821 group : ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
1922 cancel-in-progress : true
2023
3134 description : ' FreeSurfer build image to build with'
3235 type : string
3336
37+ permissions : read-all
38+
3439env :
3540 SUBJECTS_DIR : /tmp/subjects
3641 REFERENCE_DIR : /tmp/reference
3742
3843jobs :
39- parse-action :
40- name : ' Check whether the quicktest should run '
44+ build-docker-latest :
45+ name : ' Check and build the current docker image '
4146 runs-on : ubuntu-latest
47+ timeout-minutes : 180
4248 outputs :
43- continue : ${{ steps.parse.CONTINUE }}
44- docker-image : ${{ steps.parse.DOCKER_IMAGE }}
45- extra-args : ${{ steps.parse.EXTRA_ARGS }}
49+ continue : ${{ steps.parse.outputs.CONTINUE }}
50+ docker-image : ${{ steps.parse.outputs.DOCKER_IMAGE }}
51+ extra-args : ${{ steps.parse.outputs.EXTRA_ARGS }}
52+ fs-build-image : ${{ steps.parse-version.outputs.FS_BUILD_IMAGE }}
53+ fs-version : ${{ steps.parse-version.outputs.FS_VERSION }}
54+ fs-version-short : ${{ steps.parse-version.outputs.FS_VERSION_SHORT }}
55+ fastsurfer-home : ${{ steps.parse-version.outputs.FASTSURFER_HOME }}
4656 steps :
4757 - name : ' Check whether the tests should run'
4858 id : parse
4959 shell : bash
60+ env :
61+ GH_TOKEN : ${{ github.token }}
5062 run : |
5163 h1="Accept: application/vnd.github+json"
5264 h2="X-GitHub-Api-Version: 2022-11-28"
5365 if [[ "${{ github.event_name }}" == "pull_request" ]]
5466 then
55- if [[ "${{ github.event.action }}" == "labeled" ]] || [[ "${{ github.event.action }}" = = "unlabeled" ]]
67+ if [[ "${{ github.event.action }}" != "labeled" ]] && [[ "${{ github.event.action }}" ! = "unlabeled" ]]
5668 then
5769 # not a label-related action, should not be triggered
5870 echo "The Workflow '${{ github.workflow }}' was triggered by 'pull_request' of type"
5971 echo " '${{ github.event.action }}' but should only be triggered by 'labeled' or 'unlabeled' actions."
60- exit 1
72+ echo "CONTINUE=false" > $GITHUB_OUTPUT
73+ exit
6174 elif [[ "${{ github.event.label.name }}" == "quicktest" ]]
6275 then
6376 echo "CONTINUE=true" > $GITHUB_OUTPUT
6477 else
6578 echo "This is a different label that was attached."
6679 echo "CONTINUE=false" > $GITHUB_OUTPUT
80+ exit
6781 fi
6882 echo "DOCKER_IMAGE=build-cached" >> $GITHUB_OUTPUT
6983 elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]
7084 then
71- {
72- echo "CONTINUE=true"
73- if [[ "${{ inputs }}" == "{}" ]] || "${{ inputs.docker-image }}" == "" ]] ; then
74- echo "DOCKER_IMAGE=build-cached"
75- else
76- echo "DOCKER_IMAGE=${{ inputs.docker-image }}"
77- fi
78- } > $GITHUB_OUTPUT
85+ if [[ "${{ inputs }}" == "{}" ]] || "${{ inputs.docker-image }}" == "" ]] ; then
86+ echo "DOCKER_IMAGE=build-cached" > $GITHUB_OUTPUT
87+ else
88+ echo "DOCKER_IMAGE=${{ inputs.docker-image }}" > $GITHUB_OUTPUT
89+ fi
90+ echo "CONTINUE=true" >> $GITHUB_OUTPUT
91+ exit
7992 else # this event has no specific rules
8093 echo "This workflow is not defined for the event ${{ github.event_name }}!"
8194 exit 1
8295 fi
8396 if ! gh api -H "$h1" -H "$h2" /repos/${{ github.repository }}/collaborators/${{ github.event.sender.login }}
8497 then
8598 echo "Only collaborators explicitly listed as collaborators can trigger this workflow!"
86- echo "CONTINUE=false" > $GITHUB_OUTPUT
87- exit 1
99+ echo "CONTINUE=false" >> $GITHUB_OUTPUT
100+ exit
88101 fi
89102 # later, we might want to extract additional run options from the pr text or issue comments
90103 # these should just be added here
91104 # https://api.github.com/repos/${{ github.repository }}/issues/${{ github.number }}
92105 # https://api.github.com/repos/${{ github.repository }}/issues/${{ github.number }}/comments
93106 # this may also need adaptations in the test script at the bottom
94107 echo "EXTRA_ARGS=" >> $GITHUB_OUTPUT
95- build-docker-latest :
96- name : ' Build the current docker image'
97- needs : parse-action
98- runs-on : ubuntu-latest
99- if : ${{ jobs.parse-action.outputs.continue == 'true' }}
100- timeout-minutes : 180
101- steps :
102108 - name : Checkout repository
109+ if : ${{ steps.parse.outputs.continue && steps.parse.outputs.docker-image == 'build-cached' }}
103110 uses : actions/checkout@v4
104111 - name : Get the FreeSurfer version
112+ if : ${{ steps.parse.outputs.continue && steps.parse.outputs.docker-image == 'build-cached' }}
105113 shell : bash
114+ id : parse-version
106115 run : |
107116 # get the FreeSurfer version from install_fs_pruned.sh
108117 {
@@ -116,75 +125,67 @@ jobs:
116125 else
117126 echo "FS_BUILD_IMAGE=deepmi/fastsurfer-build:freesurfer$fs_version_short"
118127 fi
119- } > $GITHUB_ENV
120- - uses : ./.github/actions/build-docker@dev
128+ echo "FASTSURFER_HOME=$(pwd)"
129+ } > $GITHUB_OUTPUT
130+ - uses : Deep-MI/FastSurfer/.github/actions/build-docker@dev
131+ if : ${{ steps.parse.outputs.continue && steps.parse.outputs.docker-image == 'build-cached' }}
121132 # This action needs the "full" checkout (located at ${{ inputs.fastsurfer-home }})
122133 with :
123- fastsurfer-home : .
134+ fastsurfer-home : ${{ steps.parse-version.outputs.FASTSURFER_HOME }}
124135 # currently, this image has to be updated and used to circumvent storage limitations in github actions
125136 # and it is also faster to use this prebuilt, reduced-size freesurfer distribution
126- freesurfer-build-image : " ${{ env .FS_BUILD_IMAGE }}"
127- run-1mm :
128- name : ' Run FastSurfer on the 1mm sample image '
137+ freesurfer-build-image : " ${{ steps.parse-version.outputs .FS_BUILD_IMAGE }}"
138+ fastsurfer :
139+ name : ' Run FastSurfer on sample images '
129140 needs : build-docker-latest
130141 runs-on : ubuntu-latest
131142 timeout-minutes : 180
143+ strategy :
144+ # the following matrix strategy will result in one run per subject as matrix is "one-dimensional".
145+ # Additional parameters under "include" are then added as additional (dependent) information
146+ matrix :
147+ subject-id : [0.8mm, 1.0mm]
148+ include :
149+ - subject-id : 1.0mm
150+ file-extension : " .mgz"
151+ image-key : IMAGE_HREF_1mm
152+ - subject-id : 0.8mm
153+ file-extension : " .nii.gz"
154+ image-key : IMAGE_HREF_08mm
132155 steps :
133156 - uses : actions/checkout@v4
134157 with :
135158 sparse-checkout : .github/actions
136- - name : Run FastSurfer with the previously created docker container
137- uses : . /.github/actions/run-fastsurfer@dev
159+ - name : Run FastSurfer for ${{ matrix.subject-id }} with the previously created docker container
160+ uses : Deep-MI/FastSurfer /.github/actions/run-fastsurfer@dev
138161 with :
139- subject-id : 1.0mm
140- file-extension : " .mgz "
141- image-href : ${{ secrets.IMAGE_HREF_1mm }}
162+ subject-id : ${{ matrix.subject-id }}
163+ file-extension : ${{ matrix.file-extension }}
164+ image-href : ${{ secrets[matrix.image-key] }}
142165 license : ${{ secrets.LICENSE }}
143- docker-image : ${{ jobs.parse-action.outputs.docker-image }}
144- extra-args : ${{ jobs.parse-action.outputs.extra-args }}
145- run-08mm :
146- name : Run FastSurfer on the 0.8mm sample image
147- needs : build-docker-latest
148- runs-on : ubuntu-latest
149- timeout-minutes : 180
150- steps :
151- - uses : actions/checkout@v4
152- with :
153- sparse-checkout : .github/actions
154- - name : Run FastSurfer with the previously created docker container
155- uses : ./.github/actions/run-fastsurfer@dev
156- with :
157- subject-id : 0.8mm
158- file-extension : " .nii.gz"
159- image-href : ${{ secrets.IMAGE_HREF_08mm }}
160- license : ${{ secrets.LICENSE }}
161- docker-image : ${{ jobs.parse-action.outputs.docker-image }}
162- extra-args : ${{ jobs.parse-action.outputs.extra-args }}
163- run-tests-1mm :
166+ docker-image : ${{ needs.build-docker-latest.outputs.docker-image }}
167+ extra-args : ${{ needs.build-docker-latest.outputs.extra-args }}
168+ tests :
164169 name : Download data and perform tests (1.0mm)
165- needs : run-1mm
166- runs-on : ubuntu-latest
167- timeout-minutes : 60
168- steps :
169- - uses : actions/checkout@v4
170- - name : Run tests for the 1.0mm dataset
171- uses : ./.github/actions/run-tests@dev
172- with :
173- subject-id : " 1.0mm"
174- subjects-dir : ${{ env.SUBJECTS_DIR }}
175- reference-dir : ${{ env.REFERENCE_DIR }}
176- case-href : ${{ secrets.CASE_HREF_1mm }}
177- run-tests-08mm :
178- name : Download data and perform tests (0.8mm)
179- needs : run-08mm
170+ needs : fastsurfer
180171 runs-on : ubuntu-latest
181172 timeout-minutes : 60
173+ strategy :
174+ # the following matrix strategy will result in one run per subject as matrix is "one-dimensional".
175+ # Additional parameters under "include" are then added as additional (dependent) information
176+ matrix :
177+ subject-id : [0.8mm, 1.0mm]
178+ include :
179+ - subject-id : 0.8mm
180+ case-key : CASE_HREF_08mm
181+ - subject-id : 1.0mm
182+ case-key : CASE_HREF_1mm
182183 steps :
183184 - uses : actions/checkout@v4
184- - name : Run tests for the 0.8mm dataset
185- uses : . /.github/actions/run-tests@dev
185+ - name : Run tests
186+ uses : Deep-MI/FastSurfer /.github/actions/run-tests@dev
186187 with :
187- subject-id : " 0.8mm "
188+ subject-id : ${{ matrix.subject-id }}
188189 subjects-dir : ${{ env.SUBJECTS_DIR }}
189190 reference-dir : ${{ env.REFERENCE_DIR }}
190- case-href : ${{ secrets.CASE_HREF_08mm }}
191+ case-href : ${{ secrets[matrix.case-href] }}
0 commit comments