Public | Automated Build

Last pushed: a year ago
Short Description
Compile a go project, package it to a defined format, and push a release to GitHub.
Full Description

go-makefile

Define a set of standards for versioning, packaging, and releasing Go projects.

This project's objective is to compile a Go project for standard architectures,
version the binaries, package it to a defined format, and push a release to GitHub.

Installation

  1. Install Docker
  2. Add go-makefile to your project by copying the GoMakefile file to your project root.
    You do not need to copy any other files from the go-makefile repository to use GoMakefile.
  3. Create a Makefile in your repository with the contents (replace github.com/civisanalytics/example
    with your package path):
    ```
    VERSION := 1.0.0
    REPOSITORY := github.com/civisanalytics/example

include GoMakefile


## Usage

### Build the project

`make` or `make build`

### Test and Vet the project

`make test`

### Create a GitHub Release

 1. Set the `GITHUB_TOKEN` environment variable
 1. Run `make release`

#### Release Format

The default OS architectures are darwin/amd64 and linux/amd64.
The binary is compiled with a `main.VERSION` ldflag.

 - https://github.com/civisanalytics/example/releases/tag/v1.0.0
 - Downloads
   - PROJECTNAME_VERSION_darwin_amd64.tar.bz2
     - compressed with bzip2 because it has the best compression ratio of
       [go supported compression algorithms](https://golang.org/pkg/compress/)
     - contains basenamed executables in the root of the archive
   - PROJECTNAME_VERSION_linux_amd64.tar.bz2
     - "
   - SHA256SUMS
     - contains SHA 256 sums of the tar.bz2 files generated by shasum
     - one line per file and two spaces separate the checksum and filename

## Dockerfile

The [civisanalytics/go-makefile](https://hub.docker.com/r/civisanalytics/go-makefile/)
Docker image used by GoMakefile was created by the Dockerfile in this repository.

### Dependencies

 - The Go Programming Language
 - [gox](https://github.com/mitchellh/gox)
 - [hub](https://github.com/github/hub)

## Testing

Uses [bats](https://github.com/sstephenson/bats). Install with `brew install bats`.

Run tests with

bats test
```

go-makefile vs. Other Software

  • goxc
    • go-makefile focuses only on building and GitHub releasing using existing projects
      that specialize in those steps (gox and hub).
    • go-makefile does not require go to be installed (go runs inside of a docker container)
    • The configuration of go-makefile is done with Makefile variables.
  • Custom Shell Scripts
    • While these provide the most flexability, go-makefile provides a way to share a standard
      build and release process between multiple projects while defining a version and allowing
      integration with an existing Makefile workflow.

Contributing

See CONTRIBUTING.

License

go-makefile is released under the BSD 3-Clause License.

Docker Pull Command
Owner
civisanalytics
Source Repository

Comments (0)