diff --git a/.github/workflows/validate-samples.yaml b/.github/workflows/validate-samples.yaml index 82250bc1..6787940e 100644 --- a/.github/workflows/validate-samples.yaml +++ b/.github/workflows/validate-samples.yaml @@ -64,4 +64,4 @@ jobs: - name: Validate samples if: ${{ env.STACKS != '' }} - run: STACKS_DIR=$(pwd)/samples/.cache bash tests/validate_devfile_schemas.sh + run: STACKS_DIR=$(pwd)/samples/.cache bash tests/validate_devfile_schemas.sh --samples diff --git a/tests/validate_devfile_schemas.sh b/tests/validate_devfile_schemas.sh index eac6a657..e987874d 100755 --- a/tests/validate_devfile_schemas.sh +++ b/tests/validate_devfile_schemas.sh @@ -1,5 +1,26 @@ #!/usr/bin/env bash +POSITIONAL_ARGS=() +SAMPLES="false" + +while [[ $# -gt 0 ]]; do + case $1 in + -s|--samples) + SAMPLES="true" + shift # past argument + ;; + -*|--*) + echo "Unknown option $1" + exit 1 + ;; + *) + POSITIONAL_ARGS+=("$1") # save positional arg + shift # past argument + ;; + esac +done + +set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters set -x stacksDir=${STACKS_DIR:-stacks} @@ -10,5 +31,12 @@ if [[ ! ${stacksDir} = /* ]]; then stacksDir=$(pwd)/${stacksDir} fi +# Unzip resource files if samples +if [ "${SAMPLES}" == "true" ]; then + for sample_dir in $(ls $stacksDir); do + unzip -n $stacksDir/$sample_dir/sampleName.zip -d $stacksDir + done +fi + ginkgo run --procs 2 \ tests/validate_devfile_schemas -- -stacksPath ${stacksDir} -stackDirs "$stackDirs"