Update changelog. #127
Workflow file for this run
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: Sprocket Spec Conformance - WDL 1.2 | |
| on: | |
| push: | |
| jobs: | |
| sprocket-conformance: | |
| runs-on: ubuntu-latest | |
| name: Run Sprocket WDL 1.2 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 Python dependencies | |
| run: | | |
| pip install subby | |
| - name: Install Sprocket dependencies | |
| run: | | |
| curl -y --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | |
| . "$HOME/.cargo/env" | |
| cargo install sprocket --locked | |
| - 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 sprocket_test -v 1.2 | |
| - name: Run tests and capture results | |
| run: | | |
| mkdir -p sprocket_tests/artifacts | |
| echo "📊 Running tests..." | |
| python wdl-tests/scripts/run_tests_sprocket.py \ | |
| -T ${{ github.workspace }}/sprocket_test \ | |
| -c ${{ github.workspace }}/sprocket_test/test_config.json \ | |
| -D ${{ github.workspace }}/sprocket_test/data \ | |
| -O sprocket_results | tee sprocket_tests/artifacts/result.log | |
| echo "📊 Parsing test summary..." | |
| total=$(grep "Total tests:" sprocket_tests/artifacts/result.log | awk '{print $3}') | |
| passed=$(grep "Passed:" sprocket_tests/artifacts/result.log | awk '{print $2}') | |
| warnings=$(grep "Warnings:" sprocket_tests/artifacts/result.log | awk '{print $2}') | |
| failed=$(grep "Failures:" sprocket_tests/artifacts/result.log | awk '{print $2}') | |
| invalid=$(grep "Invalid outputs:" sprocket_tests/artifacts/result.log | awk '{print $3}') | |
| ignored=$(grep "Ignored:" sprocket_tests/artifacts/result.log | awk '{print $2}') | |
| # Write summary JSON | |
| cat <<EOF > sprocket_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 sprocket_test/failed_tests.txt sprocket_tests/artifacts/failed_tests.txt || touch sprocket_tests/artifacts/failed_tests.txt | |
| # Generate shields.io badge JSON | |
| color="green" | |
| total_run=$((total - ignored)) | |
| if [ "$passed" -lt "$total_run" ]; then color="yellow"; fi | |
| if [ "$passed" -eq 0 ]; then color="red"; fi | |
| cat <<EOF > sprocket_tests/artifacts/shields.json | |
| { | |
| "schemaVersion": 1, | |
| "label": "Sprocket WDL 1.2", | |
| "message": "$passed/$total_run passed", | |
| "color": "$color" | |
| } | |
| EOF | |
| - name: Upload test artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: sprocket-test-results | |
| path: sprocket_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 sprocket_tests/artifacts/shields.json shields/sprocket_shields.json | |
| git add shields/sprocket_shields.json | |
| # Update README only if needed | |
| sed_pattern="https://raw.githubusercontent.com/openwdl/wdl/.*/shields/sprocket_shields.json" | |
| new_url="https://raw.githubusercontent.com/openwdl/wdl/$BRANCH/shields/sprocket_shields.json" | |
| run_pattern="https://github.com/$REPO/actions/runs/[0-9]+" | |
| new_run="https://github.com/$REPO/actions/runs/$RUN_ID" | |
| echo $new_run | |
| echo $new_url | |
| if grep -qE "$sed_pattern" README.md; then | |
| git pull | |
| sed -E -i "/sprocket_shields\.json/s|$sed_pattern|$new_url|g" README.md | |
| sed -E -i "/sprocket_shields\.json/s|$run_pattern|$new_run|g" README.md | |
| git add README.md | |
| fi | |
| # Commit only if there are staged changes | |
| if ! git diff --cached --quiet; then | |
| git commit -m "chore: updates Sprocket shields badge for \`$BRANCH\`" | |
| git push $REPO_URL $BRANCH | |
| else | |
| echo "🟢 No changes to commit" | |
| fi |