Skip to content

Instantly share code, notes, and snippets.

@alpcanaydin
Created November 29, 2019 13:13
Show Gist options
  • Save alpcanaydin/05955ef6c84517d9762b68bb7e8072cf to your computer and use it in GitHub Desktop.
Save alpcanaydin/05955ef6c84517d9762b68bb7e8072cf to your computer and use it in GitHub Desktop.

SquareCI

It is a command tool that runs given steps on given docker image.

Usage: squareci [options]

Options:

  -c, --config  Config file to read. It can be a valid yml or json file.
                It it is not provided command tries to read .squareci.yml file or
                .squareci.json file in current working directory. If none of them
                have been provided then it raises an error.

  -p, --path    Current working dir. The folder that mounted to the docker
                container. If it is not provided then cwd is used.

Configuration File Syntax

YAML Notation: .squareci.yaml

image: node:latest

runInParallel: true
exitOnFailure: true

before:
  - name: Build
    run: yarn build

steps:
  - name: Lint
    run: yarn lint

  - name: Format Check
    run: yarn format:check

  - name: Unit Tests
    run: yarn test

after:
  - name: Notify!
    run: echo 'Everything is done'

JSON Notation: .squareci.json

{
  "image": "node:latest",
  "runInParallel": true,
  "exitOnFailure": true,
  "before": [{ "name": "Build", "run": "yarn build" }],
  "steps": [
    { "name": "Lint", "run": "yarn lint" },
    { "name": "Format Check", "run": "Format Check" },
    { "name": "Unit Tests", "run": "yarn test" }
  ],
  "after": [{ "name": "Notify", "run": "echo 'everything is done'" }]
}

Config Specifications

image string,

Docker image name. You can find more detailed info from here.

runInParallel boolean, Default: false

Whether steps can be run in parallel. If it is true then steps stage are executed in parallel mode. Otherwise, squareci will run them step by step.

exitOnFailure boolean, Default: true

If it is set to true then program stops on first failure regardless it is in parallel mode or not. Otherwise it runs all steps even there is an error in a step.

before Array<Task>

All tasks in here runs right before steps execution. If it is an error on this stage, command doesn't run steps.

steps Array<Task>

Tasks to run in docker container.

after Array<Task>

All tasks in here runs right after steps execution.

Determination of success

If the given task returns stderr then it is failed. If there is no error then it can be assumed as succeeded.

Example Output

Example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment