A CI/CD pipeline for Canton applications follows the same structure as any other software project: build, package, test, deploy. The Canton-specific parts are theDocumentation Index
Fetch the complete documentation index at: https://docs.canton.network/llms.txt
Use this file to discover all available pages before exploring further.
dpm commands for compiling Daml, running Script tests, and managing DAR artifacts.
Pipeline Structure
A typical pipeline has four stages:- Build — Compile Daml code and generate client bindings
- Package — Produce deployable artifacts (DARs, container images)
- Test — Run Daml Script unit tests and backend integration tests
- Deploy — Upload DARs and deploy off-ledger services to the target environment
Build Stage
The build stage compiles your Daml packages and generates code bindings for your backend and frontend.dpm build in the root directory builds all packages in dependency order when a multi-package.yaml is present.
Build caching
DAR compilation is deterministic: the same source code and SDK version produces the same DAR. Cache the.daml/dist/ directory between CI runs to skip recompilation when Daml source hasn’t changed. Most CI systems (GitHub Actions, GitLab CI, Jenkins) support caching by file hash.
Test Stage
Daml Script tests
Script () declarations in your test package against the Sandbox. If any assertion fails, dpm test exits with a non-zero code and the pipeline fails.
For projects with separate test packages, run dpm test from each test package directory, or use a multi-package.yaml that includes the test packages.
Backend integration tests
After Daml tests pass, run your backend’s integration tests against a sandbox:Package Stage
DAR artifacts
The.dar files produced by dpm build are your primary Daml artifacts. Store them in your CI artifact repository (Artifactory, Nexus, S3, or the CI system’s built-in artifact storage) with version metadata.
A naming convention that includes the version simplifies tracking:
version field in daml.yaml. Use environment variable interpolation to set it from your CI pipeline:
Container images
If your backend and frontend are containerized, build and tag images in this stage. Include the DAR as an embedded artifact or mount it at deployment time.Deploy Stage
Deployment to each environment involves two parts: uploading the DAR to the validator and deploying off-ledger services (backend, frontend, PQS).DAR upload
Upload your DAR to the target validator through the participant’s HTTP Ledger API:Environment promotion
Use your CI system’s environment or stage abstractions to gate promotions. A common pattern:- Pushes to
maindeploy to DevNet automatically - A manual approval gate promotes from DevNet to TestNet
- Another manual gate promotes from TestNet to MainNet
Example: GitHub Actions
Monitoring CI Health
Regularly review logs during development and testing, such as by capturing logs in CI runs and using them for debugging CI failures. Set up alerts on metrics to monitor the application’s health during testing and development. This ensures operational reuse and integration into the long-running test instance. Well-tuned alerts established during development can be reused in operations to detect system health issues.Next Steps
- Testing Strategies — Testing pyramid and approach details
- Environment Configuration — Per-environment configuration management
- Deployment Progression — What to verify at each promotion stage