Additionally, enhancements have been made to the CLI orb, expediting the setup of your continuous integration (CI) process. In December, our initial partnership announcement with CircleCI introduced a new orb designed specifically to automate your CI setup using the Salesforce CLI.
Further enhancements to the CLI orb facilitate quicker CI setup.
In December of last year, we revealed our initial partnership with CircleCI through the introduction of a new orb, simplifying the establishment of automated CI using the Salesforce CLI. Throughout the past six months, our collaboration with CircleCI has persisted, culminating in the unveiling of a fresh orb specifically geared towards configuring an organization for Apex testing.
What exactly do orbs entail?
Orbs are reusable chunks of configuration that you can call as part of your DevOps pipeline and workflow. CircleCI maintains a registry of these sharable packages of configuration that they’ve built along with their partners and other individuals. This way, anyone using CircleCI can drop these repeatable configuration orbs into their CI/CD pipelines with ease.
We’ve been working with CircleCI to create orbs that are specific to Salesforce Development so that instead of each team starting from scratch writing their own configuration, teams can easily use best practices and repeatable code, with these Salesforce Orbs.
Our first orb [salesforce-sfdx] focused on setting up the CLI and getting your CI ready for automated testing. The second orb [salesforce-apex] focuses on getting your changes into a testing org and running your Apex tests.
The Orb for Salesforce Apex
The new Apex orb is focused on testing your Apex code. It utilizes common commands and workflows for testing Apex. This includes:
- Setting up a Scratch org for testing
- Deploying your metadata to your test Sandbox
- Running your Apex tests in your org
The orb is a sequel to the original CLI orb and picks up where that one left off.
We know that many of our users have more complex setups. What’s great about this orb is it allows you to use each command set alone. This means if you need to insert more complicated org setup or testing into your CI process, you can call individual sections of the orb and insert your extra steps in between. For teams with more straight forward Salesforce projects, you’ll be able to use an out-of-the-box job that creates, tests, and deletes a scratch org all in one go.
Updates to the Salesforce CLI orb
Our first orb did a little bit of everything. We noticed that it was mostly used for setting up your CI process with the Salesforce CLI and creating Scratch orgs, so we streamlined it to focus on those two themes. Now the salesforce-sfdx orb is focused on installing the CLI, authenticating to your devhub, and creating a scratch org (if scratch orgs are part of your testing process). Each of these actions can be used on its own from the orb or together.
The orb used to also include the deployment of metadata into the scratch org, but we’ve moved that to the Apex orb in an attempt to streamline the orgs and not include repeated behavior. Orbs can be used together in a single .yml file, so we felt it was better to split the orbs up by category.
Closing thoughts
To learn more about how to use these orbs, please see CircleCI’s blog post on the new Apex orb and the Salesforce CLI orb. We continue to try to bring our development community more access to modern CI/CD best practices and hope to make it easier for anyone developing on Salesforce to take advantage of automated testing. We will continue to work with CircleCI to bring more configuration… please let us know on Twitter or in the Trailblazer Community if there are other Orbs you’d like to see!