Skip to content

Merge branch 'fix-test' of github.com:openwdl/wdl into fix-test #95

Merge branch 'fix-test' of github.com:openwdl/wdl into fix-test

Merge branch 'fix-test' of github.com:openwdl/wdl into fix-test #95

Workflow file for this run

name: MiniWDL Spec Conformance - WDL 1.2
on:
push:
jobs:
conformance:
runs-on: ubuntu-latest
name: Run WDL 1.2 Spec Conformance Tests
steps:
- name: Checkout WDL spec repo (wdl-1.2)
uses: actions/checkout@v4
with:
repository: openwdl/wdl
ref: wdl-1.2
path: wdl-spec
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install MiniWDL (main branch) and dependencies
run: |
pip install git+https://github.com/chanzuckerberg/miniwdl.git@main
pip install junit-xml subby
- name: Clone WDL tests
run: |
git clone https://github.com/openwdl/wdl-tests.git
- name: Extract tests
run: |
python wdl-tests/scripts/extract_tests.py -i ${{ github.workspace }}/SPEC.md -d ${{ github.workspace }}/tests/data/ -O miniwdl_test -v 1.2
- name: Run tests and capture results
run: |
mkdir -p miniwdl_tests/artifacts
echo "📊 Running tests..."
python wdl-tests/scripts/run_tests_miniwdl.py -T ${{ github.workspace }}/miniwdl_test -c ${{ github.workspace }}/miniwdl_test/test_config.json -D ${{ github.workspace }}/miniwdl_test/data -O miniwdl_results | tee miniwdl_tests/artifacts/result.log
echo "📊 Parsing test summary..."
total=$(grep "Total tests:" miniwdl_tests/artifacts/result.log | awk '{print $3}')
passed=$(grep "Passed:" miniwdl_tests/artifacts/result.log | awk '{print $2}')
warnings=$(grep "Warnings:" miniwdl_tests/artifacts/result.log | awk '{print $2}')
failed=$(grep "Failures:" miniwdl_tests/artifacts/result.log | awk '{print $2}')
invalid=$(grep "Invalid outputs:" miniwdl_tests/artifacts/result.log | awk '{print $3}')
ignored=$(grep "Ignored:" miniwdl_tests/artifacts/result.log | awk '{print $2}')
# Write summary JSON
cat <<EOF > miniwdl_tests/artifacts/results.json
{
"total": $total,
"passed": $passed,
"warnings": $warnings,
"failures": $failed,
"invalid_outputs": $invalid,
"ignored": $ignored
}
EOF
# Copy list of failures to artifacts
cp miniwdl_test/failed_tests.txt miniwdl_tests/artifacts/failed_tests.txt
# Generate shields.io badge JSON
color="green"
if [ "$passed" -lt "$total" ]; then color="yellow"; fi
if [ "$passed" -eq 0 ]; then color="red"; fi
cat <<EOF > miniwdl_tests/artifacts/shields.json
{
"schemaVersion": 1,
"label": "MiniWDL WDL 1.2",
"message": "$passed/$total passed",
"color": "$color"
}
EOF
- name: Upload test artifacts
uses: actions/upload-artifact@v4
with:
name: miniwdl-test-results
path: miniwdl_tests/artifacts/
- name: Publish badge JSON to current branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
BRANCH="${GITHUB_REF_NAME}"
RUN_ID="${{ github.run_id }}"
REPO="${{ github.repository }}"
RUN_URL="https://github.com/$REPO/actions/runs/$RUN_ID"
REPO_URL="https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git"
git fetch origin $BRANCH
git checkout $BRANCH
mkdir -p shields
cp miniwdl_tests/artifacts/shields.json shields/miniwdl_shields.json
git add shields/miniwdl_shields.json
# Update README only if needed
sed_pattern="https://raw.githubusercontent.com/openwdl/wdl/.*/shields/miniwdl_shields.json"
new_url="https://raw.githubusercontent.com/openwdl/wdl/$BRANCH/shields/miniwdl_shields.json"
run_pattern="https://github.com/$REPO/actions/runs/[0-9]+"
new_run="https://github.com/$REPO/actions/runs/$RUN_ID"
if grep -qE "$badge_pattern" README.md; then
git pull
sed -E -i "/miniwdl_shields\.json/s|$sed_pattern|$new_url|g" README.md
sed -E -i "/miniwdl_shields\.json/s|$run_pattern|$new_run|g" README.md
git add README.md
fi
# Only commit if there are staged changes
if ! git diff --cached --quiet; then
git commit -m "chore: updates miniwdl shields badge for \`$BRANCH\`"
git push $REPO_URL $BRANCH
else
echo "🟢 No changes to commit"
fi