Files

28 lines
746 B
Bash
Executable File

#!/bin/sh
set -eu
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
cd "$root"
buf lint
buf build --error-format=json >/dev/null
buf generate
go test ./gen/agent/v1
python3 - <<'PY'
from hashlib import sha256
from pathlib import Path
import json
root = Path('.')
manifest = json.loads((root / 'proto/manifest.json').read_text())
for entry in manifest.get('files', []):
path = root / entry['path']
if not path.is_file():
raise SystemExit(f'missing Proto manifest file: {entry["path"]}')
digest = sha256(path.read_bytes()).hexdigest()
if digest != entry['sha256']:
raise SystemExit(f'Proto manifest hash mismatch: {entry["path"]}')
print(f'proto manifest verified: {len(manifest.get("files", []))} files')
PY