Cherry
Cherry is an experimental tool and it is WORK-IN-PROGRESS.
Cherry is an opinionated tool for buidling and releasing applications.
Currently, Cherry only supports Go for building and GitHub repositories for releasing.
For Go applications, Cherry supports cross-compiling and injecting metadata into the binaries.
Prerequisites/Dependencies
You need to have the following tools installed and ready.
For releasing GitHub repository you need a personal access token with admin access to your repo.
Quick Start
Install
curl -s https://git.io/JeCX6 | sh
Or
curl -s https://raw.githubusercontent.com/moorara/cherry/master/scripts/install.sh | sh
Docker
The docker image for Cherry includes all the required tools and is accessible at moorara/cherry.
Examples
You can take a look at examples to see how you can use and configure Cherry.
Versioning
Cherry uses Semantic Versioning 2.0.0 as described here.
For injecting versioning and other metadata into your binaries,
you need to have a version
package with the following exported variables in it:
var (
Version string
Commit string
Branch string
GoVersion string
BuildTool string
BuildTime string
)
The initial release is always 0.1.0
.
Commands
You can run cherry
or cherry -help
to see the list of available commands.
For each command, you can also use -help
flag too see the help for that command.
init
cherry init
creates and adds the following files required by Cherry.
This can be used for initializing a Go repository to work with Cherry.
- Spec file (
cherry.yaml
)
- Version file (
version/version.go
)
semver
cherry semver
resolves and prints the current semantic version.
This can be used to get the current semantic version for building other artifacts such as Docker image.
build
cherry build
compiles your binary and injects the build information into the version
package.
cherry build -cross-compile
will build the binaries for all supported platforms.
release
cherry release
can be used for releasing a GitHub repository.
You can use -patch
, -minor
, or -major
flags to release at different levels.
You can also use -comment
flag to include a description for your release.
CHERRY_GITHUB_TOKEN
environment variable should be set to a personal access token with admin permission to your repo.
update
cherry update
will update Cherry to the latest version.
It downloads the latest release for your system from GitHub and replaces the local binary.
Development
Command |
Description |
make build |
Build the binary locally |
make build-all |
Build the binary locally for all supported platforms |
make test |
Run the unit tests |
make test-short |
Run the unit tests using -short flag |
make coverage |
Run the unit tests with coverage report |
make docker |
Build Docker image |
make push |
Push built image to registry |
make save-docker |
Save built image to disk |
make load-docker |
Load saved image from disk |