Run tests after every push
The core rule of Continuous Integration is to test every single change before integrating it with main line of code. With Buddy, you can easily configure a pipeline that automatically runs tests whenever a change is pushed to the repository.
Continuous Integration pipeline
Project setup
The first step is adding a project and attaching the Git repository that you want to test. Buddy features dedicated integrations with GitHub, Bitbucket, and GitLab, but you can easily add custom repositories from any server. If you wish to keep your CI/CD process in one place, you can host your projects directly on Buddy as well.
Image loading...Project configuration
Pipeline setup
Once the project is added and synchronized, you are ready to add your CI pipeline. If you want to test every change introduced to the repository, regardless if it's a branch, a tag, or a pull request, configure the pipeline as follows:
- Switch the trigger mode to the Git push event.
- Set the code scope to Wildcard.
- Set the wildcard match to
*
.
Image loading...Configuring wildcard
You can also limit the pipeline to specific refs. For example, if you want to limit it to branches, set the pattern to: refs/heads/*
.
Image loading...Adding new pipeline
Adding actions
After specifying when your pipeline should be triggered, you need to define what it should do. In this example, we'll add an action which installs dependencies and runs unit tests on the application. Buddy offers pre-configured test environments for all popular languages and frameworks:
Image loading...Build actions and task runners
Clicking a build action brings up its configuration details. Here you can specify the desired commands – in this case npm install
and npm test
:
Image loading...Build action with test ommands
As all actions in the pipeline share the same filesystem with repository files and artifacts, you can split the commands into two separate actions:
Image loading...Example pipeline
Conditional notifications
On top of the build actions, you can add a notification action that will send a message to your team in case the tests have failed. Buddy lets you send messages via e-mail or SMS, and integrates with a wide array of communication services, including Slack, Discord, MS Teams, and Telegram. To restrict notifications to failed runs only, switch to the On Failure tab and add the desired messaging action:
Image loading...On failure section
Expanding test range
With Buddy, you can automate not only unit tests, but also static analysis, end-to-end, integration and browsers tests, Selenium, and more. All you need to do is to extend your pipeline with proper actions. For example, adding the ESLint action will run a static analysis on your code:
Image loading...ESlint pipeline example
Sep 26, 2024