Arbitrary Workflows with Dependencies between Nodes

Scrutinizer allows you to create arbitrary workflows. In the typical case, you can use that to run deployment at the very end after all your tests have passed and no failure conditions were met during the analysis.

You can also use dependencies between nodes to run some heavy compilation on a single node, cache the result and then run tests on the compiled artifacts on various following nodes in parallel.

Config

Each node can declare requirements which all have to be satisfied before the node can be started:

build:
  nodes:
    some-node:
      requires:
        - node: other-node       # all commands in the node have to be successful
        - branch: master         # only runs when the branch is "master"
        - is_pull_request: true  # only runs on pull-requests
        - is_pull_request: false # only runs on non-pull-requests (pushes/tags/manual)
        - analysis               # no failure conditions must be met in the analysis

Examples

Deployment

For deployment, please see our dedicated deployment guide.

Splitting Compilation and Testing

In the example below, we will run compilation with a high number of CPUs and the following tests runs split across multiple nodes in parallel with less resources each. When all tests pass, the code is deployed:

build:
  nodes:
    compile:
      resources:
        cpus: 8

      commands:
        - checkout-code ~/code
        - (cd ~/code && ./compile)
        - store-in-cache execution compile-result ~/code

    tests-1:
      requires:
        - node: compile

      commands:
        - restore-from-cache execution compile-result
        - ./code/tests-1

    tests-2:
      requires:
        - node: compile

      commands:
        - restore-from-cache execution compile-result
        - ./code/tests-2

    deploy:
      requires:
        - node: /tests-\d+/
        - branch: master

      commands:
        - restore-from-cache execution compile-result
        - ./code/deploy

Your can learn more about caching in your dedicated caching guide.