CI/CD Pipeline Quality Gates and Release Checks
ACF quality becomes scalable only when schema and hook checks run automatically in every release pipeline.
You will design CI/CD gates that validate acf-json, run hook tests, and enforce smoke checks before and after deployment.
Concept Overview
CI/CD quality gates for ACF should validate three layers: schema integrity, behavior integrity, and release integrity. Schema integrity checks JSON syntax and expected field artifacts. Behavior integrity runs hook tests. Release integrity confirms critical editor and frontend workflows after deploy.
Ship ACF changes only when schema, hook behavior, and smoke checks all pass in the same pipeline.
Why It Matters
Manual release checks cannot keep pace with frequent field and hook changes in multi-developer teams.
| Approach | What Happens | Business Impact |
|---|---|---|
| Enforce automated pipeline gates | Regressions are caught before publish impact | Higher release confidence |
| Rely on ad-hoc release verification | Important checks are skipped under time pressure | Increased outage probability |
| Define rollback trigger thresholds | Incident response is fast and consistent | Reduced downtime window |
Reference Table
| Term | Meaning | Where You Use It | Fast Check |
|---|---|---|---|
| Schema Gate | Automated check validating ACF JSON structure and expected files | CI pull-request stage | Invalid or missing schema artifacts fail the build |
| Hook Test Gate | Automated test job for ACF filters/actions | CI test stage | All critical hook tests must pass |
| Smoke Check | Fast post-deploy verification of top workflows | Staging and production deploy jobs | Checklist reports pass/fail status with timestamps |
| Rollback Trigger | Defined condition requiring rollback | Release operations playbook | Trigger thresholds are documented and actionable |
Practical Use Cases
Use Case 1: GitHub Actions pipeline for ACF schema and hook tests
A distributed team needs consistent quality gates across every pull request.
- Add a schema job that validates all
acf-json/*.jsonfiles parse correctly. - Add a test job that runs hook-focused PHPUnit suites.
- Block merge when any schema or hook gate fails.
- Publish artifact logs for failed checks to speed triage.
Validate this state through code and CLI checks: Show PR checks page with separate schema and hook-tests jobs.
name: acf-quality
on:
pull_request:
push:
branches: [main]
jobs:
schema:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate acf-json files
run: |
python3 - <<'PY'
import json
from pathlib import Path
for f in Path('acf-json').glob('*.json'):
json.loads(f.read_text())
print('acf-json schema files valid')
PY
hook-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run hook test suite
run: vendor/bin/phpunit --testsuite=acf-hooks
acf-json schema files valid
OK (24 tests, 98 assertions)
Use Case 2: Post-deploy smoke gate with rollback threshold
Production releases must verify key edit flows and critical pages within 15 minutes.
- Run smoke script after deployment against one representative record per critical field group.
- Check admin save flow and frontend render response for each sample.
- Trigger rollback automatically when two or more critical checks fail.
- Notify release owner and content lead with failed checkpoint details.
Validate this state through code and CLI checks: Capture release dashboard showing smoke status and rollback decision.
#!/usr/bin/env bash
set -euo pipefail
echo "Checking critical page render"
curl -fsS "https://docs.example-site.com/landing/enterprise-onboarding" >/dev/null
echo "Checking API payload"
curl -fsS "https://docs.example-site.com/wp-json/wp/v2/pages/1204" >/dev/null
echo "ACF smoke checks passed"
Checking critical page render
Checking API payload
ACF smoke checks passed
Common Mistakes
| Mistake | What Happens | Better Approach |
|---|---|---|
| Running CI checks without fixture seeding | Tests pass in CI but fail in staging reality | Seed representative fixtures before hook tests |
| Treating smoke checks as optional | Broken flows reach editors and visitors | Make smoke failures block production promotion |
| No rollback trigger criteria | Teams debate during active incidents | Define objective rollback thresholds in advance |
Best Practices
- Keep CI gates fast enough to run on every pull request without developer bypasses.
- Separate schema validation and hook behavior tests for clearer failure triage.
- Use environment-specific smoke check targets and sample records.
- Store rollback triggers and owners in versioned release documentation.
- Review gate effectiveness monthly using incident and near-miss data.
Hands-On Practice
- Add one schema-validation gate for
acf-jsonfiles in your CI pipeline. - Configure one hook test suite gate and fail merge on test errors.
- Write a post-deploy smoke checklist with explicit rollback thresholds.
What's Next
- Continue to Module 10 Lesson 1: Registering Options Pages in Code.
- Review this module context in Module 9 Overview.
- Related lesson: Migration, Versioning, and Rollback Playbooks.