Skip to content

chore(deps): bump all pinned actions to current majors #117

chore(deps): bump all pinned actions to current majors

chore(deps): bump all pinned actions to current majors #117

Workflow file for this run

name: CI
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.11"
- name: Run Python validator tests
run: cd validators && python -m unittest test_shadow_score -v
- name: Run conformance suite (Python validator)
run: python3 tests/conformance/run_conformance.py -v
- name: Validate JSON schema syntax
run: python -c "import json; json.load(open('validators/shadow-report-schema.json'))"
- name: Validate schema is a well-formed Draft-07 schema
run: |
pip install --quiet jsonschema
python -c "
import json
from jsonschema import Draft7Validator
Draft7Validator.check_schema(json.load(open('validators/shadow-report-schema.json')))
print('schema ok')
"
- name: Run schema conformance tests
run: python3 validators/test_schema.py
- name: Check spec version is consistent across spec and validators
run: |
python3 - <<'EOF'
import re, sys, pathlib
spec = pathlib.Path('SPEC.md').read_text()
m = re.search(r'\*\*Version:\*\*\s*([0-9]+\.[0-9]+\.[0-9]+)', spec)
if not m:
sys.exit('could not find version header in SPEC.md')
want = m.group(1)
checks = {
'validators/shadow-score.py': r'SPEC_VERSION = "([^"]+)"',
'validators/shadow-score.sh': r'SPEC_VERSION="([^"]+)"',
'validators/shadow-score.go': r'const specVersion = "([^"]+)"',
}
bad = False
for path, pat in checks.items():
got = re.search(pat, pathlib.Path(path).read_text())
got = got.group(1) if got else None
flag = 'ok ' if got == want else 'FAIL'
if got != want:
bad = True
print(f' {flag} {path}: {got} (spec: {want})')
sys.exit(1 if bad else 0)
EOF
- name: Check for stale gap-score naming
run: |
if grep -rn "gap_score\|gap-score\|Gap Report\|Gap Score" \
--include="*.md" --include="*.py" --include="*.json" \
--include="*.go" --include="*.sh" --include="*.yml" . \
| grep -v "minor-gaps\|critical-gaps" \
| grep -v "renamed to" \
| grep -v "^\./\.github/workflows/ci\.yml:" ; then
echo "::error::Stale gap-score naming found (renamed to shadow-score in v2.0.0)"
exit 1
fi
echo "no stale naming"
- name: Check all referenced repo files exist
run: |
python3 - <<'EOF'
import re, pathlib, sys
bad = False
for md in pathlib.Path('.').rglob('*.md'):
if '.git' in md.parts:
continue
for link in re.findall(r'\]\(([^)#][^)]*)\)', md.read_text()):
link = link.split('#')[0].strip()
if not link or link.startswith(('http://', 'https://', 'mailto:')):
continue
target = (md.parent / link).resolve()
if not target.exists():
print(f' FAIL {md}: broken link -> {link}')
bad = True
print('link check done')
sys.exit(1 if bad else 0)
EOF
- name: Validate example JSON files
run: |
python -c "
import json, pathlib, sys
ok = True
for p in pathlib.Path('examples').rglob('*.json'):
try:
json.load(open(p))
print(f' ok {p}')
except Exception as e:
print(f' FAIL {p}: {e}')
ok = False
sys.exit(0 if ok else 1)
"
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version: "1.21"
- name: Build Go validator
run: cd validators && go build -o /tmp/shadow-score-go .
- name: Smoke-test Go validator (perfect score)
run: |
/tmp/shadow-score-go --sealed examples/01-perfect-score/sealed-results.json \
--open examples/01-perfect-score/open-results.json --format summary
- name: Smoke-test Go validator (threshold pass)
run: |
/tmp/shadow-score-go --sealed examples/02-minor-gaps/sealed-results.json \
--threshold 15
- name: Smoke-test Go validator (threshold fail exits 1)
run: |
/tmp/shadow-score-go --sealed examples/03-critical-gaps/sealed-results.json \
--threshold 15 && exit 1 || exit 0