Skip to main content

Overview

Dokrypt integrates with CI/CD pipelines so your smart contract tests run automatically on every push and pull request. The dokrypt ci generate command scaffolds workflow files for your CI provider.

Quick Start

GitHub Actions

Generate Workflow

This creates .github/workflows/dokrypt.yml:

What It Does

  1. Triggers on push to main/develop and on pull requests
  2. Installs Dokrypt via npm
  3. Runs dokrypt doctor to verify Docker is available
  4. Starts the full environment (dokrypt up)
  5. Runs all tests with JSON output for machine parsing
  6. Uploads test results as a build artifact
  7. Cleans up the environment even if tests fail

With Deployment

Adds a deploy-testnet job that runs after tests pass on the main branch. Requires these GitHub secrets:

GitLab CI

Generate Config

This creates .gitlab-ci.yml:
GitLab CI requires Docker-in-Docker (docker:dind) as a service since Dokrypt uses Docker to run blockchain nodes.

JSON Test Output

All CI workflows use --json output. The format:
Use this output to:
  • Fail builds on test failures (exit code is non-zero)
  • Track gas usage over time by comparing gas_report across commits
  • Generate reports in your CI dashboard

Validate Workflow

Check that your CI workflow file has the required steps:

Custom Pipelines

For CI systems not directly supported, use these commands in your pipeline:

Requirements

Most CI runners (GitHub Actions ubuntu-latest, GitLab shared runners) have Docker pre-installed. If yours doesn’t, use a Docker-in-Docker setup.

Gas Tracking Across Commits

Compare gas usage between commits by saving the JSON output:
Upload as an artifact to track gas changes over time. If gas increases significantly on a PR, it may indicate an optimization regression.