Skip to content

chore(metrics): refresh LOC badge (auto-generated) #2

chore(metrics): refresh LOC badge (auto-generated)

chore(metrics): refresh LOC badge (auto-generated) #2

Workflow file for this run

name: CI

Check failure on line 1 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci.yml

Invalid workflow file

(Line: 67, Col: 9): Unrecognized function: 'hashFiles'. Located at position 1 within expression: hashFiles('Package.swift') != ''
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 grep -q "loc-dynamic" README.md; then
sed -i '' "s|loc-dynamic-lightblue|loc-${LOC}-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