Remove files that we downloaded and update test. #109
This file contains hidden or 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
name: MiniWDL Spec Conformance - WDL 1.1 | |
on: | |
push: | |
jobs: | |
conformance: | |
runs-on: ubuntu-latest | |
name: Run WDL 1.1 Spec Conformance Tests | |
steps: | |
- name: Checkout WDL spec repo | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install MiniWDL and dependencies | |
run: | | |
pip install miniwdl 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.1 | |
- 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.1", | |
"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 |