30 lines
846 B
Bash
Executable File
30 lines
846 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "$ROOT_DIR"
|
|
|
|
python3 - <<'PY'
|
|
from pathlib import Path
|
|
import re
|
|
|
|
root = Path('scripts')
|
|
entries = []
|
|
for path in sorted(root.glob('*.go')):
|
|
if path.name.endswith('_test.go'):
|
|
continue
|
|
text = path.read_text(encoding='utf-8')
|
|
if 'func main()' not in text:
|
|
continue
|
|
build_tag = text.splitlines()[0].strip() if text.splitlines() else ''
|
|
tests = []
|
|
candidate_test = path.with_name(path.stem + '_test.go')
|
|
if candidate_test.exists():
|
|
tests.append(candidate_test.name)
|
|
entries.append((path.name, build_tag, ','.join(tests) or '-'))
|
|
|
|
print(f'SCRIPT_ENTRY_SUMMARY total_entries={len(entries)}')
|
|
for name, build_tag, tests in entries:
|
|
print(f'{name}\tbuild_tag={build_tag}\ttests={tests}')
|
|
PY
|