Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test to validate WDLs in the scripts directory. #7826

Merged
merged 1 commit into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions .github/workflows/gatk-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,24 @@ jobs:
identifier: Java ${{ matrix.Java }} test on docker ${{matrix.testType}}
only-artifact: ${{ needs.check-secrets.outputs.google-credentials != 'true' }}

#run wdl validation on WDLs in the scripts directory
scriptsWdlValidation:
runs-on: ubuntu-latest
name: Validate script WDLs using womtools
steps:
- uses: actions/checkout@v2
with:
fetch: 0
- uses: ./.github/actions/install-cromwell
with:
CROMWELL_VERSION: ${{ env.CROMWELL_VERSION }}
- name: Run Scripts WDL Validation Test
run: ./gradlew gatkValidateScriptsWdl

#test wdl auto generation
wdlGen:
#run wdl validation on generated WDLs
generatedWdlValidation:
runs-on: ubuntu-latest
name: Test WDL Generation
name: Validate generated WDLs using womtools
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -270,9 +283,8 @@ jobs:
with:
CROMWELL_VERSION: ${{ env.CROMWELL_VERSION }}

- name: Run WDL Generation Test
run: ./gradlew gatkWDLGenValidation

- name: Run Generated WDL Validation Test
run: ./gradlew gatkValidateGeneratedWdl

#Run our various targeted medium scale wdl wiring tests
wdlTests:
Expand Down
48 changes: 35 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,20 @@ task gatkWDLGen(type: Javadoc, dependsOn: classes) {
options.addStringOption("build-dir", System.getenv("TRAVIS_BUILD_DIR") ?: new File(".").getAbsolutePath())
}

task gatkWDLGenValidation(dependsOn: [gatkWDLGen, shadowJar]) {
def execWDLValidation = { validateWDL ->
println "Executing: $validateWDL"
try {
def retCode = validateWDL.execute().waitFor()
if (retCode.intValue() != 0) {
throw new GradleException("Execution of \"$validateWDL\" failed with exit code: $retCode.")
}
return retCode
} catch (IOException e) {
throw new GradleException("An IOException occurred while attempting to execute the command $validateWDL.")
}
}

task gatkValidateScriptsWdl() {
doFirst {
// running this task requires a local cromwell installation, with environment variables CROMWELL_JAR,
// WOMTOOL_JAR set to the jar locations
Expand All @@ -812,21 +825,31 @@ task gatkWDLGenValidation(dependsOn: [gatkWDLGen, shadowJar]) {
}
}

def execWDLValidation = { validateWDL ->
println "Executing: $validateWDL"
try {
def retCode = validateWDL.execute().waitFor()
if (retCode.intValue() != 0) {
throw new GradleException("Execution of \"$validateWDL\" failed with exit code: $retCode.")
}
return retCode
} catch (IOException e) {
throw new GradleException("An IOException occurred while attempting to execute the command $validateWDL.")
doLast {
// Run the womtool validator on all WDL files in the 'scripts' directory
final File wdlFolder = new File("scripts")
def wdlFiles = fileTree(dir: wdlFolder).filter {
f -> f.getAbsolutePath().endsWith(".wdl")
}
final womtoolLocation = System.getenv('WOMTOOL_JAR')
wdlFiles.any() { wdlFile ->
final validateWDLCommand = "java -jar $womtoolLocation validate $wdlFile"
execWDLValidation(validateWDLCommand)
}
}
}

task gatkValidateGeneratedWdl(dependsOn: [gatkWDLGen, shadowJar]) {
doFirst {
// running this task requires a local cromwell installation, with environment variables CROMWELL_JAR,
// WOMTOOL_JAR set to the jar locations
if (System.getenv('CROMWELL_JAR') == null || System.getenv('WOMTOOL_JAR') == null) {
throw new GradleException("Running this task requires the CROMWELL_JAR and WOMTOOL_JAR environment variables to be set")
}
}

doLast {
// first, run the womtool validator
// first, run the womtool validator on WDL files in the 'docs/wdlGen' directory
final File wdlGenFolder = new File("$docBuildDir/wdlGen")
def wdlFiles = fileTree(dir: wdlGenFolder).filter {
f -> !f.getAbsolutePath().endsWith(".html") && !f.getAbsolutePath().endsWith(".json")
Expand Down Expand Up @@ -862,7 +885,6 @@ task gatkWDLGenValidation(dependsOn: [gatkWDLGen, shadowJar]) {
file("$buildDir/cromwell-workflow-logs").deleteDir()
}
}

}


Expand Down