Generic, unopiniotated, cross-platform, language/CI-agnostic build configuration file with own DSL
hey! do not take this seriously, work in progress
.buildrc
aims to be a general purpose build configuration file who can be used from any
continuous integration server
A complete buildrc
example file, using the buildspec
language
# this is an in-line comment
before:
script:
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make
end
end
requirements:
satisfies:
make
redis
nodejs@~0.10.0
end
end
env:
set: PATH /opt/node/bin:${PATH}
unset: NODE_PATH
end
task: test
before:
run: npm install
end
after:
copy: build/ ../build-$[date('Ymd-hms')]
run: npm clean
end
workdir: ${TEMP}/build
timeout:
task: 1000
global: 10000
end
run: redis-server
run: node app.js
events:
error:
run: echo 'Cannot run the task (${CODE}): ${ERROR}' >> error.log
end
success:
run: pidof node | kill -SIGTERM
end
timeout:
run: echo 'Timeout exceded for ${TASK}' >> error.log
end
end
end
Buildspec is a minimalist DSL created to be used in buildrc
configuration files
Type: block
Scope: global|task
Define pre-task execution requirements
Type: block
Scope: global
Register a callable task
Type: set|unset
Scope: global|local
Set/unset environment variables
Type: assignment
Scope: env
Create and set a variable value
Type: assignment
Scope: env
Unset a variable
Type: string
Scope: global|local
Set a working directory
Type: command
Scope: global|local
Run a command as isolated statement with own DSL support and evaluate the exit code. Supports pipes, redirects and standard command sentences
Type: string
Scope: global|local
Run a bash/batch script and evaluate the exit code. No Buildspec expressions are supported in this configuration block
Type: copy block
Scope: local
A file system command helper to copy files or directories
Type: block{remove}
Scope: local
A file system command helper to move files or directories
Type: block{remove}
Scope: local
A file system command helper to remove files or directories
Type: block
Scope: local
Task state execution events configuration
Type: string
Scope: requirements
Check if a binary exists
Type: timeout block|number
Scope: global|local
Define a max execution timeout. Optionally you can declare a timeout block with a per-task-specific timeout or a global timeout
Type: number
Scope: timeout
Define a task-specific execution timeout in miliseconds
Type: number
Scope: timeout
Define a global execution timeout in miliseconds
In order to provide cross-platform support for environment variables in builrc, it should be declared using the following notation:
${VARIABLE_NAME}
$[variable/command]
workdir
before
env
requirements
task
after
events
- Specific logic operators
- Standard input/output redirection with own DSL operators
- OS-agnostic command helpers (HTTP client, network testing, fs utilities, unix-like binaries emulation...)
Copyright (c) Adesis Netlife S.L and contributors
Specification licensed under Creative Commons CC-BY-SA