A general purpose build/install/deploy tool.
Project description
build-magic 🔨✨
An un-opinionated build automation tool.
Introduction
Build-magic is a command-line application for automating build/test/install/package/deploy tasks. It aims to provide a common means for automating tasks for developers and DevOps. Build-magic does this by abstracting away how and where the build tasks are executed. Developing a C++ application for Linux on a Windows laptop? Build-magic can build your project in a Linux container or virtual machine. Have a dedicated build server? Build-magic can SSH into the remote server and start the build.
There are four core principals behind build-magic:
- Work the way you want to work.
- Make building easier and portable.
- Not another CI or build tool.
- Enable developers to simplify DevOps.
Installation
Build-magic requires Python 3.6+. You can install build-magic with the following command:
pip install build-magic
To use the Docker command runner, Docker must be installed. You can find out more about installing Docker here.
To use the Vagrant command runner, Vagrant must be installed. You can find out more about installing Vagrant here.
Usage
Build-magic can execute arbitrary shell commands from it's command-line interface (CLI) or by specifying commands in a config file.
Here is a basic example of how to use build-magic from the command-line:
build-magic "echo hello world > hello.txt"
Multiple commands can be executed as a sequence by using the --command
option:
build-magic \
--verbose \
--command execute "echo hello >file1.txt" \
--command execute "echo world >file2.txt" \
--command build "tar -czf myfiles.tar.gz file1.txt file2.txt" \
--command execute "rm file1.txt file2.txt" \
--command install "tar -xzf myfiles.tar.gz" \
--command test "cat file1.txt file2.txt"
When using the --command
option, a directive that describes the command must be provided.The directive execute
can be used as a catch-all for describing any command. The --verbose
option will print anything written to stdout by an individual commands.
To run the commands in a Linux container, add the --runner
and --environment
options:
build-magic \
--runner docker \
--environment ubuntu:latest \
--verbose \
--command execute "echo hello > file1.txt" \
--command execute "echo world > file2.txt" \
--command build "tar -czf myfiles.tar.gz file1.txt file2.txt" \
--command execute "rm file1.txt file2.txt" \
--command install "tar -xzf myfiles.tar.gz" \
--command test "cat file1.txt file2.txt"
Run build-magic --help
for a list of all the available command-line options.
Sequences of commands can be grouped into stages and executed from a config file written in YAML. The contents of the config file config.yaml
will describes the same steps broken up into stages:
build-magic:
- stage:
name: Setup
commands:
- execute: echo hello > file1.txt
- execute: echo world > file2.txt
- stage:
name: Archive
commands:
- build: tar -czf myfiles.tar.gz file1.txt file2.txt
- execute: rm file1.txt file2.txt
- stage:
name: Un-Archive
commands:
- install: tar -xzf myfiles.tar.gz
- stage:
name: Result
commands:
- test: cat file1.txt file2.txt
You can view the documentation at https://cmmorrow.github.io/build-magic/.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for build_magic-0.3.2rc0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d43f1354649ff12dbc2b48814885b003922bc32bc1a90b8886054b10e73b5a01 |
|
MD5 | 1262f5502473b050a52cfb1773d4796e |
|
BLAKE2b-256 | fe100ebafa962f52fc6e7900220a8f80d8eb276ec2c61524c5e7d68c68e10a45 |