-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from Workflomics/add-test-scripts
Add test scripts
- Loading branch information
Showing
4 changed files
with
92 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Run test script | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
run-test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install cwltool | ||
run: pip install cwltool | ||
|
||
- name: Run tests | ||
run: ./test.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
|
||
# This script runs the test scripts in the 'test' directory of each tool, | ||
# testing whether the CWL annotations pass as stand-alone workflow steps. | ||
# This requires `cwltool` and `docker` to be installed. | ||
|
||
# Set the base directory | ||
base_dir="cwl-tools" | ||
|
||
# Create arrays and counters for passed, failed tests, and missing scripts | ||
declare -a failed_tests | ||
passed_tests_count=0 | ||
failed_tests_count=0 | ||
missing_script_count=0 | ||
|
||
# Iterate over all directories (tool-names) in the base directory | ||
for tool_dir in "$base_dir"/*/; do | ||
# Define the path to the 'test' directory for the current tool | ||
script_dir="${tool_dir}test" | ||
|
||
# Check if the 'run-cwl.sh' script exists | ||
if [ -f "$script_dir/run-cwl.sh" ]; then | ||
echo "Testing $script_dir..." | ||
|
||
(cd "$script_dir" && bash "./run-cwl.sh") | ||
if [ $? -eq 0 ]; then | ||
((passed_tests_count++)) # Increment passed tests counter | ||
else | ||
failed_tests+=("$script_dir/run-cwl.sh") | ||
((failed_tests_count++)) # Increment failed tests counter | ||
fi | ||
|
||
else | ||
echo "❗ Script not found in directory: $script_dir" | ||
((missing_script_count++)) # Increment the missing script counter | ||
fi | ||
done | ||
|
||
# Print missing test script count | ||
if [ $missing_script_count -gt 0 ]; then | ||
echo "❗ $missing_script_count tools did not have a test script" | ||
fi | ||
|
||
# Print a summary of test results | ||
if [ $failed_tests_count -eq 0 ]; then | ||
echo "✅ $passed_tests_count tests passed successfully" | ||
exit 0 | ||
else | ||
echo "The following tests failed:" | ||
for test in "${failed_tests[@]}"; do | ||
echo "🚨 $test" | ||
done | ||
exit 1 | ||
fi |