Build Triggers in your Yaml

June 28th, 2022

Chipper CI is continuous integration, just for Laravel. Give it a try - free!

Control When Builds are Run

We added Build Triggers to the .chipperci.yml file (the new on: section).

For those using the .chipperci.yml file, this new ability replaces Build Restrictions found in project settings. You can now define what triggers a CI build!

Here's what it looks like:

version: 1

on:
  pull_request:
    branches: .*
  push:
    branches:
      - develop
      - main

# blah blah blah
environment:
services:
pipeline:

The above example tells Chipper to run builds on any new/updated pull request, or any commit on branch develop or main.

In addition to pull_request and push, you can also define what tags will trigger a build (e.g. "tags starting with v").

The ability to control builds based on pull_request is new - we didn't have that ability previously. It works similarly across GitHub, GitLab, and BitBucket.

Examples

The docs go into more details about how the build triggers work, but here are some examples!

Build All Commits

on:
  push:
    branches: .*

Only Build Certain Branches

Only build commits to branches main and develop.

on:
  push:
    branches:
      - main
      - develop

Building PRs and Tags

Maybe you want to build only certain PR's, and tags that start with v?

on:
  pull_request:
    branches:
      - feature/.*
      - bug/.*
  tags:
   - v.*

Why this feature?

Based on feedback, we knew we needed to expand on the ability to control build triggers. Changing pricing to a usage-based billing model made this feature even more important.

So, we made it, and made it more flexible than the previous "build restrictions" feature!

This gives better control based on branches, pull requests, and building when tags are used.

A few nits

You may have some questions about specifics. The docs cover these, but here's the highlights:

  1. It's backwards-compatible, so if you do not have a on: section in your .chipperci.yml file, all commits will get built (rather than none of them).
  2. However if you use a .chipperci.yml file, the project settings "Build Restrictions now get ignored.
  3. If you do not use a .chipperci.yml file, then project settings “Build Restrictions” are still used
  4. You can use any regular expression that works with preg_match_replace(). This also means that wildcards * won't work - you need the regex .* instead.
Try out Chipper CI!
Chipper CI is the easiest way to test and deploy your Laravel applications. Try it out - it's free!