Skip to content

Commit e403866

Browse files
committed
Add comprehensive build validation checks
Added two new validation steps to catch build issues early: 1. YAML frontmatter validation: Parses YAML in all source/*.md files and fails if any frontmatter is malformed. Would have caught the broken toc_footers that caused the recent documentation outage. 2. Build content verification: Validates that build/index.html: - Is larger than 100KB (catches incomplete builds) - Contains API resource documentation (resource-donation, etc.) - Includes webhooks documentation - Has all expected resources (donation, fundraiser, project, etc.) These checks run on every push via the verify workflow, preventing broken builds from being deployed.
1 parent e335c81 commit e403866

1 file changed

Lines changed: 73 additions & 0 deletions

File tree

.github/workflows/_build.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,76 @@ jobs:
3535
test -f source/schema.json || (echo "source/schema.json not found" && exit 1)
3636
test -f source/includes/resources.md || (echo "source/includes/resources.md not found" && exit 1)
3737
echo "All required build artifacts present"
38+
39+
- name: Validate YAML frontmatter
40+
run: |
41+
echo "Validating YAML frontmatter in source files..."
42+
ruby -e "
43+
require 'yaml'
44+
errors = []
45+
Dir.glob('source/**/*.md').each do |file|
46+
content = File.read(file)
47+
if content.start_with?('---')
48+
# Extract frontmatter
49+
parts = content.split(/^---\s*$/, 3)
50+
if parts.length >= 3
51+
frontmatter = parts[1]
52+
begin
53+
YAML.load(frontmatter)
54+
puts \"✓ #{file}\"
55+
rescue => e
56+
errors << \"#{file}: #{e.message}\"
57+
puts \"✗ #{file}: #{e.message}\"
58+
end
59+
end
60+
end
61+
end
62+
if errors.any?
63+
puts \"\nYAML validation failed for #{errors.length} file(s)\"
64+
exit 1
65+
else
66+
puts \"\nAll YAML frontmatter is valid\"
67+
end
68+
"
69+
70+
- name: Verify build content
71+
run: |
72+
echo "Verifying build/index.html contains expected content..."
73+
74+
# Check file size (should be > 100KB)
75+
SIZE=$(wc -c < build/index.html)
76+
if [ "$SIZE" -lt 100000 ]; then
77+
echo "ERROR: build/index.html is only ${SIZE} bytes (expected > 100KB)"
78+
echo "This suggests the build is incomplete or includes were not processed"
79+
exit 1
80+
fi
81+
echo "✓ File size: ${SIZE} bytes"
82+
83+
# Check that API resources are included
84+
RESOURCES=$(grep -c "resource-donation" build/index.html || echo "0")
85+
if [ "$RESOURCES" -lt 5 ]; then
86+
echo "ERROR: build/index.html missing API resource documentation"
87+
echo "Expected multiple occurrences of 'resource-donation', found ${RESOURCES}"
88+
exit 1
89+
fi
90+
echo "✓ API resources included (found ${RESOURCES} references)"
91+
92+
# Check that webhooks documentation is included
93+
if ! grep -q "Webhooks" build/index.html; then
94+
echo "ERROR: build/index.html missing webhooks documentation"
95+
exit 1
96+
fi
97+
echo "✓ Webhooks documentation included"
98+
99+
# Verify specific resources are present
100+
EXPECTED_RESOURCES="resource-donation resource-fundraiser resource-project resource-team resource-organisation"
101+
for resource in $EXPECTED_RESOURCES; do
102+
if ! grep -q "$resource" build/index.html; then
103+
echo "ERROR: Missing expected resource: $resource"
104+
exit 1
105+
fi
106+
done
107+
echo "✓ All expected API resources present"
108+
109+
echo ""
110+
echo "Build verification passed!"

0 commit comments

Comments
 (0)