Skip to content

Spec Compliance / Toil #135

Spec Compliance / Toil

Spec Compliance / Toil #135

Workflow file for this run

name: Spec Compliance / Toil
on:
workflow_dispatch:
push:
paths:
- 'SPEC.md'
schedule:
- cron: '0 3 * * 3'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install `spectool`
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release download --repo openwdl/spectool --pattern '*x86_64*linux*'
tar -xzf spectool*.tar.gz
chmod +x spectool
sudo mv spectool /usr/local/bin/
rm -rf spectool*.tar.gz
spectool --version
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install `toil`
run: |
pip install toil[wdl]
toil-wdl-runner --version
- name: Create results directory
run: mkdir -p ./.results/
- name: Run the compliance tests
run: |
echo "📊 Running compliance tests for \`${{ github.repository }}:${{ github.ref_name }}\`..."
spectool test \
"toil-wdl-runner ~{path} --inputs ~{input}" \
--redirect-stdout \
--all-capabilities \
--inject-wdl-version development \
--label "Toil / WDL 1.3" \
-s $PWD -vv > ./.results/shield.json 2> ./.results/logs.txt
cat ./.results/logs.txt
cat ./.results/shield.json
cp SPEC.md ./.results/SPEC.md
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: toil-results
path: ./.results/
- name: Publish badge JSON
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
mv ./.results/shield.json shields/toil.json
git add shields/toil.json
# Update README only if needed
sed_pattern="https://raw.githubusercontent.com/openwdl/wdl/.*/shields/toil.json"
new_url="https://raw.githubusercontent.com/openwdl/wdl/$BRANCH/shields/toil.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 "/toil\.json/s|$sed_pattern|$new_url|g" README.md
sed -E -i "/toil\.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 Toil shield badge"
git push $REPO_URL $BRANCH
else
echo "🟢 No changes to commit"
fi