Configuration

Parallel Builds

By default, all builds in a project are run in sequence. This means that builds will wait in the Pending state for all previous builds to finish before running. This ensures there is no overlap during build steps. To disable this, specify the parallel: true key in the root of your project's torchci.yml file, or by manually enabling this in project's settings in Torch UI:

parallel: true
build:
    - 'composer install'
    - 'npm install'
    - 'npm run production'
    - 'phpunit'

This instructs Torch to not wait previous builds to finish but rather run them immediately. Keep in mind that build steps in each build are always executed in order, never in parallel.

Overlaps in Build Steps

To avoid overlaps in a build pipeline while parallel builds are enabled, read the section on Parallelism in Build Pipeline.

Restrictions

By default, Torch will run a build for every single commit pushed to the repository. You may configure the project restrictions to only build certain branches. To accomplish this, define list of whitelisted branches from the project's settings page in Torch UI.

To define these restrictions via the YAML configuration, define only key in the root of the torchci.yml file with a list of branches you wish to restrict to. You may use the * as a wildcard.

build:
    - 'composer install'
    - 'npm install'
    - 'npm run production'
    - 'phpunit'
only:
    - master
    - features/*

Alternatively, you may also use the except key to instruct Torch to ignore certain branches.

build:
    - 'composer install'
    - 'npm install'
    - 'npm run production'
    - 'phpunit'
except:
    - features/*

Ignoring certain commits

To instruct Torch to not build specific commits, add one of the following triggers to the commit message: [skip ci], --skip-ci, --ci-skip, [ci skip].

Build Hooks

When the build successfully ends, Torch can send an HTTP request to the URL of your choice. This feature is called a 'build hook'. If you're deploying your applications using webhooks with service like Envoyer (opens new window), this makes it very easy to deploy your application. Adding build hooks can be done via the project settings, or by adding hooks key in your project's torchci.yml file with a list of URLs that Torch should send HTTP request to.

build:
    - 'composer install'
    - 'npm install'
    - 'npm run production'
    - 'phpunit'
hooks:
    - 'https://envoyer.io/deploy/my-envoyer-token'

It's important to know that Torch only fires build hooks only after each successful build.

Advanced Configuration

Alternatively, you may provide an object of options for each build hook definition to do more customization and configuration, like naming of a hook and hook's restrictions.

When using the key-value format, be sure to add the url key to define a hook URL. See an example below:

build:
    - 'composer install'
    - 'npm install'
    - 'npm run production'
    - 'phpunit'
hooks:
    - name: Deploy the application
      url: 'https://envoyer.io/deploy/my-envoyer-token'

Usually, you only want to fire build hooks only on certain branches. For example, you want to deploy the production only when master branch is pushed to. To configure hook restrictions, add the only or except keys to the hook definition with a list of branches you wish to restrict to.

build:
    - 'composer install'
    - 'npm install'
    - 'npm run production'
    - 'phpunit'
hooks:
    - name: Deploy the application
      url: 'https://envoyer.io/deploy/my-envoyer-token'
      only:
        - master
    - name: Ping Webhooks
      url: 'https://webhooks.site/random-it'
      except:
        - develop
        - features/*

Environment Variables in Hooks

To use environment variables when defining a build hook URL, use simple environment variable syntax: ${ENV_VAR} or $ENV_VAR. Torch will read these from your project's environment variables. For example: https://envoyer.io/deploy/${ENVOYER_TOKEN}

Hook Payload

When Torch fires a build hook, it sends a payload with build details, like build status, ID of the build and more. The following is the JSON example of the payload that Torch sends:

{
    "build": "c6e8a43c-8db8-49e5-887d-1b563682c11c",
    "branch": "master",
    "sha": "124567890...",
    "sha_short": "1234567",
    "status": "finished|failed|timeout",
    "started_at": "2020-05-03 21:53:02",
    "finished_at": "2020-05-03 21:57:25"
}

Composer Authentication

Torch allows you to authenticate against providers of Composer private packages. Authenticating Composer package can only be done from the Torch UI and is as simple as entering the repository URL and username and password / token.

Security

All Composer package authentication details are always encrypted using secure two-way encryption, so Torch never stores any sensitive data in a raw, unencrypted format.

As a very common task, Torch offers an integration with Laravel Nova (opens new window). By choosing "Laravel Nova" from the repository type and entering your Laravel Nova's email address and API token, Torch will automatically configure Composer to be able to pull down the laravel/nova dependency.

Private GitHub repositories

If the project is using GitHub as its source provider, Torch will configure Composer to authenticate GitHub with user's OAuth2 token. This allows your application to download any private Composer packages that are obtained through the private GitHub repository without needing to manually authenticate.