CI/CD
Delivery Hub follows Salesforce's recommended development model: source-driven development with scratch orgs, automated testing, and continuous integration via CumulusCI and GitHub Actions.
Development Workflow
Every pull request gets its own scratch org. Tests run automatically. If they pass, the PR is ready for code review.
Developer creates a feature branch from main.
GitHub Actions spins up a fresh scratch org and deploys the branch.
All 73 Apex test classes (650+ tests) run automatically. Code coverage is reported.
PR is reviewed by the team. The scratch org is available for manual QA.
After approval, the branch merges to main. The scratch org is deleted.
Main branch is deployed to the packaging org and a new version is created.
CumulusCI Setup
Delivery Hub uses CumulusCI (CCI) for build automation. CCI provides tasks for creating scratch orgs, deploying metadata, loading data, and running tests.
Key CCI Tasks
| Task | Description |
|---|---|
| cci flow run dev_org | Creates a scratch org, deploys source, loads sample data. |
| cci flow run ci_feature | CI flow: create scratch org, deploy, run all tests, report coverage. |
| cci flow run ci_master | Main branch flow: deploy to packaging org, create beta version. |
| cci task run run_tests | Run all Apex tests in the connected org. |
| cci task run dx_push | Push source to the default scratch org. |
| cci flow run demo_org | Provisions a fully configured scratch org with sample data, pre-built workflows (Software Delivery + Loan Approval), example invoices with version history, populated dashboards, saved filters, and configured platform events. Ideal for evaluations, training, and conference demos. Requires a Dev Hub. |
GitHub Actions
The repository includes GitHub Actions workflows that automate the entire CI pipeline. Workflows are stored in .github/workflows/.
Workflow: Feature Branch
Workflow: Main Branch
Scratch Org Per PR
Each pull request automatically gets a dedicated scratch org. This ensures:
- Tests run in a clean environment every time
- Reviewers can log into the scratch org for manual QA
- No conflicts between concurrent feature branches
- Scratch orgs are automatically deleted when the PR is merged or closed
Apex Tests
Delivery Hub includes 73 Apex test classes with 650+ tests covering:
- •Unit tests — individual methods and utility classes
- •Trigger tests — all object triggers with bulk data scenarios
- •Integration tests — sync engine, REST endpoints, callout mocks
- •LWC tests — Jest tests for all Lightning Web Components
Code coverage is verified at 89%+ across the entire codebase. Tests are run automatically on every PR via GitHub Actions, alongside PMD static analysis that scans all Apex code for code quality issues, security vulnerabilities, and best-practice violations.
PMD Static Analysis
Every pull request runs PMD (an open-source static analysis tool) against all Apex classes. PMD catches issues that unit tests alone cannot:
- •Code quality — unused variables, empty catch blocks, overly complex methods
- •Security — CRUD/FLS violations, SOQL injection risks, hardcoded credentials
- •Best practices — governor limit patterns, bulkification, trigger handler patterns
- •Performance — SOQL inside loops, unnecessary database queries, inefficient collection usage
PMD runs as a separate GitHub Actions step. Violations fail the build and must be resolved before merge. This ensures consistent code quality across all 225 Apex classes.
Related
- Architecture — data model and system design
- GitHub Repository — browse source code and workflows