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

Implementing matrix strategy to speed up gha-only tests #28

Merged
merged 18 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from 17 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
52 changes: 38 additions & 14 deletions .github/workflows/cromwell-test-run.yml
Original file line number Diff line number Diff line change
@@ -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
seankross marked this conversation as resolved.
Show resolved Hide resolved
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"

36 changes: 29 additions & 7 deletions .github/workflows/womtools-validate.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
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:
if: ${{ github.event.pull_request.head.repo.fork == false }}
seankross marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
strategy:
matrix:
wdl: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
-
name: Checkout
Expand All @@ -23,12 +44,13 @@ jobs:
-
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"
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions helloDockerHostname/options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"workflow_failure_mode": "ContinueWhilePossible",
"write_to_cache": false,
"read_from_cache": false
}
5 changes: 5 additions & 0 deletions helloHostname/options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"workflow_failure_mode": "ContinueWhilePossible",
"write_to_cache": false,
"read_from_cache": false
}
5 changes: 5 additions & 0 deletions helloModuleHostname/options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"workflow_failure_mode": "ContinueWhilePossible",
"write_to_cache": false,
"read_from_cache": false
}
Loading