docs: address review feedback on module specification #167
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: Spec Compliance / Cromwell | |
| on: | |
| 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: Install Java | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y openjdk-11-jre | |
| - name: Install `cromwell` | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release download --repo broadinstitute/cromwell --pattern 'cromwell-*.jar' | |
| mv cromwell-*.jar cromwell.jar | |
| java -jar cromwell.jar --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 \ | |
| "java -jar ${{ github.workspace }}/cromwell.jar run ~{path} --inputs ~{input} --metadata-output ~{output}" \ | |
| --all-capabilities \ | |
| --inject-wdl-version development \ | |
| --output-selector .outputs \ | |
| --label "Cromwell / WDL 1.4" \ | |
| -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: cromwell-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/cromwell.json | |
| git add shields/cromwell.json | |
| # Skip if the shield contents didn't change; the README run-URL | |
| # rewrite below always produces a diff, so without this guard we | |
| # commit a no-op every scheduled run. | |
| if git diff --cached --quiet -- shields/cromwell.json; then | |
| echo "🟢 Shield unchanged; skipping commit" | |
| exit 0 | |
| fi | |
| # Update README only if needed | |
| sed_pattern="https://raw.githubusercontent.com/openwdl/wdl/.*/shields/cromwell.json" | |
| new_url="https://raw.githubusercontent.com/openwdl/wdl/$BRANCH/shields/cromwell.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 "/cromwell\.json/s|$sed_pattern|$new_url|g" README.md | |
| sed -E -i "/cromwell\.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 Cromwell shield badge" | |
| git push $REPO_URL $BRANCH | |
| else | |
| echo "🟢 No changes to commit" | |
| fi |