Custom CircleCI Steps for Candidate Application

Introduction

Our recent update introduces a feature for software testing using CircleCI. This feature allows software providers to define custom test steps for test pipeline that will during the workflow execution. This guide shows how to use this new feature to set up conditional steps for candidate application.

This guide is based on Feature Request: Custom CircleCI Configuration Injection for Test Harnessarchived requirements.

Prerequisites

Step-by-Step Guide

Step 1: Understanding the Conditional Steps

Custom steps are configured in the CircleCI pipeline and are executed before and after test execution for specific software. Condition for steps execution is based on the software's name.

Step 2: Identify Your Software's Custom Test Requirements

Determine what specific tests or steps you want to execute exclusively for your software. These could be additional setup commands, environment configurations, or specific test scripts.

Step 3: Define Your Custom Steps

Create a circle_config.yml file in your software’s directory (/examples/app-name directory). In this file, define the steps you want to execute under two sections:

  • before: Steps to run before the standard test suite.

  • after: Steps to run after the standard test suite.

Example Format:

yaml
before: - run: name: Custom Setup command: ./custom_setup.sh after: - run: name: Custom Teardown command: ./custom_teardown.sh

Step 4: Push Changes to BB Repository

After setting up your circle_config.yml, commit and push the changes to repository and create PR. The CircleCI pipeline will automatically detect and integrate these custom steps based on your software's name.

Step 5: Monitor Your Pipeline

Once your changes are pushed, monitor the CircleCI pipeline for your software. Verify that the conditional steps are executed as expected.

Best Practices

  • Keep your custom steps minimal and focused.

  • Collaborate with your team to ensure consistency across different software projects.

Troubleshooting

  • If your custom steps are not executing, check the spelling and path of app-name in your configuration.

  • Review the CircleCI pipeline logs for any errors or warnings related to the conditional steps.

  • Ensure that the circle_config.yml file is correctly formatted and located in the right directory.

Conclusion

This new feature enhances your ability to run tailored tests for different software projects within the same pipeline. By following the above steps, you can efficiently integrate custom testing steps, ensuring that your software is tested thoroughly and effectively.