Skip to content
CCPEDIAby Unity Nodes
App Development

Spin up a full Canton LocalNet in your GitHub Actions CI, in one step

2 posts78 views1 likesLast activity 12d ago

  1. matthieuOP

    If you write integration tests against Canton, you’ve probably hit the same wall we did: getting a real ledger running in CI takes a lot of setup. So we packaged our open-source Canton LocalNet as a GitHub Action. Add one step and your tests run against a full Splice LocalNet (Canton 3.7.3, Splice 0.10.2), with nothing to install by hand.

    It’s language-neutral: your tests just get URLs and OAuth2 credentials as environment variables, so Rust, TypeScript, Java, Go or .NET all work the same.

    Here’s the minimal workflow:

    jobs:
      integration:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v7
    
          - name: Boot LocalNet
            uses: peacefulstudio/canton-localnet@v0.10.2-1
    
          - name: Run your tests
            run: your-test-command
    
          - name: Tear down
            if: always()
            uses: peacefulstudio/canton-localnet/teardown@v0.10.2-1
    
    

    After the boot step, your tests find the JSON Ledger API URL, gRPC URL, token URL, client id and client secret in CANTON_LOCALNET_A_VALIDATOR_1_* variables. The secret is masked in logs.

    A few more things it does:

    • Up to four validator participants (validators: a,b,c,d), each with its own Keycloak realm
    • PQS on request (pqs: true), with a ready-made postgresql:// URL for your client
    • canton-localnet tap --slot a --amount 10 funds a party with Amulet in one step
    • If the boot fails, the step log names the container that stalled

    The latest release, v0.10.2-1, moves to Splice 0.10.2 and Canton 3.7.3. Ports, env var names and auth are unchanged, so upgrading is a one-line tag bump. Since v0.10.1-2, a boot on a tight runner also survives the self-healed Splice restart that used to fail it, and leaves a warning in the log instead.

    It’s already used outside our own repos: the Canton Rust SDK runs its LocalNet test suite on it on a nightly schedule.

    A couple of practical notes: LocalNet needs about 4 vCPU and 16 GB, which the standard ubuntu-latest runner of a public repo has. For a private repo, use a larger runner. It’s tested on Linux x86_64 only.

    Full docs, including how to pin the full commit SHA for supply-chain hardening here.

    Questions or feedback are very welcome here, or open an issue on the repo.
    Happy testing!

  2. Jatin_Pandya_cf

    this is good, maybe add in https://dev-hub.canton.foundation/??