Skip to content

Commit feef794

Browse files
authored
Merge pull request #628 from dkuegler/fix/quicktest
Fixing issues in quicktest
2 parents 63a3450 + 8ff6909 commit feef794

File tree

2 files changed

+36
-22
lines changed

2 files changed

+36
-22
lines changed

.github/actions/run-tests/action.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,18 @@ runs:
4141
python -m pip install --progress-bar off --upgrade pip setuptools wheel
4242
python -m pip install --progress-bar off .[quicktest]
4343
echo "::endgroup::"
44-
- name: Download reference data
44+
- name: Download and unpack reference data
4545
shell: bash
4646
env:
4747
CASE_HREF: ${{ inputs.case-href }}
4848
REF_DIR: ${{ inputs.reference-dir }}
4949
run: |
5050
echo "::group::Prepare processed and reference data"
5151
mkdir -p $REF_DIR
52-
echo "REF_DIR=$REF_DIR" >> $GITHUB_ENV
53-
curl -k "$CASE_HREF" | tar xf --directory "$REF_DIR"
52+
curl -k "$CASE_HREF" -o "$REF_DIR/ref-download-data"
53+
tar xf "$REF_DIR/ref-download-data" -C "$REF_DIR"
54+
rm -f "$REF_DIR/ref-download-data"
55+
echo "::endgroup::"
5456
- name: Recover Case data
5557
uses: ./.github/actions/load-processed
5658
with:
@@ -64,7 +66,7 @@ runs:
6466
REF_DIR: ${{ inputs.reference-dir }}
6567
shell: bash
6668
run: |
67-
echo "::endgroup::"
6869
echo "::group::Run tests"
6970
python -m pytest test/quick_test
71+
echo "::endgroup::"
7072

.github/workflows/quicktest.yaml

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
name: PR quicktest
1+
name: quicktest
22

33
# File: quicktest.yaml
4-
# Author: Taha Abdullah
5-
# Created on: 2023-07-10
4+
# Author: David Kügler
5+
# Reworked on: 2024-12-01
6+
# Created on: 2023-07-10 by Taha Abdullah
67
# Functionality: This workflow runs FastSurfer on MRI data and runs pytest to check if the results are acceptable. It
78
# also checks if the FastSurfer environment and output already exist, and if not, it creates them.
89
# Usage: This workflow is triggered on a pull request to the dev and main branch. It can also be triggered manually
@@ -30,8 +31,8 @@ on:
3031
description: 'Which docker image should be used to run this test (build-cached => build from git)'
3132
default: build-cached
3233
type: string
33-
freesurfer_build_image:
34-
description: 'FreeSurfer build image to build with'
34+
freesurfer-build-image:
35+
description: 'FreeSurfer build image to build with (default="": deep MI/fastsurfer-build:freesurferXXX; extract version from Docker/install_fs_pruned.sh)'
3536
type: string
3637

3738
permissions: read-all
@@ -60,6 +61,19 @@ jobs:
6061
env:
6162
GH_TOKEN: ${{ github.token }}
6263
run: |
64+
echo "::group::Debug information"
65+
echo "Workflow: ${{ github.workflow }}"
66+
echo "Action: ${{ github.event.action }}"
67+
if [[ "${{ github.event_name }}" == "pull_request" ]]
68+
echo "PR: ${{ github.event.number }}"
69+
echo "Event Triggered by: ${{ github.event.sender.login }}"
70+
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]
71+
echo "Inputs"
72+
cat <<EOF
73+
${{ toJSON(inputs) }}
74+
EOF
75+
fi
76+
echo "::endgroup::"
6377
h1="Accept: application/vnd.github+json"
6478
h2="X-GitHub-Api-Version: 2022-11-28"
6579
if [[ "${{ github.event_name }}" == "pull_request" ]]
@@ -70,34 +84,31 @@ jobs:
7084
echo "The Workflow '${{ github.workflow }}' was triggered by 'pull_request' of type"
7185
echo " '${{ github.event.action }}' but should only be triggered by 'labeled' or 'unlabeled' actions."
7286
echo "CONTINUE=false" > $GITHUB_OUTPUT
73-
exit
7487
elif [[ "${{ github.event.label.name }}" == "quicktest" ]]
7588
then
7689
echo "CONTINUE=true" > $GITHUB_OUTPUT
7790
else
7891
echo "This is a different label that was attached."
7992
echo "CONTINUE=false" > $GITHUB_OUTPUT
80-
exit
8193
fi
8294
echo "DOCKER_IMAGE=build-cached" >> $GITHUB_OUTPUT
8395
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]
8496
then
85-
if [[ "${{ inputs }}" == "{}" ]] || "${{ inputs.docker-image }}" == "" ]] ; then
97+
# the inputs context is only useful/set in the workflow dispatch event case
98+
if [[ "${{ toJSON(inputs) }}" == "{}" ]] || [[ "${{ inputs.docker-image }}" == "" ]] ; then
8699
echo "DOCKER_IMAGE=build-cached" > $GITHUB_OUTPUT
87100
else
88101
echo "DOCKER_IMAGE=${{ inputs.docker-image }}" > $GITHUB_OUTPUT
89102
fi
90103
echo "CONTINUE=true" >> $GITHUB_OUTPUT
91-
exit
92-
else # this event has no specific rules
104+
else # this event has no specific rules (invalid)
93105
echo "This workflow is not defined for the event ${{ github.event_name }}!"
94106
exit 1
95107
fi
96108
if ! gh api -H "$h1" -H "$h2" /repos/${{ github.repository }}/collaborators/${{ github.event.sender.login }}
97109
then
98110
echo "Only collaborators explicitly listed as collaborators can trigger this workflow!"
99111
echo "CONTINUE=false" >> $GITHUB_OUTPUT
100-
exit
101112
fi
102113
# later, we might want to extract additional run options from the pr text or issue comments
103114
# these should just be added here
@@ -106,10 +117,10 @@ jobs:
106117
# this may also need adaptations in the test script at the bottom
107118
echo "EXTRA_ARGS=" >> $GITHUB_OUTPUT
108119
- name: Checkout repository
109-
if: ${{ steps.parse.outputs.continue && steps.parse.outputs.docker-image == 'build-cached' }}
120+
if: ${{ steps.parse.outputs.CONTINUE && steps.parse.outputs.DOCKER_IMAGE == 'build-cached' }}
110121
uses: actions/checkout@v4
111122
- name: Get the FreeSurfer version
112-
if: ${{ steps.parse.outputs.continue && steps.parse.outputs.docker-image == 'build-cached' }}
123+
if: ${{ steps.parse.outputs.CONTINUE && steps.parse.outputs.DOCKER_IMAGE == 'build-cached' }}
113124
shell: bash
114125
id: parse-version
115126
run: |
@@ -120,15 +131,15 @@ jobs:
120131
fs_version_short="${fs_version//\./}"
121132
echo "FS_VERSION=$fs_version"
122133
echo "FS_VERSION_SHORT=$fs_version_short"
123-
if [[ -n "${{ inputs.freesurfer_build_image }}" ]] ; then
124-
echo "FS_BUILD_IMAGE=${{ inputs.freesurfer_build_image }}"
134+
if [[ -n "${{ inputs.freesurfer-build-image }}" ]] ; then
135+
echo "FS_BUILD_IMAGE=${{ inputs.freesurfer-build-image }}"
125136
else
126137
echo "FS_BUILD_IMAGE=deepmi/fastsurfer-build:freesurfer$fs_version_short"
127138
fi
128139
echo "FASTSURFER_HOME=$(pwd)"
129140
} > $GITHUB_OUTPUT
130141
- uses: Deep-MI/FastSurfer/.github/actions/build-docker@dev
131-
if: ${{ steps.parse.outputs.continue && steps.parse.outputs.docker-image == 'build-cached' }}
142+
if: ${{ steps.parse.outputs.CONTINUE && steps.parse.outputs.DOCKER_IMAGE == 'build-cached' }}
132143
# This action needs the "full" checkout (located at ${{ inputs.fastsurfer-home }})
133144
with:
134145
fastsurfer-home: ${{ steps.parse-version.outputs.FASTSURFER_HOME }}
@@ -140,6 +151,7 @@ jobs:
140151
needs: build-docker-latest
141152
runs-on: ubuntu-latest
142153
timeout-minutes: 180
154+
if: needs.build-docker-latest.outputs.continue
143155
strategy:
144156
# the following matrix strategy will result in one run per subject as matrix is "one-dimensional".
145157
# Additional parameters under "include" are then added as additional (dependent) information
@@ -166,7 +178,7 @@ jobs:
166178
docker-image: ${{ needs.build-docker-latest.outputs.docker-image }}
167179
extra-args: ${{ needs.build-docker-latest.outputs.extra-args }}
168180
tests:
169-
name: Download data and perform tests (1.0mm)
181+
name: 'Download data and perform tests'
170182
needs: fastsurfer
171183
runs-on: ubuntu-latest
172184
timeout-minutes: 60
@@ -188,4 +200,4 @@ jobs:
188200
subject-id: ${{ matrix.subject-id }}
189201
subjects-dir: ${{ env.SUBJECTS_DIR }}
190202
reference-dir: ${{ env.REFERENCE_DIR }}
191-
case-href: ${{ secrets[matrix.case-href] }}
203+
case-href: ${{ secrets[matrix.case-key] }}

0 commit comments

Comments
 (0)