This pipeline demonstrates how you can build a pull request validation pipeline using scratch orgs. The intent of this pipeline is to validate a pull/merge request into the integration branch upon completion of a feature branch by developers. This is a YAML based multi stage pipeline to demonstrate how sfpowerscripts could be used to configure in YAML Azure DevOps pipeline.
This pipeline is triggered on every pull request raised against a develop/master branch depending on your git flow.
You can import and modify this pipeline using the file provide in the link
The stages that are part of this pipeline and corresponding tasks are (in the exact order)
- Static Code Analysis
- Unit Test
- CI Package Test
- Install SFDX CLI
- Authenticate an Org (In this case, it is authenticating against DevHub)
- Create/Delete a scratch org (Action: Create)
- Create a new version of SFDX Unlocked Package
- Install an Unlocked Package to an Org
- Trigger Apex Tests in the scratch org
- Validate the apex test coverage in the org
- Create/Delete a scratch org (Action: Delete)
This pipeline need to be enabled only with PR triggers, CI triggers for pipeline should be disabled. Follow this documentation to enable this PR trigger using this link