Continuous Integration
Vortex offers continuous integration configurations for GitHub Actions and CircleCI providers that allow you to automate the process of building, testing, and deploying your site.
The workflow configuration is identical for both continuous integration providers. You would need to choose one of them and follow the setup instructions.
The continuous integration pipeline consists of multiple jobs executed in a
drevops/ci-runner container to ensure
consistency across runs.
Workflow structure
Local Development
═════════════════════════════════════════════════════════════════════ ════════════════════
Developer writes code ──► Build and test locally ──► Commit changes
│
▼
Git Repository
═════════════════════════════════════════════════════════════════════════════════════════
Push to remote branch ──► Open/Update Pull Request
│
▼
┌─ CI Pipeline ────────────────────────────────────────────────────────────────────────────┐
│ │
│ ┌─ Database Job (Nightly) ───────────────────────────────────────────────────────────┐ │
│ │ │ │
│ │ Scheduled ──► Download production ──► Sanitize database ──► Store database cache │ │
│ │ trigger database Remove sensitive data │ │
│ │ │ │
│ └─────────────────────────────────────┬──────────────────────────────────────────────┘ │
│ │ Provides cached database │
│ ▼ │
│ ┌─ Lint Job ────────────┐ ┌─ Database Job ──────────────────────────────────────────┐ │
│ │ │ │ │ │
│ │ Build CLI container │ │ ◆ Nightly cache ──Yes──► Pipeline Success │ │
│ │ ▼ │ │ exists? │ │
│ │ Composer validate │ │ │ No │ │
│ │ ▼ │ │ ▼ │ │
│ │ Composer audit │ │ Download ──► Sanitize ──► Store database │ │
│ │ ▼ │ │ production database cache │ │
│ │ Composer normalize │ │ database Remove │ │
│ │ ▼ │ │ sensitive data │ │
│ │ Hadolint │ │ │ │
│ │ ▼ │ └───────────────────────────┬─────────────────────────────┘ │
│ │ DCLint │ │ │
│ │ ▼ │ ▼ │
│ │ PHPCS │ ┌─ Build Job ────────────────────────────────────────────┐ │
│ │ ▼ │ │ │ │
│ │ PHPStan │ │ Code assembly │ │
│ │ ▼ │ │ Build Docker ──► Composer deps ──► NPM deps ──► Assets│ │
│ │ Rector │ │ │ │ │
│ │ ▼ │ │ ▼ │ │
│ │ Twig CS Fixer │ │ Website setup │ │
│ │ ▼ │ │ Import cached DB ──► drush deploy ──► Custom scripts │ │
│ │ Gherkin Lint │ │ │ │ │
│ │ ▼ │ │ ▼ │ │
│ │ ESLint / Stylelint │ │ Testing │ │
│ │ │ │ PHPUnit tests ──► Behat tests │ │
│ │ │ │ │ │
│ │ │ └────────────────────────────┬───────────────────────────┘ │
│ └──────────┬────────────┘ │ │
│ │ │ │
│ │ │ │
│ │ │ │
│ ▼ ▼ │
│ ┌─ Deployment Job ─────────────────────────────────────────────────────────────────┐ │
│ │ │ │
│ │ Webhook Artifact Lagoon Docker │ │
│ │ Call URL Package artifact Call Lagoon webhook Create container image │ │
│ │ │ │
│ └──────────────────────────────────────────────────────────────────────────────────┘ │
│ │
└──────────────────────────────────────────────────────────────────────────────────────────┘
│
▼
Hosting Platform
═════════════════════════════════════════════════════════════════════════════════════════
◆ Environment ──No──► Sync DB from production ───┐
exists? │
│ Yes ▼
└──────────────────────────────────► drush deploy ──► Custom scripts ──► Notifications
Available Environments
═════════════════════════════════════════════════════════════════════════════════════════
┊ PR Environment ┊ Dev Staging Production
┊ (auto-removed) ┊ develop branch main branch production branch or tag
1. Lint
- Runs in parallel with other jobs (no dependencies)
- Builds only the CLI container (no database or other services needed)
- Validates Composer configuration
- Lints Dockerfiles and Docker Compose files
- Installs development dependencies
- Runs all code linters: PHPCS, PHPStan, Rector, Twig CS Fixer, Gherkin Lint, ESLint, Stylelint
- Audits and normalizes Composer packages
2. Database
- Downloads the latest DB version based on a caching strategy
- Caches database dumps to speed up the follow-up runs
3. Build
- Runs after the
databasejob - Uses Docker Compose to set up the full environment
- Validates Composer configuration
- Assembles the codebase by installing dependencies
- Provisions a website
- Runs PHPUnit tests (first instance only)
- Checks code coverage and posts PR comment (first instance only)
- Runs BDD tests (distributed across all instances)
- Collects and stores test results and artifacts
4. Deployment
- Runs after successful completion of both
buildandlintjobs - Uses the built codebase without development dependencies from the
buildstep - Adds required secrets and environment variables
- Triggers a deployment using a router script
Caching strategy
Database is downloaded overnight and cached so that the next continuous integration run on the same day uses the cached database dump.
By default, the database is cached per-branch for 24 hours. If cache is not available, the fallback default branch is used.
Database caching is a very powerful feature that allows to speed up the continuous integration runs on large projects with a lot of data.
In case of a project with a large database >1GB, the database import itself may take a long time, so it may be worth looking into either packaging the database dump into a container image (overnight) or using a sanitized database dump with only the required data for the tests.
Vortex supports both creating and using a database container image with embedded data. You may use MariaDB data container for Drupal with database captured as Docker layers to create an initial database image.
There are other tools also available for this purpose, such as Drush GDPR Dumper that allows to remove data from the database dump during Drush database export command without the need for an intermediate database import step.