diff --git a/src/wdlci/wdl_tests/count_columns.wdl b/src/wdlci/wdl_tests/count_columns.wdl index b160b2c..e2a033c 100644 --- a/src/wdlci/wdl_tests/count_columns.wdl +++ b/src/wdlci/wdl_tests/count_columns.wdl @@ -26,8 +26,9 @@ task count_columns { current_run_output_column_count=$(sed 's;,;\t;g' ~{current_run_output} | awk '{print NF}' | sort -nu | tail -n 1) validated_output_column_count=$(sed 's;,;\t;g' ~{validated_output} | awk '{print NF}' | sort -nu | tail -n 1) else - current_run_output_column_count=$(awk '{print NF}' ~{current_run_output} | sort -nu | tail -n 1) - validated_output_column_count=$(awk '{print NF}' ~{validated_output} | sort -nu | tail -n 1) + # Disregard headers starting with `#` + current_run_output_column_count=$(sed '/^#/d' ~{current_run_output} | awk '{print NF}' | sort -nu | tail -n 1) + validated_output_column_count=$(sed '/^#/d' ~{validated_output} | awk '{print NF}' | sort -nu | tail -n 1) fi if [[ "$current_run_output_column_count" != "$validated_output_column_count" ]]; then diff --git a/src/wdlci/wdl_tests/xml_validator.wdl b/src/wdlci/wdl_tests/xml_validator.wdl new file mode 100644 index 0000000..225a688 --- /dev/null +++ b/src/wdlci/wdl_tests/xml_validator.wdl @@ -0,0 +1,47 @@ +version 1.0 + +# Parse and validate XML file +# Input type: XML files + +task xml_validator { + input { + File current_run_output + File validated_output + } + + Int disk_size = ceil(size(current_run_output, "GB") + size(validated_output, "GB") + 50) + + command <<< + set -euo pipefail + + err() { + message=$1 + + echo -e "[ERROR] $message" >&2 + } + + if ! xmllint --noout ~{validated_output}; then + err "Validated XML file: [~{basename(validated_output)}] is invalid" + exit 1 + else + if ! xmllint --noout ~{current_run_output}; then + err "Current run XML file: [~{basename(current_run_output)}] is invalid" + exit 1 + else + echo "Current run XML file: [~{basename(current_run_output)}] is valid" + fi + fi + >>> + + output { + } + + runtime { + docker: "dnastack/dnastack-wdl-ci-tools:0.0.1" + cpu: 1 + memory: "3.75 GB" + disk: disk_size + " GB" + disks: "local-disk " + disk_size + " HDD" + preemptible: 1 + } +}