diff --git a/.github/workflows/cromwell-test-run.yml b/.github/workflows/cromwell-test-run.yml index 86ea80c..7ab0d43 100644 --- a/.github/workflows/cromwell-test-run.yml +++ b/.github/workflows/cromwell-test-run.yml @@ -1,32 +1,56 @@ name: Cromwell Test Run on: + pull_request: workflow_dispatch: jobs: + generate-matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Find WDL Directories + id: set-matrix + run: | + # Find all directories containing .wdl files + dirs=$(find . -type f -name "*.wdl" -exec dirname {} \; | sort -u | sed 's|^\./||' | jq -R . | jq -s | jq -c .) + echo "Directories: $dirs" + echo "matrix=$dirs" >> $GITHUB_OUTPUT + testrun: + needs: generate-matrix + if: ${{ github.event.pull_request.head.repo.fork == false }} runs-on: ubuntu-latest permissions: write-all + strategy: + matrix: + wdl: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v4 - - - name: Set Up Java + + - name: Set Up Java uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '21' - - - name: Pull Cromwell Jarfile - run: wget -q https://github.com/broadinstitute/cromwell/releases/download/86/cromwell-86.jar - - - name: Execute Test Run of WDL Workflows - run: | - java -jar cromwell-86.jar run helloHostname/helloHostname.wdl - java -jar cromwell-86.jar run helloModuleHostname/helloModuleHostname.wdl - java -jar cromwell-86.jar run helloDockerHostname/helloDockerHostname.wdl - + - name: Pull Cromwell Jarfile + run: wget -q https://github.com/broadinstitute/cromwell/releases/download/86/cromwell-86.jar + - name: Execute Test Run of WDL Workflows + run: | + cmd="java -jar cromwell-86.jar run ${{ matrix.wdl }}/${{ matrix.wdl }}.wdl" + if [[ -f "${{ matrix.wdl }}/inputs.json" ]]; then + cmd="$cmd -i ${{ matrix.wdl }}/inputs.json" + fi + if [[ -f "${{ matrix.wdl }}/options.json" ]]; then + cmd="$cmd -o ${{ matrix.wdl }}/options.json" + fi + echo "Running command: $cmd" + eval "$cmd" diff --git a/.github/workflows/womtools-validate.yml b/.github/workflows/womtools-validate.yml index ad88369..4ac13e9 100644 --- a/.github/workflows/womtools-validate.yml +++ b/.github/workflows/womtools-validate.yml @@ -1,34 +1,55 @@ name: WOMtool Validation of WDL Script on: + pull_request: workflow_dispatch: -permissions: - contents: read - packages: write - jobs: + generate-matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Find WDL Directories + id: set-matrix + run: | + # Find all directories containing .wdl files + dirs=$(find . -type f -name "*.wdl" -exec dirname {} \; | sort -u | sed 's|^\./||' | jq -R . | jq -s | jq -c .) + echo "Directories: $dirs" + echo "matrix=$dirs" >> $GITHUB_OUTPUT + womtoolval: + needs: generate-matrix + if: ${{ github.event.pull_request.head.repo.fork == false }} runs-on: ubuntu-latest + strategy: + matrix: + wdl: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} steps: - name: Checkout uses: actions/checkout@v4 + - name: Set Up Java uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '21' + - name: Pull WOMtool Jarfile run: wget -q https://github.com/broadinstitute/cromwell/releases/download/86/womtool-86.jar - - + + - name: Validate WDL Scripts run: | - java -jar womtool-86.jar validate helloHostname/helloHostname.wdl - java -jar womtool-86.jar validate helloModuleHostname/helloModuleHostname.wdl - java -jar womtool-86.jar validate helloDockerHostname/helloDockerHostname.wdl - - - + cmd="java -jar womtool-86.jar validate ${{ matrix.wdl }}/${{ matrix.wdl }}.wdl" + if [[ -f "${{ matrix.wdl }}/inputs.json" ]]; then + cmd="$cmd -i ${{ matrix.wdl }}/inputs.json" + fi + echo "Running command: $cmd" + eval "$cmd" diff --git a/README.md b/README.md index 14d6366..54e607c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ # wdl-unit-tests + +![Runs on Cromwell](https://github.com/FredHutch/wdl-unit-tests/actions/workflows/cromwell-test-run.yml/badge.svg) +![WOMtool Validation](https://github.com/FredHutch/wdl-unit-tests/actions/workflows/womtools-validate.yml/badge.svg) + A collection of minimal WDL (Workflow Description Language) workflows designed for testing WDL execution environments and backend configurations. Each workflow tests a specific aspect of WDL functionality while maintaining simplicity for easy debugging and verification. ## Workflows diff --git a/helloDockerHostname/options.json b/helloDockerHostname/options.json new file mode 100644 index 0000000..1d043b8 --- /dev/null +++ b/helloDockerHostname/options.json @@ -0,0 +1,5 @@ +{ + "workflow_failure_mode": "ContinueWhilePossible", + "write_to_cache": false, + "read_from_cache": false +} diff --git a/helloHostname/options.json b/helloHostname/options.json new file mode 100644 index 0000000..1d043b8 --- /dev/null +++ b/helloHostname/options.json @@ -0,0 +1,5 @@ +{ + "workflow_failure_mode": "ContinueWhilePossible", + "write_to_cache": false, + "read_from_cache": false +} diff --git a/helloModuleHostname/options.json b/helloModuleHostname/options.json new file mode 100644 index 0000000..1d043b8 --- /dev/null +++ b/helloModuleHostname/options.json @@ -0,0 +1,5 @@ +{ + "workflow_failure_mode": "ContinueWhilePossible", + "write_to_cache": false, + "read_from_cache": false +}