Update project number in workflow configuration #4
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: CI | ||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
| branches: [ main ] | ||
| jobs: | ||
| build-test: | ||
| runs-on: macos-14 | ||
| timeout-minutes: 30 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.x' | ||
| - name: Show environment | ||
| run: | | ||
| swift --version || echo 'swift not installed' | ||
| python --version | ||
| - name: Build | ||
| if: ${{ hashFiles('Package.swift') != '' }} | ||
| run: swift build -v | ||
| - name: Test | ||
| if: ${{ hashFiles('Package.swift') != '' }} | ||
| run: swift test -v | ||
| - name: Validate YAML configs | ||
| run: | | ||
| pip install pyyaml | ||
| python scripts/vmstudio.py || true | ||
| - name: LOC badge (dry run) | ||
| run: | | ||
| brew install cloc || true | ||
| cloc . --json > loc.json || true | ||
| cat loc.json || true | ||
| - name: Update LOC badge | ||
| if: github.ref == 'refs/heads/main' | ||
| run: | | ||
| pip install pyyaml jq || true | ||
| brew install cloc || true | ||
| cloc . --json > loc.json | ||
| LOC=$(jq '.SUM.code' loc.json || echo 0) | ||
| mkdir -p badges | ||
| echo "<svg xmlns='http://www.w3.org/2000/svg' width='150' height='20'><rect rx='3' width='150' height='20' fill='#555'/><rect rx='3' x='60' width='90' height='20' fill='#007ec6'/><text x='30' y='14' fill='#fff' font-family='Verdana' font-size='11'>loc</text><text x='105' y='14' fill='#fff' font-family='Verdana' font-size='11'>${LOC}</text></svg>" > badges/loc.svg | ||
| # If README previously used shields placeholder, update it. | ||
| if grep -q "loc-dynamic" README.md; then | ||
| sed -i '' "s|loc-dynamic-lightblue|loc-${LOC}-blue|" README.md || true | ||
| fi | ||
| # If README still has an old shields numeric badge, optionally switch to local SVG once. | ||
| if grep -q "https://img.shields.io/badge/loc-" README.md; then | ||
| perl -i -pe 's|!\[Lines of Code\]\(https://img.shields.io/badge/loc-[0-9]+-blue\)||' README.md || true | ||
| fi | ||
| git config user.name 'github-actions' | ||
| git config user.email '[email protected]' | ||
| git add badges/loc.svg README.md || true | ||
| git commit -m "chore(ci): update LOC badge" || echo 'No changes to commit' | ||
| git push || true | ||
| lint-markdown: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Markdown link check | ||
| uses: gaurav-nelson/github-action-markdown-link-check@v1 | ||
| with: | ||
| use-verbose-mode: 'yes' | ||
| folder-path: '.' | ||
| swift-lint: | ||
| runs-on: macos-14 | ||
| if: ${{ hashFiles('Package.swift') != '' }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install SwiftFormat (placeholder) | ||
| run: brew install swiftformat || true | ||
| - name: Dry run format check | ||
| run: swiftformat . --lint || true | ||